Recognize "bmi260" as a valid IMU device name - #339
Open
Rival wants to merge 1 commit into
Open
Conversation
The out-of-tree bmi260 driver (hhd-dev/bmi260) names the IIO device
from the i2c_device_id table ("bmi260") whenever i2c_client_get_device_id()
resolves a match, instead of the ACPI-derived name (e.g. "i2c-BMI0160:00")
that IMU_NAMES currently expects. This makes find_sensor() fail to locate
the IMU, breaking gyro support even though the kernel driver and sysfs
values work fine.
Fixes gyro detection regressed by this on Aokzoe/handhelds using the
BMI260 chip misreported as BMI0160 in ACPI (see hhd-dev#296).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gyro stopped being detected on my Aokzoe handheld (same device as #296) after a kernel/driver update, even though the kernel-level IMU (BMI260) still works fine —
/sys/bus/iio/devices/iio:device0/in_anglvel_*_rawupdates correctly when moving the device.hhdfailed to find it, logging:Root cause
IMU_NAMESinimu.pyexpects the IIO device name to be the ACPI-derived string (e.g.i2c-BMI0160:00), which is whatfind_sensor()matches against.However, in the out-of-tree
bmi260driver (hhd-dev/bmi260),bmi260_i2c_probe()does:Whenever
i2c_client_get_device_id()resolves a non-NULLid(itsi2c_device_idtable only has one entry,{"bmi260", 0}), the IIO device gets named plainlybmi260instead of the ACPI name — regardless of which ACPI ID (BMI0160/BMI0260/etc.) actually matched. This appears to depend on kernel version/i2c core behavior, which is why the same setup worked before and regressed after an update.Since
"bmi260"isn't a substring of any of["bmi323-imu", "BMI0160", "BMI0260", "i2c-10EC5280:00", "i2c-BOSC0260:00"],find_sensor()returns nothing and gyro breaks — while the sensor itself is perfectly readable.Fix
Add
"bmi260"toIMU_NAMESsofind_sensor()matches it too. Minimal, additive change; verified working on hardware (gyro confirmed functional in Steam Input after the patch +hhdrestart).Related: #296 (same device, same underlying chip mismatch, different symptom of the same fragile name-matching).