patch-2.3.12 linux/drivers/usb/procusb
Next file: linux/drivers/usb/uhci.c
Previous file: linux/drivers/usb/proc_usb.c
Back to the patch index
Back to the overall index
- Lines: 42
- Date:
Tue Jul 27 16:05:50 1999
- Orig file:
v2.3.11/linux/drivers/usb/procusb
- Orig date:
Wed Dec 31 16:00:00 1969
diff -u --recursive --new-file v2.3.11/linux/drivers/usb/procusb linux/drivers/usb/procusb
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+# Reads /proc/bus/usb/devices and selectively lists and/or
+# interprets it.
+
+$DEVFILENAME = "/proc/bus/usb/devices";
+$PROGNAME = $0;
+
+$TAGS = $ARGV[0]; # save user TAGS
+if (length ($TAGS) == 0)
+{
+ print "usage: $PROGNAME tags\n";
+ print " where 'tags' can be any number of 'TDPCIE' 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);
+
+# END.
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)