2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-05 08:45:26 +00:00

All tools now understand both /dev/i2c-* and /dev/i2c*

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@827 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Frodo Looijaard
2000-07-02 18:11:31 +00:00
parent e72953e4fc
commit 93f3a9f7ac
3 changed files with 42 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
#
# sensors-detect - Detect PCI bus and chips
@@ -1117,12 +1117,13 @@ sub add_isa_to_chips_detected
defined $alias_detect and
$new_misdetected_ref->[$i]->{chipname} eq $datahash->{chipname}) {
open FILE,"/dev/i2c-$new_misdetected_ref->[$i]->{i2c_devnr}" or
open FILE,"/dev/i2c$new_misdetected_ref->[$i]->{i2c_devnr}" or
print("Can't open ",
"/dev/i2c-$new_misdetected_ref->[$i]->{i2c_devnr}?!?\n"),
"/dev/i2c[-]$new_misdetected_ref->[$i]->{i2c_devnr}?!?\n"),
next;
i2c_set_slave_addr \*FILE,$new_misdetected_ref->[$i]->{i2c_addr} or
print("Can't set I2C address for ",
"/dev/i2c-$new_misdetected_ref->[$i]->{i2c_devnr}?!?\n"),
"/dev/i2c[-]$new_misdetected_ref->[$i]->{i2c_devnr}?!?\n"),
next;
if (&$alias_detect ($datahash->{isa_addr},\*FILE,
$new_misdetected_ref->[$i]->{i2c_addr})) {
@@ -1143,12 +1144,13 @@ sub add_isa_to_chips_detected
defined $alias_detect and
$new_detected_ref->[$i]->{chipname} eq $datahash->{chipname}) {
open FILE,"/dev/i2c-$new_detected_ref->[$i]->{i2c_devnr}" or
open FILE,"/dev/i2c$new_detected_ref->[$i]->{i2c_devnr}" or
print("Can't open ",
"/dev/i2c-$new_detected_ref->[$i]->{i2c_devnr}?!?\n"),
"/dev/i2c[-]$new_detected_ref->[$i]->{i2c_devnr}?!?\n"),
next;
i2c_set_slave_addr \*FILE,$new_detected_ref->[$i]->{i2c_addr} or
print("Can't set I2C address for ",
"/dev/i2c-$new_detected_ref->[$i]->{i2c_devnr}?!?\n"),
"/dev/i2c[-]$new_detected_ref->[$i]->{i2c_devnr}?!?\n"),
next;
if (&$alias_detect ($datahash->{isa_addr},\*FILE,
$new_detected_ref->[$i]->{i2c_addr})) {
@@ -1213,7 +1215,8 @@ sub scan_adapter
my @not_to_scan = @$not_to_scan;
open FILE,"/dev/i2c-$adapter_nr" or
(print "Can't open /dev/i2c-$adapter_nr ($!)\n"), return;
open FILE,"/dev/i2c$adapter_nr" or
(print "Can't open /dev/i2c[-]$adapter_nr ($!)\n"), return;
# Now scan each address in turn
foreach $addr (0..0x7f) {
@@ -2024,7 +2027,7 @@ sub main
"Read\n",
" doc/modules for more information.\n";
print " Also, you need to be `root', or at least have access to the ",
"/dev/i2c-* files\n",
"/dev/i2c[-]* files\n",
" for some things. You can use prog/mkdev/mkdev.sh to create these ",
"/dev files\n",
" if you do not have them already.\n";
@@ -2097,7 +2100,7 @@ sub main
"you edited\n",
" `/etc/conf.modules' (or `/etc/modules.conf') for automatic ",
"loading of\n",
" this module. If not, you won't be able to open any /dev/i2c-* ",
" this module. If not, you won't be able to open any /dev/i2c[-]* ",
"file.\n";
} else {
print " i2c-dev is not loaded. Do you want to load it now? (YES/no): ";
@@ -2106,7 +2109,7 @@ sub main
"`/etc/conf.modules'\n",
" (or `/etc/modules.conf') for automatic loading of this ",
"module. If not,\n",
" you won't be able to open any /dev/i2c-* file (unless you",
" you won't be able to open any /dev/i2c[-]* file (unless you",
"have it built-in\n",
" into your kernel)\n";
} elsif (system "modprobe","i2c-dev") {