linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Vladimir Davydov <vladimir.davydov@promwad.com>
Cc: linux-bluetooth@vger.kernel.org,
	Sergey Kovalev <sergey.kovalev@promwad.com>
Subject: Re: Timeout in hciattach
Date: Wed, 30 Jun 2010 12:50:04 +0300	[thread overview]
Message-ID: <20100630094859.GA1738@jh-x301> (raw)
In-Reply-To: <201006171320.30987.vladimir.davydov@promwad.com>

Hi Vladimir,

On Thu, Jun 17, 2010, Vladimir Davydov wrote:
> I have found that in the latest release of the bluez4 (4.66) timeout in 
> hciattach doesn't work.
> 
> Look at this code of hciattach.c:
> 
> static void bcsp_tshy_sig_alarm(int sig)
> {
> 	unsigned char bcsp_sync_pkt[10] = 
> {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};
> 	int len, retries = 0;
> 
> 	if (retries < bcsp_max_retries) {
> 		retries++;
> 		len = write(serial_fd, &bcsp_sync_pkt, 10);
> 		alarm(1);
> 		return;
> 	}
> 
> 	tcflush(serial_fd, TCIOFLUSH);
> 	fprintf(stderr, "BCSP initialization timed out\n");
> 	exit(1);
> }
> 
> The variable 'retries' will be always 0. Why is it not static? It was static 
> in oldest releases (3.33 for example).

It looks to me like this is a regression introduced by commit
72c6ed7e2d619048440ff528fca7fef59887fbaf from Marcel.

> I have attached simple patch to fix that.

Could you please send a patch in git format-patch format and also fix
the issue in in the other _alarm function (if you take a look at
Marcel's patch you'll see both places that need fixing).

Johan

      reply	other threads:[~2010-06-30  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17 10:20 Timeout in hciattach Vladimir Davydov
2010-06-30  9:50 ` Johan Hedberg [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=20100630094859.GA1738@jh-x301 \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sergey.kovalev@promwad.com \
    --cc=vladimir.davydov@promwad.com \
    /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;
as well as URLs for NNTP newsgroup(s).