After obtaining access to an attached device using navigator.usb.requestDevice
I'm trying to open a connection with an attached device as follows:
device.open()
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(1))
It seemingly successfully selects the configuration, however the claimInterface
step will produce the following error:
DOMException: Unable to claim interface.
I'm running Chrome 55.0.2883.75 beta with the --disable-webusb-security
flag as root (without those I didn't get any devices) on Ubuntu 16.10.
How can I get the connection up and running?
Edit:
It seems that the cdc_acm driver already claimed the interface since device I'm trying to attach is a serial device, unloading the driver will allow you to claim the device (however after this it plains about interface 1 not being available, as well as 0 or 2).
After obtaining access to an attached device using navigator.usb.requestDevice
I'm trying to open a connection with an attached device as follows:
device.open()
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(1))
It seemingly successfully selects the configuration, however the claimInterface
step will produce the following error:
DOMException: Unable to claim interface.
I'm running Chrome 55.0.2883.75 beta with the --disable-webusb-security
flag as root (without those I didn't get any devices) on Ubuntu 16.10.
How can I get the connection up and running?
Edit:
It seems that the cdc_acm driver already claimed the interface since device I'm trying to attach is a serial device, unloading the driver will allow you to claim the device (however after this it plains about interface 1 not being available, as well as 0 or 2).
Share Improve this question edited Dec 7, 2016 at 7:33 Joris Blaak asked Dec 6, 2016 at 13:45 Joris BlaakJoris Blaak 3982 silver badges10 bronze badges 1-
1
Since this device has multiple interfaces we should make sure that you're claiming the right one. Please include the output of
lsusb -v
for your device which will list the full device descriptors. A USB CDC device will indeed be difficult to use with WebUSB because of the existing drivers that are loaded however forcing the driver to unload should release the interface. When you get an error like "Unable to claim interface" Chrome will provide possibly more detail about the error in chrome://device-log. – Reilly Grant Commented May 5, 2017 at 23:54
1 Answer
Reset to default 2Once the configuration is selected, you can find the right interface number in device.configuration.interfaces[0].interfaceNumber
:
device.open()
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(device.configuration.interfaces[0].interfaceNumber))
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744753613a4591747.html
评论列表(0条)