|
I have a very old ClearBOX 300 which I believe is Gen1. I just wanted to make note that the i2c bus assignments don't seem to be hardware related, but kernel related. For example, my bypass devices used to be on bus zero (0-0026, and 0-0022). But now, with kernel 2.6.32-431, they are on bus 6 but have the same IDs (6-0026, and 6-0022).
So would the logic be dynamically find these devices, in reversed order, such as:
# find /sys/devices/ -name 'bypass0' | sort -nr |
|
(0003141)
|
dloper
|
2016-04-29 12:41
|
|
[root@gateway etc]# diff eziod.conf eziod.conf.orig
307,322d306
< f = io.open("/sys/bus/i2c/devices/6-0026/bypass0")
< if f ~= nil then
< for line in f:lines() do
< _, _, bp1 = string.find(line, "^(%d+)")
< break
< end
< io.close(f)
< end
< f = io.open("/sys/bus/i2c/devices/6-0022/bypass0")
< if f ~= nil then
< for line in f:lines() do
< _, _, bp2 = string.find(line, "^(%d+)")
< break
< end
< io.close(f)
< end
330,342d313
< local bpfile1
< local bpfile2
< local q
< bpfile1 = "/sys/bus/i2c/devices/0-0026/bypass0"
< bpfile2 = "/sys/bus/i2c/devices/0-0026/bypass0"
< q = io.open("/sys/bus/i2c/devices/6-0026/bypass0","r")
< if q then bpfile1 = "/sys/bus/i2c/devices/6-0026/bypass0" end
< q = io.open("/sys/bus/i2c/devices/6-0022/bypass0","r")
< if q then bpfile2 = "/sys/bus/i2c/devices/6-0022/bypass0" end
< q = io.open("/sys/bus/i2c/devices/9-0026/bypass0","r")
< if q then bpfile1 = "/sys/bus/i2c/devices/9-0026/bypass0" end
< q = io.open("/sys/bus/i2c/devices/9-0022/bypass0","r")
< if q then bpfile2 = "/sys/bus/i2c/devices/9-0022/bypass0" end
344c315
< f = io.open(bpfile1, "w")
---
> f = io.open("/sys/bus/i2c/devices/0-0026/bypass0", "w")
346c317
< f = io.open(bpfile2, "w")
---
> f = io.open("/sys/bus/i2c/devices/0-0022/bypass0", "w") |
|