summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-06-04 21:52:41 +0000
committerOlivier Blin <oblin@mandriva.com>2007-06-04 21:52:41 +0000
commita2a0de06472985d652ac73d2472f99b1e8e91b52 (patch)
tree54ff3b309a47a4cd1443f96f0cc7e5ab58cf8639 /perl-install
parent18c2135a665e9e5b5d8f6d9f3d7abfa9e3bad12f (diff)
downloaddrakx-backup-do-not-use-a2a0de06472985d652ac73d2472f99b1e8e91b52.tar
drakx-backup-do-not-use-a2a0de06472985d652ac73d2472f99b1e8e91b52.tar.gz
drakx-backup-do-not-use-a2a0de06472985d652ac73d2472f99b1e8e91b52.tar.bz2
drakx-backup-do-not-use-a2a0de06472985d652ac73d2472f99b1e8e91b52.tar.xz
drakx-backup-do-not-use-a2a0de06472985d652ac73d2472f99b1e8e91b52.zip
fix USB UPS detection logic (whitelist supported hardware)
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm28
1 files changed, 18 insertions, 10 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 9510f9a1e..d35ffd495 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -684,8 +684,6 @@ sub device_matches_sysfs_device {
#}
sub getUPS() {
- my @usb_devices = map { ($_->{name} = $_->{description}) =~ s/.*\|//; $_ } grep { $_->{description} !~ /GamePad|IR Combo Device|Joystick|SideWinder/ } usb_probe();
-
# MGE serial PnP devices:
(map {
$_->{port} = $_->{DEVICE};
@@ -696,14 +694,24 @@ sub getUPS() {
$_->{description} = "MGE UPS SYSTEMS|UPS - Uninterruptible Power Supply" if $_->{MODEL} =~ /000[12]/;
$_;
} grep { $_->{DESCRIPTION} =~ /MGE UPS/ } values %serialprobe),
- # USB UPSs;
- (map { $_->{driver} = 'hidups'; $_ } grep { $_->{driver} eq 'usbhid' && $_->{description} =~ /American Power Conversion\|Back-UPS/ } @usb_devices),
- (map {
- $_->{port} = "auto";
- $_->{media_type} = 'UPS';
- $_->{driver} = 'newhidups';
- $_;
- } grep { $_->{driver} =~ /ups$/ && $_->{description} !~ /American Power Conversion\|Back-UPS|Chicony|Keyboard|Logitech|Mouse|SAITEK|WingMan/ } @usb_devices);
+ # USB UPSs;
+ (map { ($_->{name} = $_->{description}) =~ s/.*\|//; $_ }
+ map {
+ if ($_->{description} =~ /^American Power Conversion\|Back-UPS/ && $_->{driver} eq 'usbhid') {
+ #- FIXME: should not be hardcoded, use $_->{sysfs_device} . */usb:(hiddev\d+)
+ #- the device should also be assigned to the ups user
+ $_->{port} = "/dev/hiddev0";
+ $_->{driver} = 'hidups';
+ $_;
+ } elsif ($_->{description} =~ /^MGE UPS Systems\|/ && $_->{driver} =~ /ups$/) {
+ $_->{port} = "auto";
+ $_->{media_type} = 'UPS';
+ $_->{driver} = 'newhidups';
+ $_;
+ } else {
+ ();
+ }
+ } usb_probe());
}
$pcitable_addons = <<'EOF';