mdn / mdn/content

USB.requestDevice new `exclusionFilters` option

Open
#40,372 2 comments 0 reactions 0 assignees View on GitHub
Content:WebAPI goal: up-to-date needs BCD update
Dominant language
Markdown
Stars
11k
Forks
23.2k
Avg merge
2d 9h
Merged PRs (30d)
331

Description

### MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/USB/requestDevice

### What specific section or headline is this issue about?

Parameters

### What information was incorrect, unhelpful, or incomplete?

The current documentation on MDN incorrectly states the USB `requestDevice` method takes an array of filters as the only parameter. However, the `requestDevice` method takes an object with a property `filters` which is an array.

Current version (minus some bits to make viewable here.)
```
## Syntax

requestDevice(filters)

### Parameters

- `filters`
- : An array of filter objects for possible devices you would like to pair. Each filter
object can have the following properties:
- `vendorId`
- `productId`
- `classCode`
- `subclassCode`
- `protocolCode`
- `serialNumber`
```

### What did you expect to see?

Corrected version (minus some bits to make viewable here.)
```
## Syntax

requestDevice(options)

### Parameters
- `options`
- : An object that sets options for selecting an appropriate device.
The available options are:
- `filters`
- : An array of filter objects for possible devices you would like to pair. Each filter
object can have the following properties:
- `vendorId`
- `productId`
- `classCode`
- `subclassCode`
- `protocolCode`
- `serialNumber`
```

### Do you have any supporting links, references, or citations?

The correct parameters can be seen on the below link that confirms this issue.
[Device Enumeration](https://wicg.github.io/webusb/#enumeration)

### Do you have anything more you want to share?

I will push a pull request to fix this shortly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.