diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 8 | ||||
-rw-r--r-- | test/bdaddr.8 | 61 | ||||
-rw-r--r-- | test/bdaddr.c | 27 |
3 files changed, 92 insertions, 4 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index bf41fb03..8ee5ed06 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -17,11 +17,17 @@ attest_LDADD = @BLUEZ_LIBS@ hstest_LDADD = @BLUEZ_LIBS@ +bdaddr_SOURCES = bdaddr.c $(top_builddir)/tools/oui.h $(top_builddir)/tools/oui.c + bdaddr_LDADD = @BLUEZ_LIBS@ +noinst_MANS = bdaddr.8 + AM_CFLAGS = @BLUEZ_CFLAGS@ endif -EXTRA_DIST = hsplay hsmicro +INCLUDES = -I$(top_srcdir)/tools + +EXTRA_DIST = hsplay hsmicro bdaddr.8 MAINTAINERCLEANFILES = Makefile.in diff --git a/test/bdaddr.8 b/test/bdaddr.8 new file mode 100644 index 00000000..623a1401 --- /dev/null +++ b/test/bdaddr.8 @@ -0,0 +1,61 @@ +.TH BDADDR 8 "Sep 27 2005" BlueZ "Linux System Administration" +.SH NAME +bdaddr \- Utility for changing the Bluetooth device address +.SH SYNOPSIS +.B bdaddr +.br +.B bdaddr -h +.br +.B bdaddr [-i <dev>] [-r] [-t] [new bdaddr] + +.SH DESCRIPTION +.LP +.B +bdaddr +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. +.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 +options are supported on all devices. +Current supported manufacturers are: +.B Ericsson, Cambridge Silicon Radio (CSR) +and +.B Zeevo + +.SH OPTIONS +.TP +.BI -h +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. +.TP +.BI -r +Reset device and make new BD_ADDR active. +.B +CSR +devices only. +.TP +.BI -t +Temporary change. Do not write to non-volatile memory. +.B +CSR +devices only. +.SH FILES +.TP +.I +/usr/share/misc/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> +.PP diff --git a/test/bdaddr.c b/test/bdaddr.c index 57d9b005..92b43de8 100644 --- a/test/bdaddr.c +++ b/test/bdaddr.c @@ -41,6 +41,8 @@ #include <bluetooth/hci.h> #include <bluetooth/hci_lib.h> +#include "oui.h" + static int transient = 0; #define OCF_ERICSSON_WRITE_BD_ADDR 0x000d @@ -246,7 +248,7 @@ int main(int argc, char *argv[]) struct hci_dev_info di; struct hci_version ver; bdaddr_t bdaddr; - char addr[18]; + char addr[18], oui[9], *comp; int i, dd, opt, dev = 0, reset = 0; bacpy(&bdaddr, BDADDR_ANY); @@ -314,8 +316,17 @@ int main(int argc, char *argv[]) printf("Manufacturer: %s (%d)\n", bt_compidtostr(ver.manufacturer), ver.manufacturer); + ba2oui(&bdaddr, oui); + comp = ouitocomp(oui); + ba2str(&bdaddr, addr); - printf("Device address: %s\n", addr); + printf("Device address: %s", addr); + + if (comp) { + printf(" (%s)\n", comp); + free(comp); + } else + printf("\n"); if (argc < 1) { hci_close_dev(dd); @@ -330,8 +341,18 @@ int main(int argc, char *argv[]) for (i = 0; vendor[i].compid != 65535; i++) if (ver.manufacturer == vendor[i].compid) { + ba2oui(&bdaddr, oui); + comp = ouitocomp(oui); + ba2str(&bdaddr, addr); - printf("New BD address: %s\n\n", addr); + printf("New BD address: %s", addr); + + if (comp) { + printf(" (%s)\n\n", comp); + free(comp); + } else + printf("\n\n"); + if (vendor[i].write_bd_addr(dd, &bdaddr) < 0) { fprintf(stderr, "Can't write new address\n"); |