Created
June 6, 2014 12:22
-
-
Save dominicgs/18b6b1a5ce0bfe901afa to your computer and use it in GitHub Desktop.
USBDescriptors.com uploader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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