Linux bluetooth development
 help / color / mirror / Atom feed
From: "Daniel Ribeiro" <drwyrm@gmail.com>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] BCM2035 on UART at speeds higher than 230400
Date: Tue, 15 May 2007 16:29:19 +0000	[thread overview]
Message-ID: <6669365c0705150929t7e2c79b5o9f4e908ae50cc79e@mail.gmail.com> (raw)
In-Reply-To: <1179243101.10069.23.camel@violet>


[-- Attachment #1.1: Type: text/plain, Size: 153 bytes --]

2007/5/15, Marcel Holtmann <marcel@holtmann.org>:
>
> post your patch and I will integrate it.
>

Here it is. Thank you Marcel.

-- 
EOF

Daniel Ribeiro

[-- Attachment #1.2: Type: text/html, Size: 401 bytes --]

[-- Attachment #2: bluez-bcm2035.patch --]
[-- Type: text/x-patch, 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
https://lists.sourceforge.net/lists/listinfo/bluez-devel

      reply	other threads:[~2007-05-15 16:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15 15:01 [Bluez-devel] BCM2035 on UART at speeds higher than 230400 Daniel Ribeiro
2007-05-15 15:31 ` Marcel Holtmann
2007-05-15 16:29   ` Daniel Ribeiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6669365c0705150929t7e2c79b5o9f4e908ae50cc79e@mail.gmail.com \
    --to=drwyrm@gmail.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox