All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch for bccmd
@ 2014-06-10  8:07 mmo
  2014-06-10  9:26 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: mmo @ 2014-06-10  8:07 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

[-- 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
< 
---
> 			

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch for bccmd
  2014-06-10  8:07 Patch for bccmd mmo
@ 2014-06-10  9:26 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2014-06-10  9:26 UTC (permalink / raw)
  To: mmo; +Cc: linux-bluetooth@vger.kernel.org

Hi Max,

> 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.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-10  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10  8:07 Patch for bccmd mmo
2014-06-10  9:26 ` Marcel Holtmann

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.