Author: adrian
Date: Fri Apr  5 23:42:22 2013
New Revision: 249179
URL: http://svnweb.freebsd.org/changeset/base/249179

Log:
  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

Modified:
  head/usr.sbin/bluetooth/ath3kfw/ath3kfw.c

Modified: head/usr.sbin/bluetooth/ath3kfw/ath3kfw.c
==============================================================================
--- head/usr.sbin/bluetooth/ath3kfw/ath3kfw.c   Fri Apr  5 23:41:38 2013        
(r249178)
+++ head/usr.sbin/bluetooth/ath3kfw/ath3kfw.c   Fri Apr  5 23:42:22 2013        
(r249179)
@@ -59,6 +59,9 @@ static int    download_firmware       (struct lib
                                         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,
                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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to