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

Make LangID optional on get_string() #140

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ pub trait UsbClass<B: UsbBus> {
///
/// * `index` - A string index allocated earlier with
/// [`UsbAllocator`](crate::bus::UsbBusAllocator).
/// * `lang_id` - The language ID for the string to retrieve.
/// * `lang_id` - The language ID for the string to retrieve. If the requested lang_id is not
/// valid it will default to EN_US.
fn get_string(&self, index: StringIndex, lang_id: LangID) -> Option<&str> {
let _ = (index, lang_id);
None
Expand Down
5 changes: 2 additions & 3 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,10 @@ impl<B: UsbBus> UsbDevice<'_, B> {
Err(_err) => {
#[cfg(feature = "defmt")]
defmt::warn!(
"Receive unknown LANGID {:#06X}, reject the request",
"Receive unknown LANGID {:#06X}, default to EN_US",
_err.number
);
xfer.reject().ok();
return;
LangID::EN_US
}

Ok(req_lang_id) => req_lang_id,
Expand Down
Loading