diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-09-08 00:24:52 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-09-08 00:24:52 +0000 |
commit | 0738cf5e684464d157816be73c0b19efb7dd4fc7 (patch) | |
tree | d68949f5c889cea00b8a643f527406e82f16e1df /test/bdaddr.c | |
parent | fdc6176107c8ef2a88a225a335cca3c6cd2a0808 (diff) |
Support volatile changes of the BD_ADDR for CSR chips
Diffstat (limited to 'test/bdaddr.c')
-rw-r--r-- | test/bdaddr.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/test/bdaddr.c b/test/bdaddr.c index 5331a8dc..57d9b005 100644 --- a/test/bdaddr.c +++ b/test/bdaddr.c @@ -41,6 +41,8 @@ #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> +static int transient = 0; + #define OCF_ERICSSON_WRITE_BD_ADDR 0x000d typedef struct { bdaddr_t bdaddr; @@ -113,6 +115,9 @@ static int csr_write_bd_addr(int dd, bdaddr_t *bdaddr) unsigned char cp[254], rp[254]; struct hci_request rq; + if (transient) + cmd[14] = 0x08; + cmd[16] = bdaddr->b[2]; cmd[17] = 0x00; cmd[18] = bdaddr->b[0]; @@ -160,6 +165,9 @@ static int csr_reset_device(int dd) unsigned char cp[254], rp[254]; struct hci_request rq; + if (transient) + cmd[6] = 0x02; + memset(&cp, 0, sizeof(cp)); cp[0] = 0xc2; memcpy(cp + 1, cmd, sizeof(cmd)); @@ -222,12 +230,13 @@ static void usage(void) { printf("bdaddr - Utility for changing the Bluetooth device address\n\n"); printf("Usage:\n" - "\tbdaddr [-i <dev>] [-r] [new bdaddr]\n"); + "\tbdaddr [-i <dev>] [-r] [-t] [new bdaddr]\n"); } static struct option main_options[] = { { "device", 1, 0, 'i' }, { "reset", 0, 0, 'r' }, + { "transient", 0, 0, 't' }, { "help", 0, 0, 'h' }, { 0, 0, 0, 0 } }; @@ -242,7 +251,7 @@ int main(int argc, char *argv[]) bacpy(&bdaddr, BDADDR_ANY); - while ((opt=getopt_long(argc, argv, "+i:rh", main_options, NULL)) != -1) { + while ((opt=getopt_long(argc, argv, "+i:rth", main_options, NULL)) != -1) { switch (opt) { case 'i': dev = hci_devid(optarg); @@ -256,6 +265,10 @@ int main(int argc, char *argv[]) reset = 1; break; + case 't': + transient = 1; + break; + case 'h': default: usage(); |