1 --- bcm2035-tool/bcm2035-tool.c 2007/05/07 12:48:06 2000
2 +++ bcm2035-tool/bcm2035-tool.c 2007/05/07 12:55:47 2001
4 -/* bcm2035-tool - bcm2035 tool for Motorola EZX phones
7 * (C) 2007 by Daniel Ribeiro <drwyrm@gmail.com>
9 + * MAC address as argument extension by: Jan Herman <2hp@seznam.cz>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2
17 +/* Default MAC address */
18 +#define BDADDR "\x06\x05\x04\x03\x02\x01"
20 //#define PATCH_FIRMWARE
21 -#define BDADDR "\xab\x89\x67\x45\x23\x01"
27 #include <sys/ioctl.h>
29 #include "bcm2035-tool.h"
30 +//#include "bluetooth.h"
33 #include "motorola_patches.h"
38 +void mac2hex(const char *mac, u_char *dst)
45 + while (isspace(*mac))
48 + /* expect 6 hex octets separated by ':' or space/NUL if last octet */
49 + for (i = 0; i < 6; i++) {
50 + l = strtol(mac, &pp, 16);
51 + if (pp == mac || l > 0xFF || l < 0)
53 + if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0'))))
55 + /* 5-i swaps hex chars */
56 + dst[5-i] = (u_char) l;
63 int main(int argc, char **argv)
71 - printf("use: %s <device>\n", argv[0]);
74 + printf("BCM2035 Tool:\n");
75 + printf("Usage: %s <device> <bdaddr>\n", argv[0]);
79 + if (strlen(argv[2]) < 17) {
80 + printf("invalid argument %s!\n", argv[2]);
84 + /* Converts MAC address to swapped HEX */
85 + mac2hex(argv[2], bdaddr);
87 fd = open (argv[1], O_RDWR | O_NOCTTY );
94 - send_cmd(fd, CMD_SET_BDADDR, BDADDR, 6);
95 + send_cmd(fd, CMD_SET_BDADDR, bdaddr, 6);
98 if (ioctl(fd, TIOCSETD, &i) < 0) {
100 while (1) sleep(999999999);