Commit graph

24 commits

Author SHA1 Message Date
Stephen Horvath
2c4b159901 Fix SPDDetector only scanning bus 0 on Linux 2025-04-21 14:42:22 -05:00
RedBlackAka
c57d58d49b Miscellaneous cleanups 2025-02-17 15:46:33 +00:00
Adam Honse
b12cd438cd Update more file header comments to standardized new format 2024-05-03 00:39:21 -05:00
Sandipan Das
a934c4c034 i2c-smbus: linux: Remove stray whitespaces
Remove stray whitespaces in newlines.

Signed-off-by: Sandipan Das <sandipan.osd@gmail.com>
2023-09-12 08:43:28 -05:00
Sandipan Das
49a6905ab5 i2c-smbus: linux: Fix interface detection
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>
2023-09-12 08:43:28 -05:00
Adam Honse
3219dbfdc4 Fix read() warnings 2022-09-25 19:39:22 -05:00
nick black
99cd322721
i2c_smbus_linux: closedir() on error path 2022-09-03 03:08:33 -04:00
1000001101000
0bbc63aaf5 fix ptr/address of ptr confusion? 2022-01-27 19:19:36 +00:00
Érico Rolim
48d1a4f7b6 Don't use glibc specific function. 2022-01-02 20:01:01 +00:00
Adam Honse
341607ec3e Free allocated buffer in Linux pure i2c block transfer function 2021-12-29 03:48:19 -06:00
Adam Honse
46d8ca718e Fix pure i2c block read in Linux 2021-12-29 03:45:12 -06:00
1000001101000
e36b52136c Add functions to i2c_smbus for pure i2c block transactions
Commit amended to rework API and change for code style by Adam Honse <calcprogrammer1@gmail.com>
2021-11-24 15:42:54 -06:00
Thomas Rohloff
92dda2f390 Fix i2c detection on Linux.
Signed-off-by: Thomas Rohloff <v10lator@myway.de>
2021-11-17 20:45:16 -06:00
Adam Honse
c74a9849c0 Properly detect I2C initialization fail on Linux and fix dialog always being displayed even when I2C initialization was successful 2021-11-07 14:14:24 -06:00
Adam Honse
de4231f3ea Show dialog if any common I2C/SMBus initialization errors occur 2021-11-07 13:53:48 -06:00
Adam Honse
5616f547e4 Fix a bunch of warnings 2021-04-29 13:42:49 -05:00
Adam Honse
69cb7a0d9e Use resource manager to register I2C interfaces and log them 2021-03-24 01:22:48 -05:00
Shawn
86034a9ce5 Clear port_ID just like the remaining items that are updated each loop.
Re-add code to make NVIDIA cards work with the updated device manager.

Commit amended by Adam Honse <calcprogrammer1@gmail.com>
2020-10-01 19:47:58 +00:00
Adam Honse
b31a37e860 Make sure PCI ID variables are cleared before each bus initialization and don't break out of bus detection when PCI ID is zero 2020-09-14 20:12:31 -05:00
Adam Honse
973dce9d80 Fill in PCI information for all i2c interfaces on Linux 2020-09-12 03:06:00 -05:00
Adam Honse
0345eb582b More warning fixes 2020-09-02 19:03:43 -05:00
Térence Clastres
53379c5482 Fixes for memory issues detected by valgrind 2020-08-12 23:48:03 -05:00
Adam Honse
aaa2ecddc7 Move i2c bus detectors to their respective files and add a detector macro for i2c busses so they can be detected asynchronously. Fix WMI and DMI info. 2020-08-07 14:01:59 -05:00
Adam Honse
155ad165b1 Reorganization! Move all controllers into their own folders, move all RGBController wrappers into one folder, move i2c_smbus and serial_port dependencies into folders, and move main application/UI stuff into folders. Should help lead into creating a proper library 2019-08-22 18:43:17 -05:00
Renamed from OpenAuraSDK/i2c_smbus_linux.cpp (Browse further)