Commit 452f2e7
committed
Buffer for SPI bus sysfs path too small
@kozga advised in issue #94 of a bug in
get_spi_bus_path_number()
> In version 1.0 declared path length is too low (50 bytes)
> But for kernels 4.1 path length is 54 bytes.
> In result, path is shortened to
> '/sys/devices/platform/ocp/48030000.spi/spi_master/'
> and function always return 1,
> even if you try to open /dev/spidev2.x.
These are the sysfs paths for the SPI bus 1 and 2
for Debian 8.6 with Linux 4.4.21-bone13 kernel:
/sys/devices/platform/ocp/48030000.spi/spi_master/spi1/
/sys/devices/platform/ocp/481a0000.spi/spi_master/spi2/
I have fixed by increasing the size of path to MAX_PATH.
MAX_PATH is defined as 256. This should provide enough
extra margin for any future kernel changes in sysfs paths.1 parent 12b79d7 commit 452f2e7
2 files changed
+3
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | | - | |
| 95 | + | |
0 commit comments