Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: USB Descriptor String Descriptor Issue

  1. #1
    Junior Member
    Join Date
    Aug 2018
    Posts
    18

    USB Descriptor String Descriptor Issue

    Hello,

    I made an issue about it on github but I'm not sure it is regularly checked, so I post about it on the forum too :-)

    There may be an issue with the string descriptor information sent on the usb setup.
    I tried to debug it but didn't figure out how the missing data should be sent.
    Here is the problem :
    String Descriptor Table

    Index LANGID String
    0x00 0x0000
    0x01 0x0000 "Manufacturer"
    0x02 0x0000 "Product name"

    And it should be :

    Index LANGID String
    0x00 0x0000 0x0409
    0x01 0x0409 "Manufacturer"
    0x02 0x0409 "Product name"

    So first missing part is the wLangID not being set.
    And the second missing part is the LangID field not being set.
    (
    {0x0300, 0x0000, (const uint8_t *)&string0, 0},
    {0x0301, 0x0409, (const uint8_t *)&usb_string_manufacturer_name, 0},
    {0x0302, 0x0409, (const uint8_t *)&usb_string_product_name, 0},
    {0x0303, 0x0409, (const uint8_t *)&usb_string_serial_number, 0},
    )

    So basically I have tried to debug and print the sent usb packets through serial, and I think the wIndex is never taken into account.
    I am not sure at all if I am on the right track, and still I didn't figure out why the 0x0000 offset which we set at 0x0409 (the supported languages, english) is never set.

    Any idea ?

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    This is the definition of "string0" in usb_desc.c.

    Code:
    struct usb_string_descriptor_struct string0 = {
            4,
            3,
            {0x0409}
    };
    What do you believe it should be?

  3. #3
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    The definitions are good, but I believe they are lost somewhere as when you inspect the usb descriptor when pluging in your teensy device, it's not taken into account :

    Index LANGID String
    0x00 0x0000
    0x01 0x0000 "Manufacturer"
    0x02 0x0000 "Product name"

    Edit: I tracked it indeed, by "lost somewhere" I mean and wonder if it's not something that is missing in the endpoint0_transmit function. I am not sure at all, that is why I am asking for some help tho :-)

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Here's what my Beagle480 USB Protocol Analyzer sees.

    Click image for larger version. 

Name:	sc.png 
Views:	16 
Size:	288.5 KB 
ID:	14932

  5. #5
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    Uhm, I use an app called USBDeview to check usb descriptors.
    With all my mice the string descriptor are well formed, but with the teensy impl I have this problem.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Here's one more screenshot with the other 3 string descriptors expanded, so you can see all the data bytes in those transfers.

    Click image for larger version. 

Name:	sc.png 
Views:	15 
Size:	337.0 KB 
ID:	14933

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    If you want, I will make one more test run and post another screenshot.

    But I'm only going to do 1 more if it doesn't show any issue, so make this one count. Please provide a complete program here for me to copy into Arduino, and show me a screenshot of your Arduino Tools menu so I can get the exact same settings. Be specific about which Teensy you're using. I will use Arduino 1.8.7 with Teensyduino 1.44, so please make sure you are using the latest version. If there is some strange problem, clearly it's not showing up when I just use the default settings with ordinary Arduino examples... so if you ask me to do another run, give it the best chance that I will manage to recreate the same conditions that you tested.

  8. #8
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    Ok, I will get all the tools up to date and clean on another computer, and test again :-)

  9. #9
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    Ok, so I have tested it like that :
    - New installation of arduino 1.8.7 on Mac OS (updated), never installed arduino there before
    - new installation of teensyduino 1.44
    - Empty sketch (empty setup, empty loop)
    - 2 modified parameters : Teensy 3.6, USB Type : Serial + Keyboard + Mouse + Joystick
    -- Nothing is modified, no filed modified at all

    - Capture of usb descriptor with Thesycon USB Descriptor Dumper 2.11.0 (I have just seen I have said USBDeview in my previous post, it was an error, I use this tdd application actually)

    Result :
    String Descriptor Table
    --------------------------------
    Index LANGID String
    0x00 0x0000
    0x01 0x0000 "Teensyduino"
    0x02 0x0000 "Serial/Keyboard/Mouse/Joystick"
    0x03 0x0000 "4777770"
    0x04 0x0000 Request failed with 0x0000001Fv

    So the issues are :
    - First offset (which describes supported languages) should have the 'string0' value which is 0x0409 (english language value)
    - The transmitted strings ("Teensyduino", "Serial/Keyboard/Mouse/Joystick", "4777770") should have a LangID of 0x0409 which correspond to the wIndex).

    I indeed can see in your second screenshot you are transmitting the values (0x0409), so so far I don't really know where the anomaly comes from ; I am going to search around if I can find any thing.

  10. #10
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    Weird behaviour :

    If I change only the string0 value to 0x0000, it is read :
    String Descriptor Table
    --------------------------------
    Index LANGID String
    0x00 0x0000 0x0000
    0x01 0x0000 Request failed with 0x0000001F
    0x02 0x0000 Request failed with 0x0000001F

    I have tested changes to other values and they don't appear (0x040c, 0x0001, 0x0904).

    I have also tried to support multiple languages, but they don't appear in the supported languages; And only the first encoded strings (0x301 and 0x302) appear, next offsets don't.

    It doesn't seem to be all wrong, as Windows still reads the device name when you plug in the device.

    At first I though it could be a problem with the descriptor dumper application, but I have tested 7 other devices and all of them are correctly received/read ; like in :
    Index LANGID String
    0x00 0x0000 0x0409
    0x01 0x0409 "Manufacturer"
    0x02 0x0409 "Product name"

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Quote Originally Posted by False View Post
    on Mac OS (updated)
    Click the Apple menu, then "About This Mac".

    What is the exact version of MacOS you're using?

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    Quote Originally Posted by False View Post
    with Thesycon USB Descriptor Dumper 2.11.0 (I have just seen I have said USBDeview in my previous post, it was an error, I use this tdd application actually)
    Is this the correct program?

    https://www.thesycon.de/eng/usb_descriptordumper.shtml

    It appears to be for Windows only. Is there a Macintosh version you're running?


    (can you see how you're making me try to guess these details.....)

  13. #13
    Junior Member
    Join Date
    Aug 2018
    Posts
    18
    Yes, sorry Paul I realize I didn't make it clear.
    I didn't update to Mojave yet indeed for dev reasons, I'm using Mac OS High Sierra, last update : 10.13.6.
    I used my mac partition to have a clean install of Teensyduino and be sure to not have any modified libray or file. I didn't install Teensyduino (neither arduino) on there before.

    But I used https://www.thesycon.de/eng/usb_descriptordumper.shtml on Windows 10, build 1803 to observe usb descriptors. I have checked and I can't find a mac os version.
    I guess by that question you don't have bootcamp ? I will try to find a usb descriptor inspector program that reproduces the issue I am talking about for osx.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,679
    I do have 2 macs with bootcamp and images of various installs of Windows, which I restore to the bootcamp partition with Winclone so I can test stuff with specific versions of Windows.

    The point of these questions is to figure out exactly what software you're really using. I've already done a quick test that didn't seem to show anything wrong, so if I do anything more I want to make sure I'm running the same code.

    On the Mac side, Apple has a utility called USB Prober, which shows USB descriptor info and can save to a text file. It used to be included with their Xcode dev tools.

    https://superuser.com/questions/7819...dk-on-mac-os-x

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •