More debug printing

This commit is contained in:
Lennard Kittner
2025-09-24 17:55:18 +02:00
parent 97ef1d40ad
commit 7c26d9d192

View File

@@ -70,16 +70,23 @@ fn main() {
println!("{}", device.get_device_state()); println!("{}", device.get_device_state());
if let Some(delay) = matches.get_one::<u8>("automatic_shutdown") { if let Some(delay) = matches.get_one::<u8>("automatic_shutdown") {
println!("entering automatic_shutdown packet");
let delay = *delay as u64; let delay = *delay as u64;
if let Some(packet) = if let Some(packet) =
device.set_automatic_shut_down_packet(Duration::from_secs(delay * 60u64)) device.set_automatic_shut_down_packet(Duration::from_secs(delay * 60u64))
{ {
println!("sending automatic_shutdown packet");
if let Err(err) = device.get_device_state().hid_device.write(&packet) { if let Err(err) = device.get_device_state().hid_device.write(&packet) {
println!("Failed to set automatic shutdown with error: {:?}", err) println!("Failed to set automatic shutdown with error: {:?}", err)
} }
if let Some(events) = device.wait_for_updates(Duration::from_secs(1)) {
println!("{:?}", events);
}
} else { } else {
println!("Automatic shutdown can't be enabled on this device") println!("Automatic shutdown can't be enabled on this device")
} }
} else {
println!("not sending automatic_shutdown packet");
} }
if let Some(mute) = matches.get_one::<bool>("mute") { if let Some(mute) = matches.get_one::<bool>("mute") {
@@ -93,13 +100,21 @@ fn main() {
} }
if let Some(enable) = matches.get_one::<bool>("enable_side_tone") { if let Some(enable) = matches.get_one::<bool>("enable_side_tone") {
println!("entering enable_side_tone packet");
if let Some(packet) = device.set_side_tone_packet(*enable) { if let Some(packet) = device.set_side_tone_packet(*enable) {
println!("sending enable_side_tone packet");
if let Err(err) = device.get_device_state().hid_device.write(&packet) { if let Err(err) = device.get_device_state().hid_device.write(&packet) {
println!("Failed to enable side tone with error: {:?}", err) println!("Failed to enable side tone with error: {:?}", err)
} }
std::thread::sleep(Duration::from_millis(50));
if let Some(events) = device.wait_for_updates(Duration::from_secs(1)) {
println!("{:?}", events);
}
} else { } else {
println!("Can't enable side tone on this device") println!("Can't enable side tone on this device")
} }
} else {
println!("not sending enable_side_tone packet");
} }
if let Some(volume) = matches.get_one::<u8>("side_tone_volume") { if let Some(volume) = matches.get_one::<u8>("side_tone_volume") {