summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/usb-resource
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-07-05 11:34:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-07-05 11:34:55 +0000
commit7a54076460f9303cc109047e1e8e328539d1b857 (patch)
treede0ec056c40996c97057017f7c1a7863a898fefa /mdk-stage1/usb-resource
parent75a4eaeeb3e8534aa8f8fcf83230e1462e7c662c (diff)
downloaddrakx-7a54076460f9303cc109047e1e8e328539d1b857.tar
drakx-7a54076460f9303cc109047e1e8e328539d1b857.tar.gz
drakx-7a54076460f9303cc109047e1e8e328539d1b857.tar.bz2
drakx-7a54076460f9303cc109047e1e8e328539d1b857.tar.xz
drakx-7a54076460f9303cc109047e1e8e328539d1b857.zip
- do not use mar files for the list of modules, use list_modules.pm via kernel/modules.pl instead
- use read_pcitable to parse usbtable
Diffstat (limited to 'mdk-stage1/usb-resource')
-rwxr-xr-xmdk-stage1/usb-resource/update-usb-ids.pl53
1 files changed, 18 insertions, 35 deletions
diff --git a/mdk-stage1/usb-resource/update-usb-ids.pl b/mdk-stage1/usb-resource/update-usb-ids.pl
index 9dcd421f5..2a54a678b 100755
--- a/mdk-stage1/usb-resource/update-usb-ids.pl
+++ b/mdk-stage1/usb-resource/update-usb-ids.pl
@@ -1,38 +1,29 @@
#!/usr/bin/perl
+use strict;
+use MDK::Common;
-sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l }
-
-
--x "../mar/mar" or die "\t*FAILED* Sorry, need ../mar/mar binary\n";
-
+require '/usr/bin/merge2pcitable.pl';
+my $pci = read_pcitable("/usr/share/ldetect-lst/pcitable");
+my $usb = read_pcitable("/usr/share/ldetect-lst/usbtable");
-my @usbtable_tmp = cat_("/usr/share/ldetect-lst/usbtable");
-my @usbtable;
-foreach (@usbtable_tmp) {
- next if /\s*#/;
- /\s*(\S+)\s+(\S+)\s+"(\S+)"\s+"([^"]*)"/ or next;
- push @usbtable, { 'vendor' => $1, 'id' => $2, 'module' => $3, 'description' => $4 };
-}
+print '
-print '
struct usb_module_map {
unsigned short vendor; /* vendor */
unsigned short id; /* device */
const char *name; /* human readable name */
const char *module; /* module to load */
};
+
';
print "struct pci_module_map usb_pci_ids[] = {
";
-require '/usr/bin/merge2pcitable.pl';
-my $drivers = read_pcitable("/usr/share/ldetect-lst/pcitable");
-
-while (my ($k, $v) = each %$drivers) {
+while (my ($k, $v) = each %$pci) {
$v->[0] =~ /^usb-|^ehci-hcd/ or next;
$k =~ /^(....)(....)/;
printf qq|\t{ 0x%s, 0x%s, "", "%s" },\n|,
@@ -43,27 +34,19 @@ print "};
int usb_num_ids=sizeof(usb_pci_ids)/sizeof(struct pci_module_map);
";
+print "struct usb_module_map usb_usb_ids[] = {
+";
-my @t = ('usb');
-
-
-foreach $type (@t) {
- my $modulez;
- foreach (glob("../../all.modules/*/${type}_modules.mar")) {
- -f $_ or die "\t*FAILED* Sorry, need $_ mar file\n";
- push @$modulez, (`../mar/mar -l $_`);
- }
+my @modules = chomp_(`perl ../../kernel/modules.pl pci_modules4stage1:"network/usb disk/usb"`);
- print "struct usb_module_map ${type}_usb_ids[] = {
-";
- foreach my $usbentry (@usbtable) {
- grep(/^\t$usbentry->{'module'}\.o\s/, @$modulez) or next;
- printf qq|\t{ %s, %s, "%s", "%s" },\n|,
- $usbentry->{'vendor'}, $usbentry->{'id'}, $usbentry->{'description'}, $usbentry->{'module'};
+ foreach my $k (sort keys %$usb) {
+ my $v = $usb->{$k};
+ member($v->[0], @modules) or next;
+ $k =~ /^(....)(....)/;
+ printf qq|\t{ 0x%s, 0x%s, "%s", "%s" },\n|,
+ $1, $2, $v->[1], $v->[0];
}
print "};
-int ${type}_usb_num_ids=sizeof(${type}_usb_ids)/sizeof(struct usb_module_map);
+int usb_usb_num_ids=sizeof(usb_usb_ids)/sizeof(struct usb_module_map);
";
-
-}