summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-02-24 17:10:54 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-02-24 17:10:54 +0000
commit4ae35537d7361c603756b81ccce5c4ac5072f73e (patch)
treeb7b395e417ba97587deff2a7e7af395194ed0ab5
parent37d2a12be69c57b02050b6a78169215ce6b544c1 (diff)
downloaddrakx-4ae35537d7361c603756b81ccce5c4ac5072f73e.tar
drakx-4ae35537d7361c603756b81ccce5c4ac5072f73e.tar.gz
drakx-4ae35537d7361c603756b81ccce5c4ac5072f73e.tar.bz2
drakx-4ae35537d7361c603756b81ccce5c4ac5072f73e.tar.xz
drakx-4ae35537d7361c603756b81ccce5c4ac5072f73e.zip
fix reading UPS db: some UPS have the same name but differes in the
way they're plugged into the system (eg: USB vs serial cable), so we need to differ them through the "extra" field
-rwxr-xr-xperl-install/standalone/drakups8
1 files changed, 4 insertions, 4 deletions
diff --git a/perl-install/standalone/drakups b/perl-install/standalone/drakups
index 26126bc85..dbfd0a613 100755
--- a/perl-install/standalone/drakups
+++ b/perl-install/standalone/drakups
@@ -47,7 +47,7 @@ sub readDriversList() {
foreach (cat_(first(glob("/usr/share/doc/nut-*/docs/driver.list")))) {
/^#/ and next;
if (my ($vendor, $model, $extra, $driver) = /^"(.*)"\s+"(.*)"\s+"(.*)"\s+"(.*)"/) {
- $ups{$vendor}{$model} = {
+ $ups{$vendor}{$model.$extra} = {
driver => $driver,
extra => $extra,
};
@@ -64,7 +64,7 @@ sub add_device_wizard {
my ($ups_models, $model_list) = readDriversList();
use wizards;
- my ($ups, $vendor, $model, $name, $driver, $port, @new_devices);
+ my ($ups, $vendor, $model, $extra, $name, $driver, $port, @new_devices);
my $w = wizards->new;
my $wiz;
my %methods = (
@@ -129,8 +129,8 @@ Do you want to autodetect UPS devices connected to this machine or to manually s
data => [ { label => N("Manufacturer / Model:"), val => \$ups, list => $model_list,
type => 'combo', sort => 1, separator => '|' }, ],
post => sub {
- ($vendor, $model) = ($1, $2) if $ups =~ /(.*)\|(.*) \(/;
- ($name, $driver, $port) = ("myups", $ups_models->{$vendor}{$model}{driver}, "");
+ ($vendor, $model, $extra) = ($1, $2, $3) if $ups =~ /(.*)\|(.*) \((.*)\)$/;
+ ($name, $driver, $port) = ("myups", $ups_models->{$vendor}{$model.$extra}{driver}, "");
($driver) = split(/\s+/, $driver);
"driver";
},