summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/usb-resource
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-07-03 20:08:18 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-07-03 20:08:18 +0000
commita08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b (patch)
tree48a7a9fe4ea17addaabfccf5306aa25bff9e05bb /mdk-stage1/usb-resource
parented31e129c0036ae2d8c4b530c56733ce1d244f94 (diff)
downloaddrakx-a08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b.tar
drakx-a08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b.tar.gz
drakx-a08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b.tar.bz2
drakx-a08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b.tar.xz
drakx-a08cfceb71abf287fc2856fab1bbe6f4e5e7ba5b.zip
add support for install from USB Network Adapters
Diffstat (limited to 'mdk-stage1/usb-resource')
-rw-r--r--mdk-stage1/usb-resource/.cvsignore1
-rw-r--r--mdk-stage1/usb-resource/Makefile25
-rwxr-xr-xmdk-stage1/usb-resource/update-usb-ids.pl73
3 files changed, 99 insertions, 0 deletions
diff --git a/mdk-stage1/usb-resource/.cvsignore b/mdk-stage1/usb-resource/.cvsignore
new file mode 100644
index 000000000..a7d0cfa9a
--- /dev/null
+++ b/mdk-stage1/usb-resource/.cvsignore
@@ -0,0 +1 @@
+usb-ids.h
diff --git a/mdk-stage1/usb-resource/Makefile b/mdk-stage1/usb-resource/Makefile
new file mode 100644
index 000000000..eb80ce6da
--- /dev/null
+++ b/mdk-stage1/usb-resource/Makefile
@@ -0,0 +1,25 @@
+ #******************************************************************************
+ #
+ # $Id$
+ #
+ # Guillaume Cottenceau (gc@mandrakesoft.com)
+ #
+ # Copyright 2000 MandrakeSoft
+ #
+ # This software may be freely redistributed under the terms of the GNU
+ # public license.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ #
+ #*****************************************************************************
+
+
+all: usb-ids.h
+
+usb-ids.h: /usr/share/ldetect-lst/usbtable update-usb-ids.pl
+ perl update-usb-ids.pl > $@ || rm -f $@
+
+clean:
+ rm -f usb-ids.h
diff --git a/mdk-stage1/usb-resource/update-usb-ids.pl b/mdk-stage1/usb-resource/update-usb-ids.pl
new file mode 100755
index 000000000..b7184bade
--- /dev/null
+++ b/mdk-stage1/usb-resource/update-usb-ids.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+
+
+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";
+
+
+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 '
+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 "#ifdef ENABLE_USB
+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) {
+ $v->[0] =~ /^usb-/ or next;
+ $k =~ /^(....)(....)/;
+ printf qq|\t{ 0x%s, 0x%s, "", "%s" },\n|,
+ $1, $2, $v->[0];
+}
+
+print "};
+int usb_num_ids=sizeof(usb_pci_ids)/sizeof(struct pci_module_map);
+#endif
+";
+
+
+my @t = ('usbnet');
+
+
+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 $_`);
+ }
+
+ print "#ifdef ENABLE_".uc($type)."
+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'};
+ }
+
+ print "};
+int ${type}_usb_num_ids=sizeof(${type}_usb_ids)/sizeof(struct usb_module_map);
+#endif
+";
+
+}