Permalink
Browse files

add/use update-usbids

  • Loading branch information...
David Brownell
David Brownell committed Dec 11, 2004
1 parent a3c09e4 commit f5e8aa7b8743c8ff13e5953c06b9fab3fd4a94a9
Showing with 144 additions and 29 deletions.
  1. +3 −0 ChangeLog
  2. +36 −0 update-usbids.sh
  3. +105 −29 usb.ids
View
@@ -1,3 +1,6 @@
+2004-12-11 David Brownell <dbrownell@users.sourceforge.net>
+ * update-usbids.sh: add, based on update-pciids.sh
+
2004-10-20 David Brownell <dbrownell@users.sourceforge.net>
* lsusb.c: minor formatting updates; add a warning when those HID
descriptors aren't available.
View
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# see also update-pciids.sh (fancier)
+
+set -e
+SRC="http://www.linux-usb.org/usb.ids"
+DEST=usb.ids
+
+if which wget >/dev/null ; then
+ DL="wget -O $DEST.new $SRC"
+elif which lynx >/dev/null ; then
+ DL="eval lynx -source $SRC >$DEST.new"
+else
+ echo >&2 "update-usbids: cannot find wget nor lynx"
+ exit 1
+fi
+
+if ! $DL ; then
+ echo >&2 "update-usbids: download failed"
+ rm -f $DEST.new
+ exit 1
+fi
+
+if ! grep >/dev/null "^C " $DEST.new ; then
+ echo >&2 "update-usbids: missing class info, probably truncated file"
+ exit 1
+fi
+
+if [ -f $DEST ] ; then
+ mv $DEST $DEST.old
+ # --reference is supported only by chmod from GNU file, so let's ignore any errors
+ chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
+fi
+mv $DEST.new $DEST
+
+echo "Done."
Oops, something went wrong.

0 comments on commit f5e8aa7

Please sign in to comment.