Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
fastboot: set the language local string
Browse files Browse the repository at this point in the history
Set the language local string to 0x409 (English US / en-us) such that
fastboot will successfully read the usb descriptor serial number string.
The usbdevfs ioctl fails when the wIndex is not initialized with the
local for the unicode of the usb descriptor string.  usbdevfs is an
obsolete interface and fastboot probably needs a re-write to use libusb
like what is in adb.

Change-Id: I3687f84643f53c736f14b3ae7793185d9b5cccc0
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
  • Loading branch information
markgross authored and mdhorn committed Jan 23, 2012
1 parent f60e863 commit c840653
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions fastboot/usb_linux.c
Expand Up @@ -139,10 +139,11 @@ static int filter_usb_device(int fd, char *ptr, int len, int writable,
ctrl.bRequestType = USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE;
ctrl.bRequest = USB_REQ_GET_DESCRIPTOR;
ctrl.wValue = (USB_DT_STRING << 8) | dev->iSerialNumber;
ctrl.wIndex = 0;
//language ID (en-us) for serial number string
ctrl.wIndex = 0x0409;
ctrl.wLength = sizeof(buffer);
ctrl.data = buffer;
ctrl.timeout = 50;
ctrl.timeout = 50;

result = ioctl(fd, USBDEVFS_CONTROL, &ctrl);
if (result > 0) {
Expand Down
3 changes: 2 additions & 1 deletion fastboot/usb_osx.c
Expand Up @@ -331,7 +331,8 @@ static int try_device(io_service_t device, usb_handle *handle) {
req.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
req.bRequest = kUSBRqGetDescriptor;
req.wValue = (kUSBStringDesc << 8) | serialIndex;
req.wIndex = 0;
//language ID (en-us) for serial number string
req.wIndex = 0x0409;
req.pData = buffer;
req.wLength = sizeof(buffer);
kr = (*dev)->DeviceRequest(dev, &req);
Expand Down

0 comments on commit c840653

Please sign in to comment.