Skip to content

Commit 25fff75

Browse files
author
Dilawar Singh
committed
chore: class -> baseClass
1 parent de219f9 commit 25fff75

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/common.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ pub enum DeviceBaseClass {
4949
VendorSpecific = 0xFF,
5050
}
5151

52+
impl From<String> for DeviceBaseClass {
53+
fn from(v: String) -> Self {
54+
match v.to_lowercase().as_ref() {
55+
"usb" => Self::MassStorage,
56+
"bluetooth" => Self::Communication,
57+
"hidclass" => Self::HumanInterfaceDevice,
58+
"camera" => Self::Video,
59+
"biometric" => Self::ContentSecurity,
60+
"net" => Self::WirelessController,
61+
_ => Self::UseClassCodeFromInterfaceDescriptors,
62+
}
63+
}
64+
}
65+
5266
#[derive(Copy, Clone, Debug)]
5367
pub struct ParseError;
5468

src/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn enumerate_platform(vid: Option<u16>, pid: Option<u16>) -> Vec<UsbDevice>
113113
product_id,
114114
description: Some(description),
115115
serial_number,
116-
class,
116+
base_class: class.map(|cls| cls.into()),
117117
});
118118
}
119119
}

0 commit comments

Comments
 (0)