From 57e3c6a28e5e177cc5533949e7a6fdc2de1d3116 Mon Sep 17 00:00:00 2001 From: Frodo Looijaard Date: Wed, 24 Feb 1999 01:33:18 +0000 Subject: [PATCH] smbus_access fix in isa detection routines. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@272 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/detect.pl | 21 +++++++++++---------- prog/detect/sensors-detect | 21 +++++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/prog/detect/detect.pl b/prog/detect/detect.pl index 7b6b694f..d7a3241e 100755 --- a/prog/detect/detect.pl +++ b/prog/detect/detect.pl @@ -795,10 +795,10 @@ sub add_isa_to_chips_detected not exists $new_misdetected_ref->[$j]->{isa_addr} and defined $alias_detect and $new_misdetected_ref->[$j]->{chip_type} eq $datahash->{chip_type}) { - my $file = open FILE,"/dev/i2c-$new_misdetected_ref->[$j]->{devnr}" or - print("Can't open ", - "/dev/i2c-$new_misdetected_ref->[$j]->{devnr}?!?\n"), - next; + open FILE,"/dev/i2c-$new_misdetected_ref->[$j]->{devnr}" or + print("Can't open ", + "/dev/i2c-$new_misdetected_ref->[$j]->{devnr}?!?\n"), + next; if (&$alias_detect ($datahash->{isa_addr},\*FILE, $new_misdetected_ref->[$j]->{address})) { $new_misdetected_ref->[$j] = { %$new_misdetected_ref->[$j], @@ -813,16 +813,17 @@ sub add_isa_to_chips_detected if (exists $new_detected_ref->[$j]->{address} and not exists $new_detected_ref->[$j]->{isa_addr} and $new_detected_ref->[$j]->{chip_type} eq $datahash->{chip_type}) { - my $file = open FILE,"/dev/i2c-$new_detected_ref->[$j]->{devnr}" or - print("Can't open ", - "/dev/i2c-$new_detected_ref->[$j]->{devnr}?!?\n"), - next; + open FILE,"/dev/i2c-$new_detected_ref->[$j]->{devnr}" or + print("Can't open ", + "/dev/i2c-$new_detected_ref->[$j]->{devnr}?!?\n"), + next; if (&$alias_detect ($datahash->{isa_addr},\*FILE, $new_detected_ref->[$j]->{address})) { $new_detected_ref->[$j]->{isa_addr} = $datahash->{isa_addr}; ($datahash) = splice (@$new_detected_ref, $j, 1); last; } + close FILE; } } @@ -1013,7 +1014,7 @@ sub lm78_alias_detect my $readproc = sub { isa_read_byte $isa_addr + 5, $isa_addr + 6, @_ }; return 0 unless &$readproc(0x48) == $i2c_addr; for ($i = 0x2b; $i <= 0x3d; $i ++) { - return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($i); + return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($file,$i); } return 1; } @@ -1115,7 +1116,7 @@ sub w83781d_alias_detect my $readproc = sub { isa_read_byte $isa_addr + 5, $isa_addr + 6, @_ }; return 0 unless &$readproc(0x48) == $i2c_addr; for ($i = 0x2b; $i <= 0x3d; $i ++) { - return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($i); + return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($file,$i); } return 1; } diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 7b6b694f..d7a3241e 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -795,10 +795,10 @@ sub add_isa_to_chips_detected not exists $new_misdetected_ref->[$j]->{isa_addr} and defined $alias_detect and $new_misdetected_ref->[$j]->{chip_type} eq $datahash->{chip_type}) { - my $file = open FILE,"/dev/i2c-$new_misdetected_ref->[$j]->{devnr}" or - print("Can't open ", - "/dev/i2c-$new_misdetected_ref->[$j]->{devnr}?!?\n"), - next; + open FILE,"/dev/i2c-$new_misdetected_ref->[$j]->{devnr}" or + print("Can't open ", + "/dev/i2c-$new_misdetected_ref->[$j]->{devnr}?!?\n"), + next; if (&$alias_detect ($datahash->{isa_addr},\*FILE, $new_misdetected_ref->[$j]->{address})) { $new_misdetected_ref->[$j] = { %$new_misdetected_ref->[$j], @@ -813,16 +813,17 @@ sub add_isa_to_chips_detected if (exists $new_detected_ref->[$j]->{address} and not exists $new_detected_ref->[$j]->{isa_addr} and $new_detected_ref->[$j]->{chip_type} eq $datahash->{chip_type}) { - my $file = open FILE,"/dev/i2c-$new_detected_ref->[$j]->{devnr}" or - print("Can't open ", - "/dev/i2c-$new_detected_ref->[$j]->{devnr}?!?\n"), - next; + open FILE,"/dev/i2c-$new_detected_ref->[$j]->{devnr}" or + print("Can't open ", + "/dev/i2c-$new_detected_ref->[$j]->{devnr}?!?\n"), + next; if (&$alias_detect ($datahash->{isa_addr},\*FILE, $new_detected_ref->[$j]->{address})) { $new_detected_ref->[$j]->{isa_addr} = $datahash->{isa_addr}; ($datahash) = splice (@$new_detected_ref, $j, 1); last; } + close FILE; } } @@ -1013,7 +1014,7 @@ sub lm78_alias_detect my $readproc = sub { isa_read_byte $isa_addr + 5, $isa_addr + 6, @_ }; return 0 unless &$readproc(0x48) == $i2c_addr; for ($i = 0x2b; $i <= 0x3d; $i ++) { - return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($i); + return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($file,$i); } return 1; } @@ -1115,7 +1116,7 @@ sub w83781d_alias_detect my $readproc = sub { isa_read_byte $isa_addr + 5, $isa_addr + 6, @_ }; return 0 unless &$readproc(0x48) == $i2c_addr; for ($i = 0x2b; $i <= 0x3d; $i ++) { - return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($i); + return 0 unless &$readproc($i) == i2c_smbus_read_byte_data($file,$i); } return 1; }