chrome.usb.controlTransfer should allow access to all string descriptors
Reported by
m...@retailarchitects.com,
Jun 14 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Steps to reproduce the problem:
1. get a usb device that has more then 3 string descriptors.
2. try to get all string descriptors.
3. the standard descriptors 01, 02, and 03 come back fine, any additional ones fail.
What is the expected behavior?
The chrome.usb.controlTransfer should respect the requested parameters and return the data from the device. From wireshark logs it seems as if chrome.usb will only request the standard 3 descriptors and not allow for vendor defined descriptors to be queried.
What went wrong?
When trying to get string descriptors other then 01, 02, and 03, controlTransfer fails.
My device has vendor defined descriptors 04, 05, 06 with valid data.
From a different test utility with WireShark monitoring USB, I get something like this as an example:
Frame 198: Request
USB URB
[Source: host]
[Destination: 2.9.0]
USBPcap pseudoheader length: 28
IRP ID: 0xffffe001617eebd0
IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
URB Function: URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE (0x000b)
IRP information: 0x00, Direction: FDO -> PDO
0000 000. = Reserved: 0x00
.... ...0 = Direction: FDO -> PDO (0x00)
URB bus id: 2
Device address: 9
Endpoint: 0x00, Direction: OUT
0... .... = Direction: OUT (0)
.000 0000 = Endpoint value: 0
URB transfer type: URB_CONTROL (0x02)
Packet Data Length: 8
[Response in: 199]
Control transfer stage: Setup (0)
URB setup
0000 1c 00 d0 eb 7e 61 01 e0 ff ff 00 00 00 00 0b 00 ....~a..........
0010 00 02 00 09 00 00 02 08 00 00 00 00 80 06 06 03 ................
0020 09 04 83 00
Frame 199: Response...
USB URB
[Source: 2.9.0]
[Destination: host]
USBPcap pseudoheader length: 28
IRP ID: 0xffffe001617eebd0
IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008)
IRP information: 0x01, Direction: PDO -> FDO
0000 000. = Reserved: 0x00
.... ...1 = Direction: PDO -> FDO (0x01)
URB bus id: 2
Device address: 9
Endpoint: 0x80, Direction: IN
1... .... = Direction: IN (1)
.000 0000 = Endpoint value: 0
URB transfer type: URB_CONTROL (0x02)
Packet Data Length: 56
[Request in: 198]
[Time from request: 0.000236000 seconds]
Control transfer stage: Data (1)
STRING DESCRIPTOR
0000 1c 00 d0 eb 7e 61 01 e0 ff ff 00 00 00 00 08 00 ....~a..........
0010 01 02 00 09 00 80 02 38 00 00 00 01 38 03 56 00 .......8....8.V.
0020 3d 00 33 00 2c 00 53 00 43 00 3d 00 31 00 2c 00 =.3.,.S.C.=.1.,.
0030 4d 00 53 00 32 00 3d 00 31 00 2c 00 20 00 50 00 M.S.2.=.1.,. .P.
0040 46 00 4b 00 3d 00 31 00 2c 00 55 00 44 00 45 00 F.K.=.1.,.U.D.E.
0050 3d 00 31 00 =.1.
From chrome.usb - with the following sample code, I get only the first three descirptors back, any additional ones fail with Transfer Failed...
chrome://device-log/ shows the following:
USB Event [2016/06/14 11:42:04.111736] usb_device_handle_impl.cc:453 Failed to submit transfer: Invalid parameter
USB Event [2016/06/14 11:42:04.101754] usb_device_impl.cc:317 Failed to open device: Entity not found
USB Event [2016/06/14 11:42:04.101701] usb_device_impl.cc:259 Failed to get config descriptor: Entity not found
my sample code...
var i=0,
ctrl_xfer = {
direction: "in",
recipient: "device",
requestType: "standard",
request: 6, /* 6=get descriptor */
value: 0x0300, /* 0x0300 - to get Lang_id, 0x0301 - to get Manufacturer string, 0x0302 - to get Product string, 0x0303 - to get SerialNumber string */
index: 0x0409, /* 0x0409 ... this is the language ID that matters when getting the actual strings use 'value' 0x0300 to get the lang_id's defined */
length: 0x82,
data: new ArrayBuffer([]),
timeout: 5
};
for (var i = 0; i<5; i++) {
ctrl_xfer.value = 0x0300 + i;
chrome.usb.controlTransfer( handle, ctrl_xfer, function (info) {
console.log("descirptor: ", ctrl_xfer, info, chrome.runtime.lastError);
console.log( new Uint8Array(info.data),new Uint16Array(info.data) );
if ( chrome.runtime.lastError ) {
chrome.usb.closeDevice(handle);
i+=100;
}
});
}
Did this work before? N/A
Chrome version: 51.0.2704.84 Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0
,
Jul 1 2016
,
Sep 22 2016
any update on this?
,
Jun 7 2017
,
Jun 8 2018
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
||||
►
Sign in to add a comment |
||||
Comment 1 by kavvaru@chromium.org
, Jun 15 2016