summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2013-01-14 20:29:39 +0000
committerThierry Vignaud <tv@mageia.org>2013-01-14 20:29:39 +0000
commit8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464 (patch)
treea6f05d6d946e0b3c84937c1444f063b6210975ba /perl-install/detect_devices.pm
parent8ac645d9003d2375d80338ed1ea04200ac6e9e22 (diff)
downloaddrakx-backup-do-not-use-8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464.tar
drakx-backup-do-not-use-8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464.tar.gz
drakx-backup-do-not-use-8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464.tar.bz2
drakx-backup-do-not-use-8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464.tar.xz
drakx-backup-do-not-use-8f6d1ea27a11fec4238fc0cdd3415f8bf1e69464.zip
use a proper interface between C (ldetect) & perl world, using XS
create directly the hash in XS instead of instead of sprintf()ing it into a string which was then parsed in perl in order to actually create the hash this also simplifies adding further fields
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm28
1 files changed, 12 insertions, 16 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index 7cfdf31c6..6d4090d5f 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -847,12 +847,11 @@ my (@pci, @usb);
sub pci_probe__real() {
add_addons($pcitable_addons, map {
- my %l;
- @l{qw(vendor id subvendor subid pci_domain pci_bus pci_device pci_function pci_revision is_pciexpress media_type nice_media_type driver description)} = split "\t";
- $l{$_} = hex $l{$_} foreach qw(vendor id subvendor subid);
- $l{bus} = 'PCI';
- $l{sysfs_device} = '/sys/bus/pci/devices/' . get_pci_sysfs_path(\%l);
- \%l;
+ my $l = $_;
+ $l->{$_} = hex $l->{$_} foreach qw(vendor id subvendor subid);
+ $l->{bus} = 'PCI';
+ $l->{sysfs_device} = '/sys/bus/pci/devices/' . get_pci_sysfs_path($l);
+ $l;
} c::pci_probe());
}
sub pci_probe() {
@@ -870,13 +869,12 @@ sub usb_probe__real() {
-e "/sys/kernel/debug/usb/devices" or return;
add_addons($usbtable_addons, map {
- my %l;
- @l{qw(vendor id media_type driver description pci_bus pci_device usb_port)} = split "\t";
- $l{media_type} = join('|', grep { $_ ne '(null)' } split('\|', $l{media_type}));
- $l{$_} = hex $l{$_} foreach qw(vendor id);
- $l{sysfs_device} = "/sys/bus/usb/devices/$l{pci_bus}-" . ($l{usb_port} + 1);
- $l{bus} = 'USB';
- \%l;
+ my $l = $_;
+ $l->{media_type} = join('|', grep { $_ ne '(null)' } split('\|', $l->{media_type}));
+ $l->{$_} = hex $l->{$_} foreach qw(vendor id);
+ $l->{sysfs_device} = "/sys/bus/usb/devices/$l->{pci_bus}-" . ($l->{usb_port} + 1);
+ $l->{bus} = 'USB';
+ $l;
} c::usb_probe());
}
sub usb_probe() {
@@ -967,9 +965,7 @@ sub dmi_probe() {
if (arch() !~ /86/) {
return [];
}
- $dmi_probe ||= [ map {
- /(.*?)\t(.*)/ && { bus => 'DMI', driver => $1, description => $2 };
- } $> ? () : c::dmi_probe() ];
+ $dmi_probe ||= $> ? [] : [ c::dmi_probe() ];
@$dmi_probe;
}