我在 Windows 7 上运行 Chrome 的 WebUSB 来尝试打开智能卡读卡器。当我使用没有过滤器的 navigator.usb.requestDevices() 时,设备有时会出现。如果我在过滤器中包含 vendorId 和 productId,则该设备无法在 Chrome 中选择/列出。此外,当我尝试使用
.then(() => device.selectConfiguration(1))
.then(() => device.claimInterface(0))
我被拒绝访问(权限不足)。在实践中,为了将设备连接到 Chrome 并对其进行操作,是否真的需要每个设备都具有与WebUSB 文档上发布的设备描述符格式完全相同的设备描述符?我也尝试过使用 Zadig 将驱动程序更改为 WinUSB,但这并没有改变任何东西。
---===>Device Information<===---
English product name: "SCR33xx v2.0 USB SC Reader"
ConnectionStatus:
Current Config Value: 0x01 -> Device Bus Speed: Full
Device Address: 0x03
Open Pipes: 3
===>Device Descriptor<===
bLength: 0x12
bDescriptorType: 0x01
bcdUSB: 0x0200
bDeviceClass: 0x00 -> This is an Interface Class Defined Device
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x20 = (32) Bytes
idVendor: 0x04E6 = Identive Group Inc.
idProduct: 0x5116
bcdDevice: 0x0304
iManufacturer: 0x01
English (United States) "SCM Microsystems"
iProduct: 0x02
English (United States) "SCR33xx v2.0 USB SC Reader"
iSerialNumber: 0x00
bNumConfigurations: 0x01
---===>Open Pipes<===---
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0008 = 0x08 bytes
bInterval: 0x10
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x05 -> Direction: OUT - EndpointID: 5
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
---===>Full Configuration Descriptor<===---
===>Configuration Descriptor<===
bLength: 0x09
bDescriptorType: 0x02
wTotalLength: 0x005D -> Validated
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x03
English (United States) "CCID Class"
bmAttributes: 0xA0 -> Bus Powered
-> Remote Wakeup
MaxPower: 0x32 = 100 mA
===>Interface Descriptor<===
bLength: 0x09
bDescriptorType: 0x04
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x03
bInterfaceClass: 0x0B -> This is a Chip/Smart Card USB Device Interface Class
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x04
English (United States) "CCID Interface"
===>HID Descriptor<===
bLength: 0x36
bDescriptorType: 0x21
bcdHID: 0x0110
bCountryCode: 0x00
bNumDescriptors: 0x07
bDescriptorType: 0x03
wDescriptorLength: 0x0000
bDescriptorType: 0x00
wDescriptorLength: 0x12C0
bDescriptorType: 0x00
wDescriptorLength: 0x4000
bDescriptorType: 0x1F
wDescriptorLength: 0x0000
bDescriptorType: 0x00
wDescriptorLength: 0x3267
bDescriptorType: 0x00
wDescriptorLength: 0xE700
bDescriptorType: 0x4C
wDescriptorLength: 0x0006
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3
bmAttributes: 0x03 -> Interrupt Transfer Type
wMaxPacketSize: 0x0008 = 0x08 bytes
bInterval: 0x10
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x05 -> Direction: OUT - EndpointID: 5
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00
===>Endpoint Descriptor<===
bLength: 0x07
bDescriptorType: 0x05
bEndpointAddress: 0x84 -> Direction: IN - EndpointID: 4
bmAttributes: 0x02 -> Bulk Transfer Type
wMaxPacketSize: 0x0040 = 0x40 bytes
bInterval: 0x00