From: "mmo@remote-exploit.org" <mmo@remote-exploit.org>
To: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Patch for bccmd
Date: Tue, 10 Jun 2014 10:07:24 +0200 [thread overview]
Message-ID: <5396BCBC.2050009@remote-exploit.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
Hi List,
i recently had the issue that i was required to interact with a bluecore
based device with a non-default vendorid and productid via usb. Plesae
find a small patch to introduce two new parameters. If the parameters
are omitted, the default value of 0x0a12 0x0001 will be used.
Greetings
Max Moser
[-- Attachment #2: patch_bccmd_vendorid.diff --]
[-- Type: text/x-diff, Size: 2214 bytes --]
diff -r ../orig/bluez-4.99/tools/bccmd.c tools/bccmd.c
62c62
< static inline int transport_open(int transport, char *device, speed_t bcsp_rate)
---
> static inline int transport_open(int transport, char *device, speed_t bcsp_rate, uint16_t vendorid, uint16_t productid)
69c69
< return csr_open_usb(device);
---
> return csr_open_usb(device, vendorid, productid);
1096a1097,1098
> "\t-p <productid> Select the productid for usb devices (default 0x0001)\n"
> "\t-v <vendorid> Select the vendorid for usb devices (default 0x0a12)\n"
1125a1128,1129
> { "productid", 1, 0, 'p'},
> { "vendorid", 1, 0, 'v'},
1132a1137,1139
> uint16_t vendorid = 0x0a12; // default vendorid
> uint16_t productid = 0x0001; // default productid
>
1136c1143
< while ((opt=getopt_long(argc, argv, "+t:d:i:b:h", main_options, NULL)) != EOF) {
---
> while ((opt=getopt_long(argc, argv, "+t:d:i:b:p:v:h", main_options, NULL)) != EOF) {
1193a1201,1218
> case 'p':
> if (!strncasecmp(optarg, "0x", 2)){
> productid = strtol(optarg, NULL, 16);
> }
> else{
> printf("Please provide the productid in hex representation, eg. 0x0001\n");
> exit(1);
> }
> break;
> case 'v':
> if (!strncasecmp(optarg, "0x", 2)){
> vendorid = strtol(optarg, NULL, 16);
> }
> else{
> printf("Please provide the productid in hex representation, eg. 0x0a12\n");
> exit(1);
> }
> break;
1202,1204c1227
< argv += optind;
< optind = 0;
<
---
> argv += optind; optind = 0;
1210c1233
< if (transport_open(transport, device, bcsp_rate) < 0)
---
> if (transport_open(transport, device, bcsp_rate, vendorid, productid) < 0)
diff -r ../orig/bluez-4.99/tools/csr.h tools/csr.h
518c518
< int csr_open_usb(char *device);
---
> int csr_open_usb(char *device, uint16_t vendorid, uint16_t productid);
diff -r ../orig/bluez-4.99/tools/csr_usb.c tools/csr_usb.c
58c58
< int csr_open_usb(char *device)
---
> int csr_open_usb(char *device, uint16_t vendorid, uint16_t productid)
73,74c73,74
< if (dev->descriptor.idVendor != 0x0a12 ||
< dev->descriptor.idProduct != 0x0001)
---
> if (dev->descriptor.idVendor != vendorid ||
> dev->descriptor.idProduct != productid)
76c76
<
---
>
next reply other threads:[~2014-06-10 8:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 8:07 mmo [this message]
2014-06-10 9:26 ` Patch for bccmd Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5396BCBC.2050009@remote-exploit.org \
--to=mmo@remote-exploit.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.