main: rename imu_off to no_imu (doesn't actually disable if enabled)

This commit is contained in:
John 2025-08-02 18:24:07 -04:00
parent 24539a95d2
commit da66b47231

View File

@ -36,14 +36,14 @@ struct Args {
dump: bool, dump: bool,
/// If set, doesn't init the IMU /// If set, doesn't init the IMU
imu_off: bool, no_imu: bool,
/// Dumps every N hid messages /// Dumps every N hid messages
hid: Option<usize>, hid: Option<usize>,
} }
fn main() -> Result<(), Box<dyn Error>> { fn main() -> Result<(), Box<dyn Error>> {
#[rustfmt::skip] #[rustfmt::skip]
let Args { verbose, dump, imu_off, hid } = Args::from_args(); let Args { verbose, dump, no_imu, hid } = Args::from_args();
let mut devices = vec![]; let mut devices = vec![];
@ -54,7 +54,7 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("Found player {}: {device:?}!", devices.len() + 1); println!("Found player {}: {device:?}!", devices.len() + 1);
let device = device.open()?; let device = device.open()?;
let controller = Controller::new(&device); let controller = Controller::new(&device);
controller.verbose(verbose).init(!imu_off)?; controller.verbose(verbose).init(!no_imu)?;
device.claim_interface(1)?; device.claim_interface(1)?;
devices.push(device); devices.push(device);
@ -148,6 +148,7 @@ fn make_path<Ctx: rusb::UsbContext>(device: &rusb::DeviceHandle<Ctx>) -> rusb::R
Ok(out_path) Ok(out_path)
} }
/// Reads all HID reports, dumping every_nth report.
fn hid_dump<Ctx: UsbContext>(device: Controller<Ctx>, every_nth: usize) -> rusb::Result<()> { fn hid_dump<Ctx: UsbContext>(device: Controller<Ctx>, every_nth: usize) -> rusb::Result<()> {
device.detach().ok(); // may or may not have a kernel driver device.detach().ok(); // may or may not have a kernel driver
let mut stdout = std::io::stdout().lock(); let mut stdout = std::io::stdout().lock();