Skip to content

Commit

Permalink
Merge pull request #140 from jose-acevedoflores/jose/lang_id_optional
Browse files Browse the repository at this point in the history
Make LangID optional on get_string()
  • Loading branch information
ryan-summers authored Feb 26, 2024
2 parents 0ca8f09 + 55aecdd commit ac36070
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit ac36070

Please sign in to comment.