Patch for bccmd
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
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)
---
Quoted 1 line
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);
---
Quoted 1 line
return csr_open_usb(device, vendorid, productid);
1096a1097,1098
Quoted 2 lines
"\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
Quoted 2 lines
{ "productid", 1, 0, 'p'},
{ "vendorid", 1, 0, 'v'},1132a1137,1139
Quoted 3 lines
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) {
---
Quoted 1 line
while ((opt=getopt_long(argc, argv, "+t:d:i:b:p:v:h", main_options, NULL)) != EOF) {1193a1201,1218
Quoted 10 lines
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':Quoted 8 lines
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;
<
---
Quoted 1 line
argv += optind; optind = 0;
1210c1233
< if (transport_open(transport, device, bcsp_rate) < 0)
---
Quoted 1 line
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);
---
Quoted 1 line
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)
---
Quoted 1 line
int
csr_open_usb(char *device, uint16_t vendorid, uint16_t productid)
73,74c73,74
< if (dev->descriptor.idVendor != 0x0a12 ||
< dev->descriptor.idProduct != 0x0001)
---
Quoted 2 lines
if (dev->descriptor.idVendor != vendorid || dev->descriptor.idProduct != productid)
76c76
<
---
Quoted 1 line
Marcel Holtmann
maintainerHi Max,
Quoted 4 lines
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
0x0a120x0001will be used.
please use git-format-patch and git-send-email for the patch. That way it is easier for us to review it inline and also apply it.
Regards
Marcel