diff --git a/src/common.rs b/src/common.rs index 435a377..14a4187 100644 --- a/src/common.rs +++ b/src/common.rs @@ -18,6 +18,8 @@ pub struct UsbDevice { pub serial_number: Option, /// Class (bDeviceBaseClass) of device. pub base_class: Option, + /// Class as string + pub class: Option, /// Manufacturer pub manufacturer: Option, } @@ -25,6 +27,7 @@ pub struct UsbDevice { /// See #[repr(u8)] #[derive(Hash, Eq, Debug, Clone, PartialEq, TryFromPrimitive)] +#[allow(dead_code)] pub enum DeviceBaseClass { UseClassCodeFromInterfaceDescriptors = 0x00, Audio = 0x01, diff --git a/src/linux.rs b/src/linux.rs index 9f495fc..f46c158 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -67,6 +67,19 @@ pub fn enumerate_platform(vid: Option, pid: Option) -> Vec .attribute_value("bDeviceClass") .and_then(|x| x.to_str()?.parse::().ok()); + let friendly_name = device + .property_value("ID_MODEL_FROM_DATABASE") + .and_then(|s| s.to_str()) + .map(|x| x.to_string()); + let manufacturer = device + .property_value("ID_VENDOR_FROM_DATABASE") + .and_then(|s| s.to_str()) + .map(|x| x.to_string()); + let class = device + .property_value("ID_PCI_CLASS_FROM_DATABASE") + .and_then(|s| s.to_str()) + .map(|x| x.to_string()); + output.push(UsbDevice { id, vendor_id, @@ -74,6 +87,9 @@ pub fn enumerate_platform(vid: Option, pid: Option) -> Vec description, serial_number, base_class: bclass.and_then(|bc| DeviceBaseClass::try_from(bc).ok()), + class, + friendly_name, + manufacturer, }); Ok(())