1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use std::fmt;
pub enum DeviceClass {
Unclassified,
MassStorageController,
NetworkController,
DisplayController,
MultimediaController,
MemoryController,
PCIBridge,
CommunicationController,
GenericSystemPeripheral,
InputDeviceController,
DockingStation,
Processor,
SerialBusController,
WirelessController,
IntelligentController,
SatelliteCommunicationsController,
EncryptionController,
SignalProcessingController,
ProcessingAccelerators,
NonEssentialInstrumentation,
Unknown,
}
impl fmt::Display for DeviceClass {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
DeviceClass::Unclassified => write!(f, "Unclassified"),
DeviceClass::MassStorageController => write!(f, "Mass Storage Controller"),
DeviceClass::NetworkController => write!(f, "Network Controller"),
DeviceClass::DisplayController => write!(f, "Display Controller"),
DeviceClass::MultimediaController => write!(f, "Multimedia Controller"),
DeviceClass::MemoryController => write!(f, "Memory Controller"),
DeviceClass::PCIBridge => write!(f, "PCI Bridge"),
DeviceClass::CommunicationController => write!(f, "Communication Controller"),
DeviceClass::GenericSystemPeripheral => write!(f, "Generic System Peripheral"),
DeviceClass::InputDeviceController => write!(f, "Input Device Controller"),
DeviceClass::DockingStation => write!(f, "Docking Station"),
DeviceClass::Processor => write!(f, "Processor"),
DeviceClass::SerialBusController => write!(f, "Serial Bus Controller"),
DeviceClass::WirelessController => write!(f, "Wireless Controller"),
DeviceClass::IntelligentController => write!(f, "Intelligent Controller"),
DeviceClass::SatelliteCommunicationsController => {
write!(f, "Satellite Communications Controller")
}
DeviceClass::EncryptionController => write!(f, "Encryption Controller"),
DeviceClass::SignalProcessingController => write!(f, "Signal Processing Controller"),
DeviceClass::ProcessingAccelerators => write!(f, "Processing Accelerators"),
DeviceClass::NonEssentialInstrumentation => write!(f, "Non Essential Instrumentation"),
DeviceClass::Unknown => write!(f, ""),
}
}
}
impl From<DeviceClass> for &'static str {
fn from(class: DeviceClass) -> &'static str {
match class {
DeviceClass::Unclassified => "Unclassified",
DeviceClass::MassStorageController => "Mass Storage Controller",
DeviceClass::NetworkController => "Network Controller",
DeviceClass::DisplayController => "Display Controller",
DeviceClass::MultimediaController => "Multimedia Controller",
DeviceClass::MemoryController => "Memory Controller",
DeviceClass::PCIBridge => "PCI Bridge",
DeviceClass::CommunicationController => "Communication Controller",
DeviceClass::GenericSystemPeripheral => "Generic System Peripheral",
DeviceClass::InputDeviceController => "Input Device Controller",
DeviceClass::DockingStation => "Docking Station",
DeviceClass::Processor => "Processor",
DeviceClass::SerialBusController => "Serial Bus Controller",
DeviceClass::WirelessController => "Wireless Controller",
DeviceClass::IntelligentController => "Intelligent Controller",
DeviceClass::SatelliteCommunicationsController => "Satellite Communications Controller",
DeviceClass::EncryptionController => "Encryption Controller",
DeviceClass::SignalProcessingController => "Signal Processing Controller",
DeviceClass::ProcessingAccelerators => "Processing Accelerators",
DeviceClass::NonEssentialInstrumentation => "Non Essential Instrumentation",
DeviceClass::Unknown => "",
}
}
}