public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Fabien Chevalier <fchevalier@silicom.fr>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [PATCH] STLC2500 updated patch
Date: Mon, 08 Oct 2007 13:36:25 +0200	[thread overview]
Message-ID: <470A1639.7020302@silicom.fr> (raw)
In-Reply-To: <1191842227.7931.3.camel@aeonflux.holtmann.net>

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

Marcel Holtmann wrote:

> please break this down into four separate patches. I hate big patches
> that try to fix everything in one go.
> 

Second on the list : remove duplicated code between ericsson and st 
initialization methods.

Fabien

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hciattach-stl2500-cleanup-and-fix-2.patch --]
[-- Type: text/x-patch; name="hciattach-stl2500-cleanup-and-fix-2.patch", Size: 1765 bytes --]

Index: tools/hciattach.c
===================================================================
--- tools/hciattach.c	(.../tags/20070928_1730)	(révision 105)
+++ tools/hciattach.c	(.../branches/20070928_1730)	(révision 105)
@@ -829,62 +849,20 @@
 
 extern int stlc2500_init(int fd, bdaddr_t *bdaddr);
 
 static int stlc2500(int fd, struct uart_t *u, struct termios *ti)
 {
 	bdaddr_t bdaddr;
-	char cmd[5];
 	unsigned char resp[10];
 	int n;
+	int rvalue;
 
-	/* STLC2500 Set Baud Rate stuff */
-	/* We should set the baud rate first, so the firmware download */
-	/* goes much faster */
-
-	/* STLC2500 Seems to support the Ericsson set baud rate stuff */
-	/* It should also support the ST Set Baud Rate command */
-	/* (as in st() function above, but those commands never succeed */
-	cmd[0] = HCI_COMMAND_PKT;
-	cmd[1] = 0x09;
-	cmd[2] = 0xfc;
-	cmd[3] = 0x01;
-
-	switch (u->speed) {
-	case 57600:
-		cmd[4] = 0x03;
-		break;
-	case 115200:
-		cmd[4] = 0x02;
-		break;
-	case 230400:
-		cmd[4] = 0x01;
-		break;
-	case 460800:
-		cmd[4] = 0x00;
-		break;
-	case 921600:
-		cmd[4] = 0x20;
-		break;
-	default:
-		cmd[4] = 0x02;
-		u->speed = 115200;
-		break;
-	}
-
-#ifdef STLC2500_DEBUG
-	fprintf(stderr, "Sending Baud Rate %02x\n", cmd[4]);
-#endif
-	/* Send initialization command */
-	if (write(fd, cmd, 5) != 5) {
-		perror("Failed to write init command");
-		return -1;
-	}
-
-	/* Need to wait here to give a chance for the device to set baud */
-	/* But no more than 0.5 seconds */
-	usleep(200000);
+	/* STLC2500 has an ericsson core */
+	rvalue = ericsson(fd, u, ti);
+	if (rvalue != 0)
+		return rvalue;
 
 #ifdef STLC2500_DEBUG
 	fprintf(stderr, "Setting speed\n");
 #endif
 	if (set_speed(fd, ti, u->speed) < 0) {
 		perror("Can't set baud rate");


[-- Attachment #3: fchevalier.vcf --]
[-- Type: text/x-vcard, Size: 253 bytes --]

begin:vcard
fn:Fabien CHEVALIER
n:CHEVALIER;Fabien
org:SILICOM
adr:;;4 rue de Jouanet; RENNES ATALANTE;;35700;FRANCE
email;internet:fchevalier@silicom.fr
title:Software & Studies Engineer
tel;work:+33 (0) 2 99 84 17 17
version:2.1
end:vcard


  parent reply	other threads:[~2007-10-08 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 11:17 [PATCH] STLC2500 updated patch Fabien Chevalier
2007-10-08 11:17 ` [Bluez-devel] " Marcel Holtmann
2007-10-08 11:28   ` Fabien Chevalier
2007-10-08 11:36   ` Fabien Chevalier [this message]
2007-10-08 11:49   ` Fabien Chevalier
2007-10-08 12:38   ` [Bluez-devel] " Fabien Chevalier
2007-10-09 16:52     ` Marcel Holtmann

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=470A1639.7020302@silicom.fr \
    --to=fchevalier@silicom.fr \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    /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