Hi Jerry,
Am 05.08.2025 um 10:53 schrieb Jerry Lv Jerry.Lv@axis.com:
But there is no similar check in the bq27xxx_battery_hdq_read() for the HDQ/1-wire driver. Could we do the same check in the bq27xxx_battery_hdq_read(), instead of changing the cache.flags manually when the last byte in the returned data is 0xFF? Or could we just force to set the returned value to "-ENODEV" only when the last byte get from bq27xxx_battery_hdq_read() is 0xFF?
I tried to move the 0xff detection to bq27xxx_battery_hdq_read() and make it trigger only for register 0x0a (BQ27XXX_REG_FLAGS), but there are other locations where bq27xxx_read() is called for this register. And those emit error messages in case the battery is removed while user-space is polling.
So I'll post a v2 with two patches (for different bugs): a) set cache.flags to -ENODEV to fix the -EPERM bug b) restrict the check for the 0xff condition to the bq27000 to avoid false positives for your bq27z561
BR and thanks, Nikolaus