ShadowBlip / InputPlumber

Open source input router and remapper daemon for Linux
GNU General Public License v3.0
73 stars 11 forks source link

Bug: IIO IMU errors out when undocking device. #102

Open pastaq opened 4 months ago

pastaq commented 4 months ago

When un-docking the AYANEO 2S I noticed this error pop up.

[2024-05-20T02:09:44Z ERROR inputplumber::input::source::iio::iio_imu] Error running IIO Driver: Nix(ETIMEDOUT)
[2024-05-20T02:09:44Z ERROR inputplumber::input::composite_device] Failed running iio device: "ETIMEDOUT: Connection timed out"
[2024-05-20T02:09:44Z DEBUG inputplumber::input::composite_device] IIO device closed
[2024-05-20T02:09:44Z DEBUG inputplumber::input::composite_device] Detected source device stopped: iio://iio:device0
[2024-05-20T02:09:44Z DEBUG inputplumber::input::composite_device] Current source device paths: ["/dev/input/event2", "/dev/input/event5", "/sys/bus/iio/devices/iio:device0"]
[2024-05-20T02:09:44Z DEBUG inputplumber::input::composite_device] Current source devices used: ["evdev://event2", "evdev://event5", "iio://iio:device0"]

This could possibly affect other devices. I will test more devices to find out. The AYANEO 2S has a BMI260 IMU that uses a BMI160 ACPI ID.

When an IIO device is removed we should remove it from the list of devices we have checked in our discovery loop so it can be rediscovered.

pastaq commented 4 months ago

This bug also occurs if you adjust the scale or sample frequency of the IMU as noted in the testing for #115 and is looking more like an issue with the hardware implementation on that specific motherboard. Affected models so far: AYANEO 2, 2S, Geek, Geek 1S

pastaq commented 2 months ago

udev events are not triggered when the device is undocked. We should find a way to use udev-rs to verify if the gyro has actually been removed, and if not, attempt to reopen the channel for some maximum number of attempts before killing the source device.