summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm68
1 files changed, 41 insertions, 27 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 3e699ba24..835785f06 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -180,7 +180,7 @@ sub isKeyUsb { $_[0]{usb_media_type} && index($_[0]{usb_media_type}, 'Mass Stora
sub isFloppyUsb { $_[0]{usb_driver} && $_[0]{usb_driver} eq 'Removable:floppy' }
sub isRemovableDrive {
my ($e) = @_;
- isZipDrive($e) || isLS120Drive($e) || $e->{media_type} && $e->{media_type} eq 'fd' || isRemovableUsb($e) || $e->{usb_media_type} && index($e->{usb_media_type}, 'Mass Storage|Floppy (UFI)') == 0;
+ isZipDrive($e) || isLS120Drive($e) || $e->{media_type} && $e->{media_type} eq 'fd' || $e->{usb_media_type} && index($e->{usb_media_type}, 'Mass Storage|Floppy (UFI)') == 0;
}
sub getSCSI_24() {
@@ -270,6 +270,8 @@ sub getSCSI_26() {
};
} all($dev_dir);
+ @l = sort { $a->{host} <=> $b->{host} || $a->{channel} <=> $b->{channel} || $a->{id} <=> $b->{id} || $a->{lun} <=> $b->{lun} } @l;
+
complete_usb_storage_info(@l);
foreach (@l) {
@@ -342,6 +344,12 @@ sub getIDE() {
@idi;
}
+sub block_devices() {
+ -d '/sys/block'
+ ? map { s|!|/|; $_ } all('/sys/block')
+ : map { $_->{dev} } devices::read_proc_partitions_raw();
+}
+
sub getCompaqSmartArray() {
my (@idi, $f);
@@ -351,12 +359,14 @@ sub getCompaqSmartArray() {
my ($name) = m|/(.*)|;
for (my $i = 0; -r ($f = "${prefix}$i"); $i++) {
- foreach (cat_($f)) {
- if (my ($raw_device) = m|^\s*($name/.*?):|) {
- my $device = -d "/dev/$raw_device" ? "$raw_device/disc" : $raw_device;
- push @idi, { device => $device, prefix => $raw_device . 'p', info => "Compaq RAID logical disk",
- media_type => 'hd', bus => 'ida' };
- }
+ my @raw_devices = cat_($f) =~ m|^\s*($name/.*?):|gm;
+ @raw_devices or @raw_devices = grep { m!^$name/! } block_devices();
+
+ foreach my $raw_device (@raw_devices) {
+ my $device = -d "/dev/$raw_device" ? "$raw_device/disc" : $raw_device;
+ push @idi, { device => $device, prefix => $raw_device . 'p',
+ info => "Compaq RAID logical disk",
+ media_type => 'hd', bus => $name };
}
}
}
@@ -506,29 +516,27 @@ 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;
- };
+ # MGE serial PnP devices:
+ my @usb_devices = map { ($_->{name} = $_->{description}) =~ s/.*\|//; $_ } usb_probe();
- (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*"));
+ $_->{port} = $_->{DEVICE};
+ $_->{bus} = "Serial";
+ $_->{driver} = "mge-utalk" if $_->{MODEL} =~ /0001/;
+ $_->{driver} = "mge-shut" if $_->{MODEL} =~ /0002/;
+ $_->{media_type} = 'UPS';
+ $_->{description} = "MGE UPS SYSTEMS|UPS - Uninterruptible Power Supply" if $_->{MODEL} =~ /000[12]/;
+ $_;
+ } grep { $_->{DESCRIPTION} =~ /MGE UPS/ } values %serialprobe),
+ # USB UPSs;
+ (grep { $_->{description} =~ /American Power Conversion\|Back-UPS/ } @usb_devices),
+ (map {
+ $_->{port} = "auto";
+ $_->{media_type} = 'UPS';
+ $_->{driver} = 'newhidups';
+ $_;
+ } grep { $_->{driver} =~ /ups$/ } @usb_devices);
}
$pcitable_addons = <<'EOF';
@@ -617,6 +625,12 @@ sub firewire_probe() {
@l;
}
+sub real_pcmcia_probe() {
+ return if $::testing;
+
+ c::pcmcia_probe() || (find { $_->{driver} eq 'yenta_socket' } pci_probe()) && 'yenta_socket';
+}
+
sub pcmcia_probe() {
-e '/var/run/stab' || -e '/var/lib/pcmcia/stab' or return ();