1#[cfg(feature = "serde")]
2use serde::{Deserialize, Serialize};
3use std::{collections::HashMap, hash::Hash};
4
5#[derive(Default, Clone, Debug)]
6#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
7pub struct DeviceInfo<'a> {
8 pub vendor_name: Option<&'a str>,
9 pub device_name: Option<&'a str>,
10 pub subvendor_name: Option<&'a str>,
11 pub subdevice_name: Option<&'a str>,
12}
13
14#[derive(Debug, PartialEq, Eq)]
15#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
16pub struct Vendor {
17 pub name: String,
18 pub devices: HashMap<u16, Device>,
19}
20
21#[derive(Debug, Clone, PartialEq, Eq)]
22#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
23pub struct Device {
24 pub name: String,
25 pub subdevices: HashMap<SubDeviceId, String>,
26}
27
28#[derive(Debug, Clone, PartialEq, Eq, Hash)]
29#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
30pub struct SubDeviceId {
31 pub subvendor: u16,
32 pub subdevice: u16,
33}
34
35#[derive(Debug, Clone, PartialEq, Eq)]
36#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
37pub struct Class {
38 pub name: String,
39 pub subclasses: HashMap<u8, SubClass>,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq)]
43#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
44pub struct SubClass {
45 pub name: String,
46 pub prog_ifs: HashMap<u8, String>,
47}