summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bluetooth
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2013-04-05 23:42:22 +0000
committeradrian <adrian@FreeBSD.org>2013-04-05 23:42:22 +0000
commit1b6c520949719eb616178e223a4131f362b2fa92 (patch)
tree051f5840c0f954f763de9cf39ad80393f568d132 /usr.sbin/bluetooth
parenta2b864d1a4004d9d9d27366957fe0952d19fcc40 (diff)
downloadFreeBSD-src-1b6c520949719eb616178e223a4131f362b2fa92.zip
FreeBSD-src-1b6c520949719eb616178e223a4131f362b2fa92.tar.gz
Extend ath3kfw to include overridable device / vendor IDs.
This is required for ar3k series bluetooth devices who need firmware but have a different vendor ID than normal. Reviewed by: maksim
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r--usr.sbin/bluetooth/ath3kfw/ath3kfw.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/bluetooth/ath3kfw/ath3kfw.c b/usr.sbin/bluetooth/ath3kfw/ath3kfw.c
index 02d4501..37191d1 100644
--- a/usr.sbin/bluetooth/ath3kfw/ath3kfw.c
+++ b/usr.sbin/bluetooth/ath3kfw/ath3kfw.c
@@ -59,6 +59,9 @@ static int download_firmware (struct libusb20_device *dev,
char const *firmware);
static void usage (void);
+static int vendor_id = ATH3KFW_VENDOR_ID;
+static int product_id = ATH3KFW_PRODUCT_ID;
+
/*
* Firmware downloader for Atheros AR3011 based USB Bluetooth devices
*/
@@ -78,7 +81,7 @@ main(int argc, char **argv)
addr = 0;
firmware = ATH3KFW_FW;
- while ((n = getopt(argc, argv, "d:f:h")) != -1) {
+ while ((n = getopt(argc, argv, "d:f:hp:v:")) != -1) {
switch (n) {
case 'd': /* ugen device name */
if (parse_ugen_name(optarg, &bus, &addr) < 0)
@@ -88,7 +91,12 @@ main(int argc, char **argv)
case 'f': /* firmware file */
firmware = optarg;
break;
-
+ case 'p': /* product id */
+ product_id = strtol(optarg, NULL, 0);
+ break;
+ case 'v': /* vendor id */
+ vendor_id = strtol(optarg, NULL, 0);
+ break;
case 'h':
default:
usage();
@@ -166,8 +174,8 @@ find_device(struct libusb20_backend *be, uint8_t bus, uint8_t addr,
if (desc == NULL)
continue;
- if (desc->idVendor != ATH3KFW_VENDOR_ID ||
- desc->idProduct != ATH3KFW_PRODUCT_ID)
+ if (desc->idVendor != vendor_id ||
+ desc->idProduct != product_id)
continue;
break;
@@ -280,6 +288,8 @@ usage(void)
"Where:\n" \
"\t-d ugenX.Y ugen device name\n" \
"\t-f firmware image firmware image file name for download\n" \
+"\t-v vendor_id vendor id\n" \
+"\t-p vendor_id product id\n" \
"\t-h display this message\n", ATH3KFW, ATH3KFW);
exit(255);
OpenPOWER on IntegriCloud