patch-2.3.27 linux/scripts/usb/procusb
Next file: linux/scripts/usb/usbtree
Previous file: linux/net/sunrpc/sysctl.c
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
Wed Nov 10 15:11:35 1999
- Orig file:
v2.3.26/linux/scripts/usb/procusb
- Orig date:
Wed Dec 31 16:00:00 1969
diff -u --recursive --new-file v2.3.26/linux/scripts/usb/procusb linux/scripts/usb/procusb
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+# Reads /proc/bus/usb/devices and selectively lists and/or
+# interprets it.
+
+$DEVFILENAME = "/proc/bus/usb/devices";
+$PROGNAME = $0;
+
+print "\n";
+
+$TAGS = $ARGV[0]; # save user TAGS
+if (length ($TAGS) == 0)
+{
+ print "usage: $PROGNAME tags\n";
+ print " where 'tags' can be any number of 'TBDPCIE' or 'A(LL)'\n";
+ exit 1;
+}
+
+$ALL = ($TAGS =~ /all/i) || ($TAGS =~ /a/i);
+
+# TBD: Check that $TAGS is valid.
+if (! $ALL)
+{
+}
+
+if (! open (DEVNUM, "<$DEVFILENAME"))
+{
+ print "$PROGNAME: cannot open '$DEVFILENAME'\n";
+ exit 1;
+}
+
+while ($line = <DEVNUM>) # read a text line from DEVNUM
+{
+ if (($ALL) || ($line =~ /^[$TAGS]:/i)) # any of TAGS at beg. of line?
+ {
+ print "$line"; # still has newline char on it
+ # TBD: add more/paging functionality.
+ }
+} # end while DEVNUM
+
+close (DEVNUM);
+print "\n";
+
+# END.
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)