rust-embedded-community / usb-device

Experimental device-side USB framework for microcontrollers in Rust.
MIT License
413 stars 77 forks source link

Make LangID optional on get_string() #140

Closed jose-acevedoflores closed 4 months ago

jose-acevedoflores commented 5 months ago

I've been playing around with the Microsoft OS String Descriptors (specifically to get the winusb driver installed on my device) and everything was working fine on 0.2.9 but the update to 0.3.0 (#122) introduced a behavior difference.

The change in #122 requires that req.index be a valid lang id, if not, it exits early and doesn't call the get_string method.

I also thought lang id could be set to a default in order to not get a breaking change but I think it obscures that LangId might not be set for all requests?

Any thoughts appreciated. I'm just dabbling on embedded stuff so I could be missing something.

jose-acevedoflores commented 4 months ago

Made the change to just use EN_US as fallback if LangID is not valid. Let me know if you want me to collapse the two commits into one too.

ryan-summers commented 4 months ago

Wonderful, thanks for the PR! :)