summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-12-16 18:25:37 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-12-16 18:25:37 +0000
commitc3822da244887ef19b2ef7bba5812d18bc6ea8db (patch)
tree4e5d35b87f2a0bacc83a8a76fea755305c7b817e /perl-install/detect_devices.pm
parent3bf40616e233d127ecc0c1f90edd740d23a361ca (diff)
downloaddrakx-c3822da244887ef19b2ef7bba5812d18bc6ea8db.tar
drakx-c3822da244887ef19b2ef7bba5812d18bc6ea8db.tar.gz
drakx-c3822da244887ef19b2ef7bba5812d18bc6ea8db.tar.bz2
drakx-c3822da244887ef19b2ef7bba5812d18bc6ea8db.tar.xz
drakx-c3822da244887ef19b2ef7bba5812d18bc6ea8db.zip
use ldetect-lst for usb => now auto detects mice types :)
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm22
1 files changed, 7 insertions, 15 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 802110185..438cf301b 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -185,9 +185,11 @@ sub pci_probe {
}
sub usb_probe {
+ -e "/proc/bus/usb/devices" or return ();
+
map {
my %l;
- @l{qw(vendor id driver description)} = split "\t";
+ @l{qw(vendor id type driver description)} = split "\t";
$l{$_} = hex $l{$_} foreach qw(vendor id);
$l{bus} = 'USB';
\%l
@@ -233,20 +235,6 @@ sub syslog {
`dmesg`;
}
-sub hasUsb {
- my ($class, $prot) = @_;
- foreach (cat_("/proc/bus/usb/devices")) {
- if (/^P/ .. /^I/) {
- my ($c, $p) = /Cls=(\d+).*Prot=(\d+)/;
- $c == $class && ($prot < 0 || $prot == $p) and log::l("found usb $c $p"), return 1;
- }
- }
- 0;
-}
-sub hasUsbKeyboard { hasUsb(3, 1) }
-sub hasUsbMouse { hasUsb(3, 2) }
-sub hasUsbZip { hasUsb(8, -1) }
-
sub hasSMP { c::detectSMP() }
sub hasUltra66 {
@@ -277,6 +265,10 @@ sub whatParport() {
@res;
}
+sub usbMice { grep { $_->{type} =~ /\|Mouse/ } usb_probe() }
+sub usbKeyboards { grep { $_->{type} =~ /\|Keyboard/ } usb_probe() }
+sub usbZips { grep { $_->{type} =~ /Mass Storage\|/ } usb_probe() }
+
sub whatUsbport() {
my ($i, $elem, @res) = (0, {});
local *F; open F, "/proc/bus/usb/devices" or return;