summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-10-31 13:13:48 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-10-31 13:13:48 +0000
commit1a660ead347955fd33cf22178ed475e1ffe8e080 (patch)
tree530f5ccd1166e2946914bd00eeafb30eb675b8a5
parent3f747ebc412e2aae4f9739cea2461f978f7a3e32 (diff)
downloaddrakx-1a660ead347955fd33cf22178ed475e1ffe8e080.tar
drakx-1a660ead347955fd33cf22178ed475e1ffe8e080.tar.gz
drakx-1a660ead347955fd33cf22178ed475e1ffe8e080.tar.bz2
drakx-1a660ead347955fd33cf22178ed475e1ffe8e080.tar.xz
drakx-1a660ead347955fd33cf22178ed475e1ffe8e080.zip
- for now, check new devices against description (later with port too)
- fix driver/port mismatch
-rwxr-xr-xperl-install/standalone/drakups18
1 files changed, 9 insertions, 9 deletions
diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups
index 3ae1bb2bd..bb65aae02 100755
--- a/perl-install/standalone/drakups
+++ b/perl-install/standalone/drakups
@@ -49,17 +49,17 @@ sub update_all_gnomekderc {
my $file = "/etc/ups/ups.conf";
my ($sections, $sec_contents) = read_all_gnomekderc($file);
-my @ups_devices = map { $_->[0] } @$sections; #sort values %$sec_contents
+my @ups_devices = sort values %$sec_contents;
foreach my $ups_device (detect_devices::getUPS()) {
- if (!member($ups_device, @ups_devices)) {
- my $str = $ups_device->{description};
- $str =~ s/ /_/g;
- push @$sections, [ $str, [ qw(driver port) ] ];
- $sec_contents->{$str} = {
- port => 1,
- driver => $ups_device->{bus} eq 'USB' ? "/dev/usb/hid/hiddev0" : $ups_device->{device},
- };
+ my $str = $ups_device->{description};
+ if (!find { $str eq $_->{port} } @ups_devices) {
+ $str =~ s/ /_/g;
+ push @$sections, [ $str, [ qw(driver port) ] ];
+ $sec_contents->{$str} = {
+ port => $ups_device->{bus} eq 'USB' ? "/dev/usb/hid/hiddev0" : $ups_device->{device},
+ driver => $ups_device->{bus} eq 'USB' ? "hidups" : "",
+ };
}
}