Message ID | 20200831100919.519f66a6@endymion |
---|---|
State | New |
Headers | show |
Series | [v2,1/3] There are several eeprom drivers | expand |
> -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) > +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) To get rid of the problem entirely, can't we do something like this with shell globs? Pseudo code: foreach (/sys/bus/i2c/devices/*-0057/eeprom) $found += <found device> if (!$found) foreach (/proc/sys/dev/sensors/eeprom-i2c-*-57) check_old_interface $found += <found device>
On Mon, 31 Aug 2020 11:48:55 +0200, Wolfram Sang wrote: > > -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) > > +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) > > To get rid of the problem entirely, can't we do something like this > with shell globs? Pseudo code: > > foreach (/sys/bus/i2c/devices/*-0057/eeprom) > $found += <found device> > > if (!$found) > foreach (/proc/sys/dev/sensors/eeprom-i2c-*-57) > check_old_interface > $found += <found device> You have hit my perl knowledge limits ;-) I know that arbitrary limits are bad, but the thing is, I'm not sure if there is any actual user left for that script. I adjusted it for the at24 driver because *if* there are users left then things should keep working. But I wrote all this in 2001, laptops from then are definitely no longer in use, and at this point I have no idea if recent VAIO laptops still have this EEPROM. So until someone comes to me with a recent VAIO laptop that needs this, I am reluctant to invest more time into this.
--- i2c-tools.orig/eeprom/decode-vaio 2020-08-31 09:50:38.961927999 +0200 +++ i2c-tools/eeprom/decode-vaio 2020-08-31 09:51:02.085179645 +0200 @@ -237,7 +237,7 @@ END print("\n"); } -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) { if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") {
While the laptop I originally developed decode-vaio on, only had 5 i2c buses, there could be more on other models, and there are definitely more on the system I use to test the script (using i2c-stub) these days. So look for the VAIO EEPROM on up to 32 i2c buses to be on the safe side. Signed-off-by: Jean Delvare <jdelvare@suse.de> --- eeprom/decode-vaio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Changes since v1: New.