[Bluez-devel] [PATCH] BCM2035 on UART at higher speeds + Support for setting bdaddr.

Daniel Ribeiro
2007-06-21T16:44:38Z

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

Sending again as Marcel requested.

--
EOF

Daniel Ribeiro

[-- Attachment #2: bluez-bcm2035.patch --]
[-- Type: text/x-diff, Size: 2054 bytes --]

This corrects baurate parameters for bcm2035 connected via uart and adds
support for setting the bdaddr.

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Index: bluez-utils-3.10/tools/hciattach.c
===================================================================
--- bluez-utils-3.10.orig/tools/hciattach.c 2007-05-12 13:16:38.000000000 -0300
+++ bluez-utils-3.10/tools/hciattach.c 2007-05-12 15:44:14.000000000 -0300
@@ -925,11 +925,13 @@
/*
* Broadcom specific initialization
* Extracted from Jungo openrg
+ * Set bdaddr and correct baud rate arguments taken from OpenEZX
*/
static int bcm2035(int fd, struct uart_t *u, struct termios *ti)
{
int n;
unsigned char cmd[30], resp[30];
+ bdaddr_t bdaddr;

/* Reset the BT Chip */
memset(cmd, 0, sizeof(cmd));
@@ -951,6 +953,32 @@
return -1;
}

+ if (u->bdaddr != NULL) {
+ /* set bdaddr */
+ memset(cmd, 0, sizeof(cmd));
+ memset(resp, 0, sizeof(resp));
+ cmd[0] = HCI_COMMAND_PKT;
+ cmd[1] = 0x01;
+ cmd[2] = 0xfc;
+ cmd[3] = 0x06;
+
+ str2ba(u->bdaddr, &bdaddr);
+ bacpy((bdaddr_t *) (cmd + 4), &bdaddr);
+
+ /* Send command */
+ if (write(fd, cmd, 10) != 10) {
+ fprintf(stderr, "Failed to write \"set bdaddr\" "
+ "command\n");
+ return -1;
+ }
+
+ /* Read reply */
+ if ((n = read_hci_event(fd, resp, 10)) < 0) {
+ fprintf(stderr, "Failed to set bdaddr\n");
+ return -1;
+ }
+ }
+
/* Read the local version info */
memset(cmd, 0, sizeof(cmd));
memset(resp, 0, sizeof(resp));
@@ -1010,11 +1038,11 @@
cmd[5] = 0xfa;
break;
case 460800:
- cmd[4] = 0x11;
+ cmd[4] = 0x22;
cmd[5] = 0xfd;
break;
case 921600:
- cmd[4] = 0x65;
+ cmd[4] = 0x55;
cmd[5] = 0xff;
break;
default:
@@ -1103,7 +1131,7 @@
{ "billionton", 0x0279, 0x950b, HCI_UART_BCSP, 115200, 115200, 0, NULL, bcsp },

/* Broadcom BCM2035 */
- { "bcm2035", 0x0A5C, 0x2035, HCI_UART_H4, 115200, 115200, 0, NULL, bcm2035 },
+ { "bcm2035", 0x0A5C, 0x2035, HCI_UART_H4, 115200, 460800, FLOW_CTL, NULL, bcm2035 },

{ NULL, 0 }
};

[-- Attachment #3: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net