Thread (2 messages) read the whole thread 2 messages, 2 authors, 2010-06-30

Timeout in hciattach

From: Vladimir Davydov <hidden>
Date: 2010-06-17 10:20:30

Hi, All

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).

I have attached simple patch to fix that.

Best regards,
Vladimir

-- 
Vladimir Davydov
Senior Developer
Promwad Innovation Company
Web: www.promwad.com
22, Olshevskogo St.,
220073, Minsk,
BELARUS
Phone/Fax: +375 (17) 312–1246
E-mail: vladimir.davydov@promwad.com
Skype: v_davydov

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help