Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase initial size of usb_string_serial_number by 2 on Teensy3/Teensy4 #722

Closed
wants to merge 1 commit into from

Conversation

hmaarrfk
Copy link

I was auditing the code and noticed two things:

  1. The initial size is 12, which is: not equal to 10 * 2, 0, or 10
  2. The data is copied from a buffer of size 11, so the size should be at least 11.

I am unsure if the default value should be bLength=24 or bLength=2, both seem somewhat valid to me.

@PaulStoffregen
Copy link
Owner

This is incorrect. Please read the USB 2.0 spec regarding string descriptors.

@hmaarrfk
Copy link
Author

Will reopen. thank you.

@hmaarrfk
Copy link
Author

I see, i read that it is in fact 2 + "length of string". The string stored is not "null terminated".

I still think that the value of "12" is off. it should be either "2" or "22" as I understand it.

@hmaarrfk hmaarrfk reopened this Sep 30, 2023
@hmaarrfk
Copy link
Author

ultimately, it is inconsequential due to the initialization routine. thanks for the usb pointer.

@hmaarrfk hmaarrfk closed this Sep 30, 2023
@PaulStoffregen
Copy link
Owner

I still think that the value of "12" is off. it should be either "2" or "22" as I understand it.

screenshot

@PaulStoffregen
Copy link
Owner

Oh, yes, now I see. It should be 22. If you still care about this, please send a new PR which just changes 12 to 22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants