[PATCH 6/6] main: Rename MAX_ALT_NAME_LEN and bump it to 1023

Tormod Volden lists.tormod at gmail.com
Fri Sep 2 23:01:30 CEST 2011


I will have to fix and resubmit this patch. I realized that the USB
string descriptors (like the other USB descriptors) have a bLength
field that is only one byte wide, so any descriptor is maximum 255
bytes (which after the bLength and bDescritorType fields leaves 253
bytes for the string. The string is in Unicode and I have only seen
2-byte UTF-16 implementations, which is also what libusb supports. So
the resulting ascii string can be maximum 126 characters long + zero
termination byte. Although for what I know UTF-8 could theoretically
be possible, which would mean up to 253 characters.

Maybe rename it to MAX_DESC_STR_LEN? I think MAX_STR_LEN sounds too
much like a more generic OS or library string limitation.

Tormod



More information about the devel mailing list