Content originally posted in LPCWare by traspando on Fri Sep 21 23:20:48 MST 2012 Tonight I was debugging some usb issues and in an attempt to verify some device descriptor strings were correct before uploading it to my board, I ran the linux utility "strings" on the .bin file.
I was quite surprised to find the strings were not present! They were there (I uploaded the bin to my uC and everything worked fine), just in a non-ascii encoding...
Content originally posted in LPCWare by gbm on Sun Sep 23 00:17:36 MST 2012 In USB descriptors characters are represented in 16-bit Unicode. When you define them, you usually use some 16-bit type, not plain char.
Content originally posted in LPCWare by traspando on Sat Sep 22 14:22:22 MST 2012 I opened up one of these binaries in a hex editor and found that characters are stored as 16 bytes (vs the 8bits I expected). This will let you see them: strings -e l <binary>
Why is it storing them this way?
char test = "Tacos!"
gets stored as T 0x00 a 0x00 c 0x00 o 0x00 s 0x00 ! 0x00
Content originally posted in LPCWare by TheFallGuy on Sat Sep 22 01:06:20 MST 2012 They are encoded in ascii. More likely is that you are mis understanding what strings does. From the strings man page: A string is any sequence of 4 (the default) or more printing characters ending with a newline or a null.