From owner-freebsd-bluetooth@FreeBSD.ORG Wed Jun 10 10:06:59 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 86D92106564A for ; Wed, 10 Jun 2009 10:06:59 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from smtp01.one2one.net (smtp01.one2one.net [149.254.200.196]) by mx1.freebsd.org (Postfix) with ESMTP id 1DFC88FC14 for ; Wed, 10 Jun 2009 10:06:51 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from [127.0.0.1] (helo=localhost) by smtpbarns01 with esmtp (Exim 4.50) id 1MEKhj-0005aM-C7; Wed, 10 Jun 2009 10:06:47 +0000 Received: from smtpbarns01 ([127.0.0.1]) by localhost (smtpbarns01 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21404-03; Wed, 10 Jun 2009 11:06:46 +0100 (BST) Received: from [10.216.105.56] (helo=rya-online.net) by smtpbarns01 with smtp (Exim 4.50) id 1MEKhg-0005a8-6p; Wed, 10 Jun 2009 10:06:46 +0000 Received: (nullmailer pid 18201 invoked by uid 1000); Wed, 10 Jun 2009 10:06:21 -0000 Date: Wed, 10 Jun 2009 11:06:21 +0100 (BST) To: Maksim Yevmenkin In-Reply-To: <1244621794.486063.830.nullmailer@galant.ukfsn.org> References: <1244571487.241431.980.nullmailer@galant.ukfsn.org> <1244621794.486063.830.nullmailer@galant.ukfsn.org> User-Agent: Alpine 2.00 (NEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-Id: <1244628381.118410.14961.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 smtpbarns01); SAEximRunCond expanded to false Cc: freebsd-bluetooth@freebsd.org Subject: Re: bt_dev API 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: Wed, 10 Jun 2009 10:06:59 -0000 On Wed, 10 Jun 2009, Iain Hibbert wrote: > > > - struct bt_devinfo state field needs to be genericalised, > > > > i have not look at the source. i'm guessing its probably fine too :) > > I'm still thinking about how best to do that, will look at the linux > sources later to see what might fit. I'm thinking that either Ok, BlueZ has a HCI_UP flag that they use to mean device enabled, NetBSD has BTF_UP and FreeBSD has 'state == connected' to mean the same thing (?) So, I propose the simplified 'publicly documented' interface as follows -- Obtain information from a Bluetooth device present in the system. The .Fa info argument is a pointer to a .Ft bt_devinfo structure into which information about device .Fa name is placed. The .Ft bt_devinfo structure contains at least the following fields: .Bd -literal char devname[HCI_DEVNAME_SIZE]; int enabled; /* device is enabled */ /* device information */ bdaddr_t bdaddr; uint8_t features[HCI_FEATURES_SIZE]; uint16_t acl_size; uint16_t sco_size; /* flow control */ uint16_t cmd_free; uint16_t acl_free; uint16_t sco_free; /* statistics */ uint32_t cmd_sent; uint32_t evnt_recv; uint32_t acl_recv; uint32_t acl_sent; uint32_t sco_recv; uint32_t sco_sent; uint32_t bytes_recv; uint32_t bytes_sent; /* device settings */ uint16_t link_policy_info; uint16_t packet_type_info; uint16_t role_switch_info; .Ed .Lp Because a Bluetooth device must be enabled in order to retrieve information, the .Fa enabled flag should be tested to be non-zero before relying on further data. -- So, I dropped all the struct padding as no caller needs to care about it, plus acl_pkts and sco_pkts as from what I can see, they are not properly available (only FreeBSD provides such a 'max' value but its not really part of the HCI spec, devices will only ever provide 'current' value) thoughts? iain