Read USB descriptor

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
E_521156
Level 4
Level 4
100 sign-ins 50 replies posted 50 sign-ins

Hi,

I am trying to read the serial number(SN) from the descriptor in a C++ code in Linux by libusb_get_string_descriptor_ascii.

I read the SN first, then program a new .img file with a different serial number, a soft reset, and then read SN again. So I read the SN twice in my code.

The first time that I read SN, it is ok. but at the second read, it gives me garbage values for SN. It looks like that libusb_get_string_descriptor_ascii has some problem after doing a board soft reset.

I added a delay after soft reset by usleep to let the board reset properly, but if it was more than a few milliseconds, the interface claiming failed as well. Small delay didn't solve the problem. 

Do you have any idea for that? If it is  libusb_get_string_descriptor_ascii problem, is there any command instead of that to solve the problem? I should mention that I don't have this issue in windows version.

Thanks

0 Likes
1 Solution

Hi,
After reset libusb_get_string_descriptor_ascii  return -4 (no device found) for all commands.
The problem was solved by pause and open it again. 
Thanks

View solution in original post

0 Likes
2 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

To understand the problem better, please let me know if reading of other descriptors for example configuration descriptor happens as expected after the soft reset or garbage is seen.

Also, let me know if libusb_get_string_descriptor_ascii returns success for second time

Regards,
Rashi
0 Likes

Hi,
After reset libusb_get_string_descriptor_ascii  return -4 (no device found) for all commands.
The problem was solved by pause and open it again. 
Thanks

0 Likes