From owner-freebsd-bluetooth@FreeBSD.ORG Thu May 14 09:51:48 2009 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AFCB106564A for ; Thu, 14 May 2009 09:51:48 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from smtp02.one2one.net (smtp02.one2one.net [149.254.192.174]) by mx1.freebsd.org (Postfix) with ESMTP id C4A2D8FC16 for ; Thu, 14 May 2009 09:51:47 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from [127.0.0.1] (helo=localhost) by localhost.t-mobile.co.uk with esmtp (Exim 4.50) id 1M4XbL-000104-CW; Thu, 14 May 2009 09:51:43 +0000 Received: from localhost.t-mobile.co.uk ([127.0.0.1]) by localhost (smtpbeckt01 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03829-01; Thu, 14 May 2009 10:51:42 +0100 (BST) Received: from [10.214.182.214] (helo=rya-online.net) by localhost.t-mobile.co.uk with smtp (Exim 4.50) id 1M4XbI-0000zn-FZ; Thu, 14 May 2009 09:51:42 +0000 Received: (nullmailer pid 1567 invoked by uid 1000); Thu, 14 May 2009 09:50:53 -0000 Date: Thu, 14 May 2009 10:50:53 +0100 (BST) To: Maksim Yevmenkin In-Reply-To: References: <1240311202.361300.1366.nullmailer@galant.ukfsn.org> <1240352254.082638.416.nullmailer@galant.ukfsn.org> <1240386569.369073.696.nullmailer@galant.ukfsn.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-Id: <1242294653.314348.1748.nullmailer@galant.ukfsn.org> From: Iain Hibbert X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: plunky@rya-online.net X-SA-Exim-Scanned: No (on localhost.t-mobile.co.uk); SAEximRunCond expanded to false Cc: freebsd-bluetooth@freebsd.org Subject: Re: libhci update X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2009 09:51:48 -0000 On Wed, 22 Apr 2009, Maksim Yevmenkin wrote: > > I've got no more comments here > > thanks for the review. i committed it to -head. Hi Max, I'm in progress of translating for NetBSD and in bt_devinquiry() I see if (ii == NULL) { errno = EINVAL; return (-1); } but I think this test might be bogus? manpage implies that the caller provides a buffer but we allocate one.. /* Calculate inquire length in 1.28 second units */ to = (time_t) ((double) length / 1.28); if (to <= 0) cp->inquiry_length = 4; /* 5.12 seconds */ else if (to > 254) cp->inquiry_length = 255; /* 326.40 seconds */ else cp->inquiry_length = to + 1; 2.1 spec says 1.28 -> 61.44 seconds range is acceptable (0x01->0x30) Then, to avoid the floating point arithmetic, can use (to * 100 / 128) but would need to be range checked first. I'm inclined to use something like if (to == 0) to = 4; else if (to == 1) to = 2; else if (to > 61) to = 61; cp->inquiry_length = (uint8_t)(to * 100 / 128); also, I'm not sure that the timeout is handled right; the bt_devrecv() uses the complete timeout each time but the time endpoint might need to be calculated so that time-to-end can be used? Also I'm wondering what to do in the case bt_devrecv() does actually time out - what can it mean and should we [attempt to] cancel the inquiry? (actually the whole timeout thing is probably irrelevant for a properly functioning device :) iain