There are cases where detection of an interface fails due to lack of permissions when accessing /dev/i2c-*. In some instances, the current code will perform a double readdir() and skip what should have been the next interface to be enumerated. E.g. consider a system with the following configuration $ ls -l /sys/bus/i2c/devices total 0 lrwxrwxrwx. 1 root 0 Sep 4 07:19 i2c-0 -> ../../../devices/platform/AMDI0010:03/i2c-0/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-1 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-1/ lrwxrwxrwx. 1 root 0 Sep 4 01:50 i2c-10 -> ../../../devices/pci0000:00/0000:00:14.0/i2c-10/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-2 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-2/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-3 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-3/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-4 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/i2c-4/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-5 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/drm/card1/card1-eDP-1/i2c-5/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-6 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/drm/card1/card1-DP-1/i2c-6/ lrwxrwxrwx. 1 root 0 Sep 4 01:49 i2c-7 -> ../../../devices/pci0000:00/0000:00:08.1/0000:03:00.0/drm/card1/card1-DP-2/i2c-7/ lrwxrwxrwx. 1 root 0 Sep 4 01:50 i2c-8 -> ../../../devices/pci0000:00/0000:00:14.0/i2c-8/ lrwxrwxrwx. 1 root 0 Sep 4 01:50 i2c-9 -> ../../../devices/pci0000:00/0000:00:14.0/i2c-9/ lrwxrwxrwx. 1 root 0 Sep 4 07:19 i2c-PNP0C50:0e -> ../../../devices/platform/AMDI0010:03/i2c-0/i2c-PNP0C50:0e/ $ openrgb --verbose --list-devices Before: ... Registering I2C interface: /dev/i2c-3 Device 1002:164C Subsystem: 1462:130C Registering I2C interface: /dev/i2c-10 Device 1022:790B Subsystem: 1462:130C Registering I2C interface: /dev/i2c-1 Device 1002:164C Subsystem: 1462:130C Registering I2C interface: /dev/i2c-8 Device 1022:790B Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-6 Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-4 Device 1002:164C Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-PNP0C50:0e Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-0 Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-9 Device 1022:790B Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-7 Device 0000:0000 Subsystem: 0000:0000 [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-5 Device 0000:0000 Subsystem: 0000:0000 ... After: ... Registering I2C interface: /dev/i2c-3 Device 1002:164C Subsystem: 1462:130C Registering I2C interface: /dev/i2c-10 Device 1022:790B Subsystem: 1462:130C Registering I2C interface: /dev/i2c-1 Device 1002:164C Subsystem: 1462:130C Registering I2C interface: /dev/i2c-8 Device 1022:790B Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-6 Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-4 Device 1002:164C Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-PNP0C50:0e Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-2 Device 1002:164C Subsystem: 1462:130C Registering I2C interface: /dev/i2c-0 Device 0000:0000 Subsystem: 0000:0000 Registering I2C interface: /dev/i2c-9 Device 1022:790B Subsystem: 1462:130C [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-7 Device 0000:0000 Subsystem: 0000:0000 [i2c_smbus_linux] Failed to read i2c device PCI device ID Registering I2C interface: /dev/i2c-5 Device 0000:0000 Subsystem: 0000:0000 ... Signed-off-by: Sandipan Das <sandipan.osd@gmail.com> |
||
|---|---|---|
| .. | ||
| i2c_smbus.cpp | ||
| i2c_smbus.h | ||
| i2c_smbus_amdadl.cpp | ||
| i2c_smbus_amdadl.h | ||
| i2c_smbus_i801.cpp | ||
| i2c_smbus_i801.h | ||
| i2c_smbus_linux.cpp | ||
| i2c_smbus_linux.h | ||
| i2c_smbus_nct6775.cpp | ||
| i2c_smbus_nct6775.h | ||
| i2c_smbus_nvapi.cpp | ||
| i2c_smbus_nvapi.h | ||
| i2c_smbus_piix4.cpp | ||
| i2c_smbus_piix4.h | ||