WICG / webusb

Connecting hardware to the web.
https://wicg.github.io/webusb/
Other
1.3k stars 126 forks source link

Determine what paramaters to provide to controlTransferOut #148

Closed srhise closed 5 years ago

srhise commented 5 years ago

I am trying to connect a USB device inside a webapp. I am able to connect to the device by its vendor / product ID and selec the right configuration. Using the following docs / examples:

image

I am unable to get a full example working where I receive data from the usb device into the browser. Seems like it is an issue not understanding how the controlTransferOut function works. I am connecting to a custom FT232R (UART) usb device, which is being paired with and the selectInterface and claimInterface promises are resolving. Just can't get .controlTransferOut to return anything but "The specified endpoint is not part of a claimed and selected alternate interface"

How can you determine how to provide the right parameters for:

requestType, reciepient, request, value, and index?

I ran lsusb to determine if I could gather any additional information but was unable to:

screen shot 2018-09-05 at 3 17 16 pm
reillyeon commented 5 years ago

The "The specified endpoint is not part of a claimed and selected alternate interface" error is generated if the index parameter of the control transfer does not match a claimed interface. The algorithm for determining that is here. In short, if recipient is "interface" then the lower 8 bits of index must be a claimed interface number (in this case 0) and if recipient is "endpoint" then the lower 8 bits of index must be the endpoint address of an endpoint that is part of a claimed interface (in this case 0x81). If recipient is "device" or "other" then there are no restrictions.

The code you posted sets recipient to "device" which means that the code you are running must be different.

Closing this issue because this issue tracker is not a support forum. If you have further questions please post on Stack Overflow where your question (and the answer) will be indexed by search engines and hopefully help other developers as well. I monitor questions posted with the #webusb tag.