Issue metadata
Sign in to add a comment
|
Windows support for HID devices removed from WebUSB (or no longer working) - chrome.hid not available
Reported by
al...@intellipay.com,
Apr 4 2018
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36 Steps to reproduce the problem: 1. user navigator.usb.requestDevice to acquire HID device 2. device.open() returns SecurityError: Access denied. 3. What is the expected behavior? Device opens and communication works normally. What went wrong? It appears that "libusb-Windows support for HID devices was removed. Chromium git log: fc27079 - (3 weeks ago) [M-65] Remove libusb-Windows support for HID devices - Reilly Grant 20aaf51 - (4 weeks ago) [M-66] Remove libusb-Windows support for HID devices - Reilly Grant ac149a8 - (4 weeks ago) Remove libusb-Windows support for HID devices - Reilly Grant The device works on Linux currently with 65.0.3325.162 with WebUSB Did this work before? Yes Unknown - possibly version 64 Does this work in other browsers? Yes Chrome version: 65.0.3325.181 Channel: n/a OS Version: Flash Version: The commit removing the WinUSB to HID translation asks us to migrate to chrome.hid: "This patch removes the Windows-specific support in libusb that provided a translation between the WinUSB API and the HID API. Applications currently depending on this using the chrome.usb API should switch to using the chrome.hid API." Looking at the chrome.usb API it appears that chrome.hid.getDevices is for the discontinued web apps platform, but chrome.hid.getUserSelectedDevices is "Dev channel only". What route do we use going forward? Are these APIs going to be available for websites or Chrome extensions? The docs https://developer.chrome.com/apps/hid seem to indicate that it's only for the now discontinued Chrome Apps.
,
Apr 4 2018
This is working as intended. The commit message is directed at users of the chrome.usb API, who have the opportunity to move to chrome.hid. For WebUSB, blocking of HID and other sensitive interface classes was announced here and will be rolling out in Chrome 67: https://groups.google.com/a/chromium.org/d/msg/blink-dev/LZXocaeCwDw/GLfAffGLAAAJ HID interfaces are blocked because developers should be using key/mouse events or the Gamepad API to read data from human interface devices. If you have a device which implements a vendor-specific protocol (i.e. not a standard HID device) then it should advertise a vendor-specific USB interface which will work with WebUSB.
,
Apr 13 2018
On 65.0.3325.181 I'm receiving the same error on a USB to UART device with a 0xff vendor specific class. I'm able to enumerate, but not open. THIS IS EXPECTED as the device is bound to the driver "silabs".
However, when I change the PID to another value(Using a firmware utility) so the driver does not capture the device then the device does not show in chrome://device-log or the picker for libusb (navigator.usb.getDevices()).
Here is the device info. I tried 10c4:1234 and 10c4:eaff. The original is 10c4:ea60:
Bus 003 Device 004: ID 10c4:eaff Cygnal Integrated Products, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x10c4 Cygnal Integrated Products, Inc.
idProduct 0xeaff
bcdDevice 1.00
iManufacturer 1 Silicon Labs
iProduct 2 IPAY CP2102 USB to UART Bridge Controller
iSerial 3 1234
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 2 IPAY CP2102 USB to UART Bridge Controller
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
I'm unsure whether I should open a new bug report for this or not.
Thanks,
Allan
,
Apr 13 2018
This is because, on Windows, the OS needs to know to load the winusb.sys driver or else a user-space application like Chrome has no way to talk to the device. There are two ways to do this: 1. Manually install an INF file like this one to tell Windows to load the right driver (update the device IDs to match yours): https://chromium.googlesource.com/chromium/src/+/master/tools/usb_gadget/usb_gadget.inf 2. Modify the device firmware to include Microsoft OS 2.0 Descriptors that include "WINUSB" as a Compatible ID: https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors Example firmware code for doing this is part of this Arduino library: https://github.com/webusb/arduino/blob/gh-pages/library/WebUSB/WebUSB.cpp This approach will work for Windows 8.1 and above.
,
Apr 13 2018
Thank you! |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by krajshree@chromium.org
, Apr 4 2018