ftdi_usb_get_strings failed

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ftdi_usb_get_strings failed

rix.li
I was running the "find_all" example program on MSYS2 MinGW32 with FT232H board from  Adafruit [1]. I've replaced the OEM FTDI driver with libusb-win32, but the program ran into error:

$ ./find_all.exe
Number of FTDI devices found: 1
Checking device: 0
ftdi_usb_get_strings failed: -7 (libusb_get_string_descriptor_ascii() failed)

Since libusb_open() was successful it seems like the driver is actually functioning. So I used USBPcap to probe the connection with my FTDI board.

Here's what happened when the error occurs.

First the host machine sends the following packet to the device for the string descriptor of identifier 0x03.

USB URB
    [Source: host]
    [Destination: 3.28.0]
    USBPcap pseudoheader length: 28
    IRP ID: 0xffffd58002889010
    IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
    URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008)
    IRP information: 0x00, Direction: FDO -> PDO
    URB bus id: 3
    Device address: 28
    Endpoint: 0x80, Direction: IN
    URB transfer type: URB_CONTROL (0x02)
    Packet Data Length: 8
    [Response in: 442]
    Control transfer stage: Setup (0)
URB setup
    bmRequestType: 0x80
    bRequest: GET DESCRIPTOR (6)
    Descriptor Index: 0x01
    bDescriptorType: 0x03
    Language Id: English (United States) (0x0409)
    wLength: 255

0000   1c 00 10 90 88 02 80 d5 ff ff 00 00 00 00 08 00  ................
0010   00 03 00 1c 00 80 02 08 00 00 00 00 80 06 01 03  ................
0020   09 04 ff 00                                      ....

Then the device replied with a strangely malformed packet:

USB URB
    [Source: 3.28.0]
    [Destination: host]
    USBPcap pseudoheader length: 28
    IRP ID: 0xffffd58002889010
    IRP USBD_STATUS: USBD_STATUS_SUCCESS (0x00000000)
    URB Function: URB_FUNCTION_CONTROL_TRANSFER (0x0008)
    IRP information: 0x01, Direction: PDO -> FDO
    URB bus id: 3
    Device address: 28
    Endpoint: 0x80, Direction: IN
    URB transfer type: URB_CONTROL (0x02)
    Packet Data Length: 18
    [Request in: 441]
    [Time from request: 0.000961000 seconds]
    Control transfer stage: Data (1)
STRING DESCRIPTOR
    bLength: 255
    bDescriptorType: 0xff
[Malformed Packet: USB]
    [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]

0000   1c 00 10 90 88 02 80 d5 ff ff 00 00 00 00 08 00  ................
0010   01 03 00 1c 00 80 02 12 00 00 00 01 ff ff ff ff  ................
0020   ff ff ff ff ff ff ff ff ff ff ff ff ff ff        ..............

I also compiled and ran the same program on MacOS and the same thing happened.

Comparing to the OEM FTDI driver that I also probed on. When they list the devices with their description strings, the driver never asks the device for string descriptors.

It seems to me that they hard coded those information in their driver thus they just return those data according to the product ID, instead of fetching from the device.

I would also assume that, at least for my device, it doesn't support returning string descriptors to libusb (neither WinUSB).




libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ftdi_usb_get_strings failed

Xiaofan Chen
On Fri, Jan 20, 2017 at 2:10 PM, rix.li <[hidden email]> wrote:
> I was running the "find_all" example program on MSYS2 MinGW32 with FT232H
> board from  Adafruit [1]. I've replaced the OEM FTDI driver with
> libusb-win32, but the program ran into error:
>

Do not use libusb-win32 driver with libusb Windows (1.0 API) since
there are multiple problems with it. Use WinUSB or libusbK driver
instead. In general, it is better just using WinUSB.

Or you can try the latest usbdk backend, which will keep the
vendor driver (FTDI driver in this case).
>
> I also compiled and ran the same program on MacOS and the same thing
> happened.

In that case, this looks like a device problem.

> ...
> I would also assume that, at least for my device, it doesn't support
> returning string descriptors to libusb (neither WinUSB).
>
> [1] https://www.adafruit.com/products/2264

Have you talked to the vendor? This seems to be strange. I've
never seen such a problem with the FTDI device I have
(quite a few, but no FT232H).

--
Xiaofan

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ftdi_usb_get_strings failed

rix.li
I turns out it's because my FT232H chip's EEPROM is empty, filled with 0xFF.
It's indeed where the chip stores customized USB descriptors values.
With the FTDI's FT_PROG utility I'm able to program the values through the
OEM driver.
Now the "find_all" program works and reports the strings I programmed into
the EEPROM.

I think you can reproduce my problem by erase the EEPROM with FT_PROG. I
think it's indeed an exception should be taking care of when libusb failed
to get the string descriptors. Maybe inform the user their chip's EEPROM
might be empty.


libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Loading...