All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] BCM2035 on UART at speeds higher than 230400
@ 2007-05-15 15:01 Daniel Ribeiro
  2007-05-15 15:31 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Ribeiro @ 2007-05-15 15:01 UTC (permalink / raw)
  To: bluez-devel


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

Hi all.

I am working on bluetooth support for the Motorola EZX platform (a780/e680
phones) and i am unable to hciattach bcm2035 at baud rates higher than
230400.

I reverse engineered the original firmware and found that it uses a
different argument to the hci command that sets the baud rate when setting
460800 and 921600, i have changed hciattach.c and it works at full speed for
me now.

What i want to know is if anyone is using this chip at rates higher than
230400 before submiting my patch, so it doesnt break anyone else work.
Currently i know that the EZX platform and most Palm handhelds use this chip
on the UART port. My patch works for EZX and i am waiting feedback from the
hackndev guys about the palms.

My patch also adds support for setting the bdaddr on chip init, otherwise
this chip gets 00:00:00:00:00:00.

Thank you in advance.

-- 
EOF

Daniel Ribeiro

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

[-- Attachment #2: 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 #3: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez-devel] BCM2035 on UART at speeds higher than 230400
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2007-05-15 15:31 UTC (permalink / raw)
  To: BlueZ development

Hi Daniel,

> I am working on bluetooth support for the Motorola EZX platform
> (a780/e680 phones) and i am unable to hciattach bcm2035 at baud rates
> higher than 230400.
> 
> I reverse engineered the original firmware and found that it uses a
> different argument to the hci command that sets the baud rate when
> setting 460800 and 921600, i have changed hciattach.c and it works at
> full speed for me now.
> 
> What i want to know is if anyone is using this chip at rates higher
> than 230400 before submiting my patch, so it doesnt break anyone else
> work. Currently i know that the EZX platform and most Palm handhelds
> use this chip on the UART port. My patch works for EZX and i am
> waiting feedback from the hackndev guys about the palms. 
> 
> My patch also adds support for setting the bdaddr on chip init,
> otherwise this chip gets 00:00:00:00:00:00.

post your patch and I will integrate it.

Regards

Marcel



-------------------------------------------------------------------------
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/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez-devel] BCM2035 on UART at speeds higher than 230400
  2007-05-15 15:31 ` Marcel Holtmann
@ 2007-05-15 16:29   ` Daniel Ribeiro
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Ribeiro @ 2007-05-15 16:29 UTC (permalink / raw)
  To: BlueZ development


[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-15 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.