[oe-commits] org.oe.dev bcm2035tool: takes BDADDR as a commandline argument. Patch from Jan Herman
koen commit
openembedded-commits at lists.openembedded.org
Mon May 7 13:17:30 UTC 2007
bcm2035tool: takes BDADDR as a commandline argument. Patch from Jan Herman
Author: koen at openembedded.org
Branch: org.openembedded.dev
Revision: a56a2cad2b8cadc8e2ad44205cd1e65002d62c18
ViewMTN: http://monotone.openembedded.org/revision.psp?id=a56a2cad2b8cadc8e2ad44205cd1e65002d62c18
Files:
1
packages/bluez/bcm2035-tool
packages/bluez/bcm2035-tool/addr-as-arg.patch
packages/bluez/bcm2035-tool_0.0.bb
Diffs:
#
# mt diff -r8d1f0dc2f788d36cab96fd58d2ee7477262cf9b6 -ra56a2cad2b8cadc8e2ad44205cd1e65002d62c18
#
#
#
# add_dir "packages/bluez/bcm2035-tool"
#
# add_file "packages/bluez/bcm2035-tool/addr-as-arg.patch"
# content [0adffc44bd430165301d7616828e5d9885aa23ad]
#
# patch "packages/bluez/bcm2035-tool_0.0.bb"
# from [bfb20828cb3b6715dbbdaea60e8a67a4fa964e28]
# to [3da7cf0faaea2496e6526c0e0df3372fee7da379]
#
============================================================
--- packages/bluez/bcm2035-tool/addr-as-arg.patch 0adffc44bd430165301d7616828e5d9885aa23ad
+++ packages/bluez/bcm2035-tool/addr-as-arg.patch 0adffc44bd430165301d7616828e5d9885aa23ad
@@ -0,0 +1,104 @@
+--- bcm2035-tool/bcm2035-tool.c 2007/05/07 12:48:06 2000
++++ bcm2035-tool/bcm2035-tool.c 2007/05/07 12:55:47 2001
+@@ -1,6 +1,8 @@
+-/* bcm2035-tool - bcm2035 tool for Motorola EZX phones
++/* bcm2035-tool
+ *
+ * (C) 2007 by Daniel Ribeiro <drwyrm at gmail.com>
++ *
++ * MAC address as argument extension by: Jan Herman <2hp at seznam.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+@@ -17,10 +19,10 @@
+ *
+ */
+
++/* Default MAC address */
++#define BDADDR "\x06\x05\x04\x03\x02\x01"
+
+ //#define PATCH_FIRMWARE
+-#define BDADDR "\xab\x89\x67\x45\x23\x01"
+-
+
+ #include <stdio.h>
+ #include <string.h>
+@@ -33,6 +35,7 @@
+ #include <sys/ioctl.h>
+ #include <termios.h>
+ #include "bcm2035-tool.h"
++//#include "bluetooth.h"
+
+ #ifdef PATCH_FIRMWARE
+ #include "motorola_patches.h"
+@@ -180,18 +183,51 @@
+
+ }
+
++void mac2hex(const char *mac, u_char *dst)
++{
++
++ int i;
++ long l;
++ char *pp;
++
++ while (isspace(*mac))
++ mac++;
++
++ /* expect 6 hex octets separated by ':' or space/NUL if last octet */
++ for (i = 0; i < 6; i++) {
++ l = strtol(mac, &pp, 16);
++ if (pp == mac || l > 0xFF || l < 0)
++ return;
++ if (!(*pp == ':' || (i == 5 && (isspace(*pp) || *pp == '\0'))))
++ return;
++ /* 5-i swaps hex chars */
++ dst[5-i] = (u_char) l;
++ mac = pp + 1;
++ }
++ }
++
++char bdaddr[6];
++
+ int main(int argc, char **argv)
+ {
+ int fd, i;
+ struct termios term;
+ char buf[1024];
+- char bdaddr[6];
+-
+- if (argc < 2) {
+- printf("use: %s <device>\n", argv[0]);
++
++ if (argc < 3) {
++ printf("BCM2035 Tool:\n");
++ printf("Usage: %s <device> <bdaddr>\n", argv[0]);
+ exit(1);
+ }
+
++ if (strlen(argv[2]) < 17) {
++ printf("invalid argument %s!\n", argv[2]);
++ exit(1);
++ }
++
++ /* Converts MAC address to swapped HEX */
++ mac2hex(argv[2], bdaddr);
++
+ fd = open (argv[1], O_RDWR | O_NOCTTY );
+
+ if(fd < 0) exit(-1);
+@@ -212,7 +248,7 @@
+ #endif
+ set_baud(fd, 460800);
+
+- send_cmd(fd, CMD_SET_BDADDR, BDADDR, 6);
++ send_cmd(fd, CMD_SET_BDADDR, bdaddr, 6);
+
+ i = N_HCI;
+ if (ioctl(fd, TIOCSETD, &i) < 0) {
+@@ -228,5 +264,3 @@
+ while (1) sleep(999999999);
+ return 0;
+ }
+-
+-
============================================================
--- packages/bluez/bcm2035-tool_0.0.bb bfb20828cb3b6715dbbdaea60e8a67a4fa964e28
+++ packages/bluez/bcm2035-tool_0.0.bb 3da7cf0faaea2496e6526c0e0df3372fee7da379
@@ -1,9 +1,11 @@ LICENSE = "GPLv2"
DESCRIPTION = "Bluetooth firmware poker for bccm2035 chips (motorola phones and palms)"
LICENSE = "GPLv2"
-SRC_URI = "http://people.openezx.org/wyrm/bcm2035-tool.tgz"
+PR = "r1"
-# Note: everyone will have the same BDADDR for the time being
+SRC_URI = "http://people.openezx.org/wyrm/bcm2035-tool.tgz \
+ file://addr-as-arg.patch;patch=1 \
+ "
S = "${WORKDIR}/${PN}"
More information about the Openembedded-commits
mailing list