Draft: i2c_smbus_linux: only inspect /sys/class/i2c-dev/
All i2c interface devices we might want can be found in /sys/class/i2c-dev, and indeed only those devices we want are found there. Enumerate that /sys entry instead of /sys/bus/i2c/devices, and we can toss this prefix comparison as well.
[schwarzgerat](0) $ ls /sys/class/i2c-dev/
i2c-0 i2c-1 i2c-2 i2c-3 i2c-4 i2c-5 i2c-6 i2c-7 i2c-8 i2c-9
[schwarzgerat](0) $ ls /sys/bus/i2c/devices/
0-0050 0-0052 0-0054 0-0056 2-0008 i2c-1 i2c-3 i2c-5 i2c-7 i2c-9
0-0051 0-0053 0-0055 0-0057 i2c-0 i2c-2 i2c-4 i2c-6 i2c-8
[schwarzgerat](0) $
Edited by nick black