pub struct DeviceCapabilities { /* private fields */ }Expand description
Addressable controls and family counts exposed by one connected device.
Implementations§
Source§impl DeviceCapabilities
impl DeviceCapabilities
Sourcepub fn model(&self) -> DeviceModel
pub fn model(&self) -> DeviceModel
Detected hardware model.
Examples found in repository?
examples/usb_monitor.rs (line 45)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let path = env::args_os()
13 .nth(1)
14 .ok_or("usage: usb_monitor <path-to-hidraw>")?;
15 let file = OpenOptions::new().read(true).write(true).open(path)?;
16
17 // The device stays silent until a client requests its initial full sync.
18 (&file).write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
19
20 let mut session = ProtocolSession::new();
21 let mut buffered = Vec::new();
22 let mut report = [0_u8; usb::REPORT_SIZE];
23 loop {
24 let read = (&file).read(&mut report)?;
25 buffered.extend_from_slice(&report[..read]);
26
27 loop {
28 let len = match usb::scan_frame(&buffered) {
29 FrameScan::Complete { len } => len,
30 FrameScan::Incomplete => break,
31 FrameScan::Desync => {
32 buffered.drain(..usb::REPORT_SIZE.min(buffered.len()));
33 continue;
34 }
35 };
36 let (packet, consumed) = usb::Packet::from_bytes(&buffered[..len])
37 .ok_or("USB scanner returned an invalid packet")?;
38 buffered.drain(..consumed);
39
40 match session.ingest(&packet.payload)? {
41 SessionUpdate::Ready { initial_events } => {
42 let capabilities = session.capabilities().unwrap();
43 println!(
44 "connected: {} fw {} ({} faders, {} sources, {} mixes)",
45 capabilities.model(),
46 capabilities.firmware().unwrap_or("unknown"),
47 capabilities.faders().len(),
48 capabilities.sources().len(),
49 capabilities.mix_outputs().len(),
50 );
51 println!("initial state: {} typed events", initial_events.len());
52 }
53 SessionUpdate::Event(event) => println!("{event:?}"),
54 SessionUpdate::NeedsFullSync => {
55 eprintln!("layout changed, requesting a fresh full sync");
56 (&file)
57 .write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
58 }
59 }
60 }
61 }
62}Sourcepub fn firmware(&self) -> Option<&str>
pub fn firmware(&self) -> Option<&str>
Firmware version reported by the full sync, when present.
Examples found in repository?
examples/usb_monitor.rs (line 46)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let path = env::args_os()
13 .nth(1)
14 .ok_or("usage: usb_monitor <path-to-hidraw>")?;
15 let file = OpenOptions::new().read(true).write(true).open(path)?;
16
17 // The device stays silent until a client requests its initial full sync.
18 (&file).write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
19
20 let mut session = ProtocolSession::new();
21 let mut buffered = Vec::new();
22 let mut report = [0_u8; usb::REPORT_SIZE];
23 loop {
24 let read = (&file).read(&mut report)?;
25 buffered.extend_from_slice(&report[..read]);
26
27 loop {
28 let len = match usb::scan_frame(&buffered) {
29 FrameScan::Complete { len } => len,
30 FrameScan::Incomplete => break,
31 FrameScan::Desync => {
32 buffered.drain(..usb::REPORT_SIZE.min(buffered.len()));
33 continue;
34 }
35 };
36 let (packet, consumed) = usb::Packet::from_bytes(&buffered[..len])
37 .ok_or("USB scanner returned an invalid packet")?;
38 buffered.drain(..consumed);
39
40 match session.ingest(&packet.payload)? {
41 SessionUpdate::Ready { initial_events } => {
42 let capabilities = session.capabilities().unwrap();
43 println!(
44 "connected: {} fw {} ({} faders, {} sources, {} mixes)",
45 capabilities.model(),
46 capabilities.firmware().unwrap_or("unknown"),
47 capabilities.faders().len(),
48 capabilities.sources().len(),
49 capabilities.mix_outputs().len(),
50 );
51 println!("initial state: {} typed events", initial_events.len());
52 }
53 SessionUpdate::Event(event) => println!("{event:?}"),
54 SessionUpdate::NeedsFullSync => {
55 eprintln!("layout changed, requesting a fresh full sync");
56 (&file)
57 .write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
58 }
59 }
60 }
61 }
62}Sourcepub fn faders(&self) -> &[Fader]
pub fn faders(&self) -> &[Fader]
Addressable fader strips in protocol order.
Examples found in repository?
examples/usb_monitor.rs (line 47)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let path = env::args_os()
13 .nth(1)
14 .ok_or("usage: usb_monitor <path-to-hidraw>")?;
15 let file = OpenOptions::new().read(true).write(true).open(path)?;
16
17 // The device stays silent until a client requests its initial full sync.
18 (&file).write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
19
20 let mut session = ProtocolSession::new();
21 let mut buffered = Vec::new();
22 let mut report = [0_u8; usb::REPORT_SIZE];
23 loop {
24 let read = (&file).read(&mut report)?;
25 buffered.extend_from_slice(&report[..read]);
26
27 loop {
28 let len = match usb::scan_frame(&buffered) {
29 FrameScan::Complete { len } => len,
30 FrameScan::Incomplete => break,
31 FrameScan::Desync => {
32 buffered.drain(..usb::REPORT_SIZE.min(buffered.len()));
33 continue;
34 }
35 };
36 let (packet, consumed) = usb::Packet::from_bytes(&buffered[..len])
37 .ok_or("USB scanner returned an invalid packet")?;
38 buffered.drain(..consumed);
39
40 match session.ingest(&packet.payload)? {
41 SessionUpdate::Ready { initial_events } => {
42 let capabilities = session.capabilities().unwrap();
43 println!(
44 "connected: {} fw {} ({} faders, {} sources, {} mixes)",
45 capabilities.model(),
46 capabilities.firmware().unwrap_or("unknown"),
47 capabilities.faders().len(),
48 capabilities.sources().len(),
49 capabilities.mix_outputs().len(),
50 );
51 println!("initial state: {} typed events", initial_events.len());
52 }
53 SessionUpdate::Event(event) => println!("{event:?}"),
54 SessionUpdate::NeedsFullSync => {
55 eprintln!("layout changed, requesting a fresh full sync");
56 (&file)
57 .write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
58 }
59 }
60 }
61 }
62}Sourcepub fn sources(&self) -> &[Source]
pub fn sources(&self) -> &[Source]
Addressable input sources in protocol order.
Examples found in repository?
examples/usb_monitor.rs (line 48)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let path = env::args_os()
13 .nth(1)
14 .ok_or("usage: usb_monitor <path-to-hidraw>")?;
15 let file = OpenOptions::new().read(true).write(true).open(path)?;
16
17 // The device stays silent until a client requests its initial full sync.
18 (&file).write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
19
20 let mut session = ProtocolSession::new();
21 let mut buffered = Vec::new();
22 let mut report = [0_u8; usb::REPORT_SIZE];
23 loop {
24 let read = (&file).read(&mut report)?;
25 buffered.extend_from_slice(&report[..read]);
26
27 loop {
28 let len = match usb::scan_frame(&buffered) {
29 FrameScan::Complete { len } => len,
30 FrameScan::Incomplete => break,
31 FrameScan::Desync => {
32 buffered.drain(..usb::REPORT_SIZE.min(buffered.len()));
33 continue;
34 }
35 };
36 let (packet, consumed) = usb::Packet::from_bytes(&buffered[..len])
37 .ok_or("USB scanner returned an invalid packet")?;
38 buffered.drain(..consumed);
39
40 match session.ingest(&packet.payload)? {
41 SessionUpdate::Ready { initial_events } => {
42 let capabilities = session.capabilities().unwrap();
43 println!(
44 "connected: {} fw {} ({} faders, {} sources, {} mixes)",
45 capabilities.model(),
46 capabilities.firmware().unwrap_or("unknown"),
47 capabilities.faders().len(),
48 capabilities.sources().len(),
49 capabilities.mix_outputs().len(),
50 );
51 println!("initial state: {} typed events", initial_events.len());
52 }
53 SessionUpdate::Event(event) => println!("{event:?}"),
54 SessionUpdate::NeedsFullSync => {
55 eprintln!("layout changed, requesting a fresh full sync");
56 (&file)
57 .write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
58 }
59 }
60 }
61 }
62}Sourcepub fn mix_outputs(&self) -> &[MixOutput]
pub fn mix_outputs(&self) -> &[MixOutput]
Addressable mix outputs in protocol order.
Examples found in repository?
examples/usb_monitor.rs (line 49)
11fn main() -> Result<(), Box<dyn std::error::Error>> {
12 let path = env::args_os()
13 .nth(1)
14 .ok_or("usage: usb_monitor <path-to-hidraw>")?;
15 let file = OpenOptions::new().read(true).write(true).open(path)?;
16
17 // The device stays silent until a client requests its initial full sync.
18 (&file).write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
19
20 let mut session = ProtocolSession::new();
21 let mut buffered = Vec::new();
22 let mut report = [0_u8; usb::REPORT_SIZE];
23 loop {
24 let read = (&file).read(&mut report)?;
25 buffered.extend_from_slice(&report[..read]);
26
27 loop {
28 let len = match usb::scan_frame(&buffered) {
29 FrameScan::Complete { len } => len,
30 FrameScan::Incomplete => break,
31 FrameScan::Desync => {
32 buffered.drain(..usb::REPORT_SIZE.min(buffered.len()));
33 continue;
34 }
35 };
36 let (packet, consumed) = usb::Packet::from_bytes(&buffered[..len])
37 .ok_or("USB scanner returned an invalid packet")?;
38 buffered.drain(..consumed);
39
40 match session.ingest(&packet.payload)? {
41 SessionUpdate::Ready { initial_events } => {
42 let capabilities = session.capabilities().unwrap();
43 println!(
44 "connected: {} fw {} ({} faders, {} sources, {} mixes)",
45 capabilities.model(),
46 capabilities.firmware().unwrap_or("unknown"),
47 capabilities.faders().len(),
48 capabilities.sources().len(),
49 capabilities.mix_outputs().len(),
50 );
51 println!("initial state: {} typed events", initial_events.len());
52 }
53 SessionUpdate::Event(event) => println!("{event:?}"),
54 SessionUpdate::NeedsFullSync => {
55 eprintln!("layout changed, requesting a fresh full sync");
56 (&file)
57 .write_all(&usb::Packet::new(usb::HANDSHAKE_BODY.to_vec()).to_bytes())?;
58 }
59 }
60 }
61 }
62}Sourcepub fn supports_fader(&self, fader: Fader) -> bool
pub fn supports_fader(&self, fader: Fader) -> bool
Whether this exact device topology contains the named fader.
pub fn channel_count(&self) -> u8
pub fn input_source_count(&self) -> u8
pub fn headphone_count(&self) -> u8
Sourcepub fn physical_combo_count(&self) -> u8
pub fn physical_combo_count(&self) -> u8
Physical analog combo XLR preamp jack count on the physical device: 2 on Duo, 4 on Pro II.
Sourcepub fn physical_headphone_count(&self) -> u8
pub fn physical_headphone_count(&self) -> u8
Physical headphone output jack count on the physical device: 2 on Duo, 4 on Pro II.
pub fn effects_count(&self) -> u8
pub fn pad_count(&self) -> u8
pub fn sip_call_slots_count(&self) -> u8
pub fn sip_registration_count(&self) -> u8
Sourcepub fn is_in_setup(&self) -> bool
pub fn is_in_setup(&self) -> bool
Whether the device is currently in initial setup mode (outputs or controls disabled).
Trait Implementations§
Source§impl Clone for DeviceCapabilities
impl Clone for DeviceCapabilities
Source§impl Debug for DeviceCapabilities
impl Debug for DeviceCapabilities
impl Eq for DeviceCapabilities
Source§impl PartialEq for DeviceCapabilities
impl PartialEq for DeviceCapabilities
impl StructuralPartialEq for DeviceCapabilities
Auto Trait Implementations§
impl Freeze for DeviceCapabilities
impl RefUnwindSafe for DeviceCapabilities
impl Send for DeviceCapabilities
impl Sync for DeviceCapabilities
impl Unpin for DeviceCapabilities
impl UnsafeUnpin for DeviceCapabilities
impl UnwindSafe for DeviceCapabilities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more