diff mbox series

[v2,3/3] decode-vaio: Scan more i2c buses

Message ID 20200831100919.519f66a6@endymion
State New
Headers show
Series [v2,1/3] There are several eeprom drivers | expand

Commit Message

Jean Delvare Aug. 31, 2020, 8:09 a.m. UTC
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.

Comments

Wolfram Sang Aug. 31, 2020, 9:48 a.m. UTC | #1
> -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>
Jean Delvare Aug. 31, 2020, 1:04 p.m. UTC | #2
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.
diff mbox series

Patch

--- 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")
 	{