diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2005-10-10 08:22:59 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2005-10-10 08:22:59 +0000 | 
| commit | 3b01d3c5e0457009c0bdc683d9e8adab29d20fe1 (patch) | |
| tree | 7399ae385391b90adb784a12bea52c4d033f87fc | |
| parent | 66605acd2f237c337169ea975b399784ffa76788 (diff) | |
Add address change support for Texas Instruments chips
| -rw-r--r-- | test/bdaddr.8 | 31 | ||||
| -rw-r--r-- | test/bdaddr.c | 29 | 
2 files changed, 48 insertions, 12 deletions
| diff --git a/test/bdaddr.8 b/test/bdaddr.8 index 623a1401..dbc2099e 100644 --- a/test/bdaddr.8 +++ b/test/bdaddr.8 @@ -12,23 +12,28 @@ bdaddr \- Utility for changing the Bluetooth device address  .LP  .B  bdaddr -is used to query or set the local Bluetooth device address (BD_ADDR). If run with no arguments,  +is used to query or set the local Bluetooth device address (BD_ADDR). If run +with no arguments,   .B  bdaddr -prints the chip manufacturer's name, and the current BD_ADDR. If the IEEE OUI index file "oui.txt" is installed on the system, -the BD_ADDR owner will be displayed. If the optional  -[new bdaddr] argument is given, the device will be reprogrammed with that address. This can either be permanent or temporary, as specified -by the -t flag. In both cases, the device must be reset before the new address will become active. This can be done -with a 'soft' reset by specifying the -r flag, or a 'hard' reset by removing and replugging the device. -A 'hard' reset will cause the address to revert to the current non-volatile value. +prints the chip manufacturer's name, and the current BD_ADDR. If the IEEE OUI +index file "oui.txt" is installed on the system, the BD_ADDR owner will be +displayed. If the optional [new bdaddr] argument is given, the device will be +reprogrammed with that address. This can either be permanent or temporary, as +specified by the -t flag. In both cases, the device must be reset before the +new address will become active. This can be done with a 'soft' reset by +specifying the -r flag, or a 'hard' reset by removing and replugging the +device. A 'hard' reset will cause the address to revert to the current +non-volatile value.  .PP  .B  bdaddr -uses manufacturer specific commands to set the address, and is therefore device specific. For this reason, not all devices are supported, and not all  +uses manufacturer specific commands to set the address, and is therefore +device specific. For this reason, not all devices are supported, and not all  options are supported on all devices.  Current supported manufacturers are: -.B Ericsson, Cambridge Silicon Radio (CSR)  -and  +.B Ericsson, Cambridge Silicon Radio (CSR), Texas Instruments (TI) +and  .B Zeevo  .SH OPTIONS @@ -37,7 +42,8 @@ and  Gives a list of possible commands.  .TP  .BI -i\ <dev> -Specify a particular device to operate on. If not specified, default is the first available device. +Specify a particular device to operate on. If not specified, default is the +first available device.  .TP  .BI -r  Reset device and make new BD_ADDR active.  @@ -54,7 +60,8 @@ devices only.  .TP  .I  /usr/share/misc/oui.txt -IEEE Organizationally Unique Identifier master file. Manually update from: http://standards.ieee.org/regauth/oui/oui.txt +IEEE Organizationally Unique Identifier master file. +Manually update from: http://standards.ieee.org/regauth/oui/oui.txt  .SH AUTHORS  Written by Marcel Holtmann <marcel@holtmann.org>,  man page by Adam Laurie <adam@algroup.co.uk> diff --git a/test/bdaddr.c b/test/bdaddr.c index 92b43de8..ac382e57 100644 --- a/test/bdaddr.c +++ b/test/bdaddr.c @@ -189,6 +189,34 @@ static int csr_reset_device(int dd)  	return 0;  } +#define OCF_TI_WRITE_BD_ADDR		0x0006 +typedef struct { +	bdaddr_t	bdaddr; +} __attribute__ ((packed)) ti_write_bd_addr_cp; +#define TI_WRITE_BD_ADDR_CP_SIZE 6 + +static int ti_write_bd_addr(int dd, bdaddr_t *bdaddr) +{ +	struct hci_request rq; +	ti_write_bd_addr_cp cp; + +	memset(&cp, 0, sizeof(cp)); +	bacpy(&cp.bdaddr, bdaddr); + +	memset(&rq, 0, sizeof(rq)); +	rq.ogf    = OGF_VENDOR_CMD; +	rq.ocf    = OCF_TI_WRITE_BD_ADDR; +	rq.cparam = &cp; +	rq.clen   = TI_WRITE_BD_ADDR_CP_SIZE; +	rq.rparam = NULL; +	rq.rlen   = 0; + +	if (hci_send_req(dd, &rq, 1000) < 0) +		return -1; + +	return 0; +} +  #define OCF_ZEEVO_WRITE_BD_ADDR		0x0001  typedef struct {  	bdaddr_t	bdaddr; @@ -224,6 +252,7 @@ static struct {  } vendor[] = {  	{ 0,		ericsson_write_bd_addr,	NULL			},  	{ 10,		csr_write_bd_addr,	csr_reset_device	}, +	{ 13,		ti_write_bd_addr,	NULL,			},  	{ 18,		zeevo_write_bd_addr,	NULL			},  	{ 65535,	NULL,			NULL			},  }; | 
