Skip to content

Commit f4f3f3c

Browse files
committed
modification after review
Cross check the list length between `extra_lang_ids`, `manufacturer`, `product` and `serial_number` on constructing `UsbDeviceBuilder`. Build `lang_id_bytes` with rust iterators in `descriptor_type::STRING` of `fn get_descriptor()`. A quick impl `LangID` enum.
1 parent 87deb19 commit f4f3f3c

File tree

6 files changed

+1042
-41
lines changed

6 files changed

+1042
-41
lines changed

src/class.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use crate::bus::{InterfaceNumber, StringIndex, UsbBus};
22
use crate::control;
33
use crate::control_pipe::ControlPipe;
4+
use crate::descriptor::lang_id::LangID;
45
use crate::descriptor::{BosWriter, DescriptorWriter};
56
use crate::endpoint::EndpointAddress;
67
use crate::{Result, UsbError};
@@ -43,7 +44,7 @@ pub trait UsbClass<B: UsbBus> {
4344
/// * `index` - A string index allocated earlier with
4445
/// [`UsbAllocator`](crate::bus::UsbBusAllocator).
4546
/// * `lang_id` - The language ID for the string to retrieve.
46-
fn get_string(&self, index: StringIndex, lang_id: u16) -> Option<&str> {
47+
fn get_string(&self, index: StringIndex, lang_id: LangID) -> Option<&str> {
4748
let _ = (index, lang_id);
4849
None
4950
}

src/descriptor.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ pub mod descriptor_type {
1919
}
2020

2121
/// String descriptor language IDs.
22-
pub mod lang_id {
23-
/// English (US)
24-
///
25-
/// Recommended for use as the first language ID for compatibility.
26-
pub const ENGLISH_US: u16 = 0x0409;
27-
}
22+
pub mod lang_id;
2823

2924
/// Standard capability descriptor types
3025
#[allow(missing_docs)]

0 commit comments

Comments
 (0)