Skip to content

Instantly share code, notes, and snippets.

@dominicgs
Created June 6, 2014 12:22
Show Gist options
  • Save dominicgs/18b6b1a5ce0bfe901afa to your computer and use it in GitHub Desktop.
Save dominicgs/18b6b1a5ce0bfe901afa to your computer and use it in GitHub Desktop.
USBDescriptors.com uploader
#!/bin/bash
# Utility to upload USB descriptors to http://usbdescriptors.com/
# Copyright 2014 Dominic Spill
LSUSB=`which lsusb`
CURL=`which curl`
AWK=`which awk`
SORT=`which sort`
URL='http://usbdescriptors.com/cgi-bin/add/'
COMMENT='Uploaded using usbdescriptors.sh'
DEVICES=$($LSUSB | $AWK '{print $6}' | $SORT -u)
for DEV in $DEVICES; do
DESCRIPTOR=$($LSUSB -vd $DEV)
IDS=(${DEV//:/ })
VID=${IDS[0]}
PID=${IDS[1]}
echo "Uploading $DEV"
$CURL -H "Expect:" -X POST -d vendor_entry=$VID -d device_entry=$PID -d comment_entry="$COMMENT" -d descriptor_entry="$DESCRIPTOR" $URL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment