summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2004-08-31 09:41:01 +0000
committerFrederic Lepied <flepied@mandriva.com>2004-08-31 09:41:01 +0000
commit16a299660bbda12b08755c2d3a8987ac5b6e8c02 (patch)
treeff1eec823113b1e0ef3285d30d0379a134f96d6a /perl-install/detect_devices.pm
parentf648b75813576a1d1811a7394666fe8ffe3b97cc (diff)
downloaddrakx-16a299660bbda12b08755c2d3a8987ac5b6e8c02.tar
drakx-16a299660bbda12b08755c2d3a8987ac5b6e8c02.tar.gz
drakx-16a299660bbda12b08755c2d3a8987ac5b6e8c02.tar.bz2
drakx-16a299660bbda12b08755c2d3a8987ac5b6e8c02.tar.xz
drakx-16a299660bbda12b08755c2d3a8987ac5b6e8c02.zip
simplify UPS detection and report the needed info for harddrake
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm24
1 files changed, 2 insertions, 22 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index bec2de7a4..8fcb0a122 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -536,29 +536,9 @@ sub getNet() {
# mapgrep(sub {member (($_[0] =~ /\s*(\w*):/), @netdevices), $1 }, split(/\n/, cat_("/proc/net/dev")));
#}
-# heavily inspirated from hidups driver from nut:
sub getUPS() {
- # nut/driver/hidups.h:
- my $UPS_USAGE = 0x840004;
- my $POWER_USAGE = 0x840020;
- my $hiddev_find_application = sub {
- my ($fd, $usage) = @_;
- my $i = 0;
- my $ret;
- do { $i++ } while ($ret = ioctl($fd, c::HIDIOCAPPLICATION(), $i)) && $ret != $usage;
- return $ret == $usage ? 1 : 0;
- };
-
- (map { $_->{driver} = "mge-shut"; $_ } grep { $_->{DESCRIPTION} =~ /MGE UPS/ } values %serialprobe),
- (map {
- open(my $f, $_);
- if_(!$hiddev_find_application->($f, $UPS_USAGE) && !$hiddev_find_application->($f, $POWER_USAGE),
- { port => $_,
- name => c::get_usb_ups_name(fileno($f)),
- driver => "hidups",
- }
- );
- } -e "/dev/.devfsd" ? glob("/dev/usb/hid/hiddev*") : glob("/dev/usb/hiddev*"));
+ (map { $_->{driver} = "mge-shut"; $_->{media_type} = 'UPS'; $_ } grep { $_->{DESCRIPTION} =~ /MGE UPS/ } values %serialprobe),
+ (map { ($_->{name} = $_->{description}) =~ s/.*\|//; $_->{port} = "/dev/"; $_->{media_type} = 'UPS'; $_} grep { $_->{driver} =~ /ups$/ } usb_probe());
}
$pcitable_addons = <<'EOF';