]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/hwinfo/src/ids/get_pcmcia
Signierten GPG-Schluessel importiert.
[people/pmueller/ipfire-2.x.git] / src / hwinfo / src / ids / get_pcmcia
1 #! /usr/bin/perl
2
3 #
4 # read /etc/pcmcia/config file
5 #
6
7 while(<>) {
8 if(/^\s*card\s+"(.*)"\s*$/) {
9 push @cards, $card;
10 undef $card;
11 $card->{name} = $1;
12 next;
13 }
14
15 if(/^\s*bind\s+"(\S+)"\s*$/) {
16 push @{$card->{modules}}, $1;
17 next;
18 }
19
20 if(/^\s*bind\s+"(\S+)"\s*to\s*\d,\s*"(\S+)"\s*to\s*\d\s*$/) {
21 push @{$card->{modules}}, $1;
22 push @{$card->{modules}}, $2;
23 next;
24 }
25
26 if(/^\s*manfid\s+(0x\S+),\s*(0x\S+)\s*$/) {
27 $card->{vendor} = sprintf("0x%04x", hex $1);
28 $card->{device} = sprintf("0x%04x", hex $2);
29 next;
30 }
31
32 }
33
34 for (@cards) {
35 next unless $_->{modules};
36 next unless $_->{name} =~ /ethernet/i;
37 for $mods (@{$_->{modules}}) {
38 $eth{$mods} = 1;
39 }
40 }
41
42
43 for (@cards) {
44 next unless $_->{vendor};
45 next unless $_->{modules};
46 print "# $_->{name}\n";
47 print " vendor.id\t\tpcmcia $_->{vendor}\n";
48 print "&device.id\t\tpcmcia $_->{device}\n";
49 if($_->{modules}) {
50 $eth = 1;
51 for $mods (@{$_->{modules}}) {
52 $eth = 0 unless $eth{$mods};
53 print "+driver.module.modprobe\t$mods\n";
54 }
55 if($eth) {
56 print "+baseclass.id\t\t0x002\n";
57 print "+subclass.id\t\t0x00\n";
58 }
59 }
60 print "\n";
61 }
62