MCPcopy Create free account
hub / github.com/OpenActionAPI/rust-elgato-streamdeck / list_devices

Function list_devices

src/lib.rs:56–73  ·  view source on GitHub ↗

Returns a list of devices as (Kind, Serial Number) that could be found using HidApi. WARNING:** To refresh the list, use [refresh_device_list]

(hidapi: &HidApi)

Source from the content-addressed store, hash-verified

54///
55/// **WARNING:** To refresh the list, use [refresh_device_list]
56pub fn list_devices(hidapi: &HidApi) -> Vec<(Kind, String)> {
57 hidapi
58 .device_list()
59 .filter_map(|d| {
60 if !is_vendor_familiar(&d.vendor_id()) {
61 return None;
62 }
63
64 if let Some(serial) = d.serial_number() {
65 Some((Kind::from_vid_pid(d.vendor_id(), d.product_id())?, serial.to_string()))
66 } else {
67 None
68 }
69 })
70 .collect::<HashSet<_>>()
71 .into_iter()
72 .collect()
73}
74
75/// Type of input that the device produced
76#[derive(Clone, Debug)]

Callers 3

list_devices_asyncFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 4

is_vendor_familiarFunction · 0.85
vendor_idMethod · 0.80
product_idMethod · 0.80
serial_numberMethod · 0.45

Tested by

no test coverage detected