Commit 6f3baa2
alex
Fix AMD GPU i2c bus PCI ID detection on Linux
On newer kernels with the amdgpu driver, i2c bus symlinks in
/sys/bus/i2c/devices/ resolve to paths like:
/sys/devices/pci.../0000:03:00.0/i2c-4
The previous code appended '/..' and relied on sysfs path traversal
to reach the parent PCI device directory. This is unreliable and
causes 'Failed to read i2c device PCI device ID' errors for all
AMDGPU i2c buses.
Fix: after resolving the symlink with realpath(), truncate at the
last '/' to directly obtain the parent PCI device directory path.
Also handle DT_UNKNOWN d_type which some kernels return for sysfs
symlink entries instead of DT_LNK.
This allows OpenRGB to correctly register AMDGPU i2c buses with
their proper vendor/device/subsystem PCI IDs, which is a prerequisite
for any GPU RGB controller detection on AMD hardware under Linux.
Tested on Linux Mint with ASRock Radeon RX 7700 XT (1002:747E,
subsystem 1849:5323) and kernel 6.x.1 parent 2eb5699 commit 6f3baa2
1 file changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
161 | 172 | | |
162 | 173 | | |
163 | 174 | | |
| |||
0 commit comments