From 963ca0992c849da94be045180bbfb42be92f1029 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Nov 2008 15:16:45 +0000 Subject: [PATCH] Fix device->driver lookup name. What we are really interested in is the name of the kernel module, not the name of the driver. This went unnoticed so far because almost all hwmon drivers have a driver name equal to the module name. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5404 7894878c-1315-0410-8ee3-d5d059ff63e0 --- prog/detect/sensors-detect | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index efb17bbb..6e5c4347 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -2399,12 +2399,12 @@ sub initialize_modules_supported # SYSFS HELPERS # ################# -# From a sysfs device path, return the driver name, or undef +# From a sysfs device path, return the driver (module) name, or undef sub sysfs_device_driver($) { my $device = shift; - my $link = readlink("$device/driver"); + my $link = readlink("$device/driver/module"); return unless defined $link; return basename($link); } @@ -3074,7 +3074,8 @@ sub scan_adapter if (!i2c_set_slave_addr(\*FILE, $addr)) { # If the address is busy, we can normally find out which driver - # is using it, and we assume it is the right one. + # requested it (if the kernel is recent enough, at least 2.6.16 + # and later are known to work), and we assume it is the right one. my ($device, $driver); $device = sprintf("$sysfs_root/bus/i2c/devices/\%d-\%04x",