From owner-freebsd-bluetooth@FreeBSD.ORG Mon Apr 24 08:06:48 2006 Return-Path: X-Original-To: freebsd-bluetooth@freebsd.org Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5460816A406 for ; Mon, 24 Apr 2006 08:06:48 +0000 (UTC) (envelope-from plunky@rya-online.net) Received: from mail00.svc.cra.dublin.eircom.net (mail00.svc.cra.dublin.eircom.net [159.134.118.16]) by mx1.FreeBSD.org (Postfix) with SMTP id AD17243D4C for ; Mon, 24 Apr 2006 08:06:45 +0000 (GMT) (envelope-from plunky@rya-online.net) Received: (qmail 81436 messnum 6395197 invoked from network[83.70.176.191/unknown]); 24 Apr 2006 08:06:44 -0000 Received: from unknown (HELO rya-online.net) (83.70.176.191) by mail00.svc.cra.dublin.eircom.net (qp 81436) with SMTP; 24 Apr 2006 08:06:44 -0000 Received: (nullmailer pid 1000 invoked by uid 1000); Sun, 23 Apr 2006 21:28:55 -0000 Date: Sun, 23 Apr 2006 22:28:55 +0100 (BST) To: Maksim Yevmenkin In-Reply-To: <4445206D.4030109@savvis.net> References: <4423D096.2010205@udc.es> <44248823.3040907@savvis.net> <1145275616.851775.858.nullmailer@galant.ukfsn.org> <4445206D.4030109@savvis.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Message-Id: <1145827735.746600.1441.nullmailer@galant.ukfsn.org> From: Iain Hibbert Cc: freebsd-bluetooth@freebsd.org Subject: Re: USB isoc xfers 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: Mon, 24 Apr 2006 08:06:48 -0000 On Tue, 18 Apr 2006, Maksim Yevmenkin wrote: > i have not tried to send sco data. I am trying this now and got more trouble :) I can't get the devices I have here (a csr v2.0 and a belkin v1.2) to send NUM_COMPLETE_PACKETS for SCO handles.. the csr returns 0x11 "unsupported feature" for WRITE_SCO_FLOW_CONTROL even though the READ_LOCAL_COMMANDS says it can do that command (well, turning it off seems to work :), and the belkin says ok but READ_BUFFER_SIZE always returns 0 for num_sco_packets. Did you find any of this yet? I think it will have to be done differently.. I looked at Affix and from what I can understand they seem to have a timer that keeps the queue topped up. I couldnt work out what BlueZ does exactly, and I'm trying to think if there is a better way.. seems that the device could send some notification when it took packets off the outputq which would trigger more to be queued, or even just send the packets back via a different method (so empty packet is message), hm.. regards, iain From owner-freebsd-bluetooth@FreeBSD.ORG Mon Apr 24 09:34:56 2006 Return-Path: X-Original-To: freebsd-bluetooth@freebsd.org Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85AA916A401 for ; Mon, 24 Apr 2006 09:34:56 +0000 (UTC) (envelope-from cfernandezh@udc.es) Received: from mail.udc.es (mail.udc.es [193.147.41.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 558F343D49 for ; Mon, 24 Apr 2006 09:34:55 +0000 (GMT) (envelope-from cfernandezh@udc.es) Received: from localhost (localhost [127.0.0.1]) by mail.udc.es ("Servidor de correo del SIAIN") with ESMTP id 8688915EB2C; Mon, 24 Apr 2006 11:33:53 +0200 (CEST) Received: from [193.144.50.98] (unknown [193.144.50.98]) by mail.udc.es ("Servidor de correo del SIAIN") with ESMTP id 4FF8F15EB2A; Mon, 24 Apr 2006 11:33:53 +0200 (CEST) Message-ID: <444C9BBA.4010206@udc.es> Date: Mon, 24 Apr 2006 11:34:50 +0200 From: =?ISO-8859-1?Q?Carlos_Fern=E1ndez_Herranz?= User-Agent: Mozilla Thunderbird 1.0.6 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Maksim Yevmenkin References: <4423D096.2010205@udc.es> <44248823.3040907@savvis.net> <44291782.8010003@udc.es> <1143546159.980113.1641.nullmailer@galant.ukfsn.org> <44292470.5020803@udc.es> <1143547703.630752.2338.nullmailer@galant.ukfsn.org> <44294D1D.4010901@udc.es> <1143558548.478651.3242.nullmailer@galant.ukfsn.org> <4447A36C.8070201@udc.es> <4447BB29.906@savvis.net> In-Reply-To: <4447BB29.906@savvis.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-bluetooth@freebsd.org Subject: Re: About Inquiry_with_RSSI 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: Mon, 24 Apr 2006 09:34:56 -0000 Firsly, the command packets and constants: #define NG_HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 *typedef* *struct* { u_int8_t num_responses; //* number of responses *// } __attribute__ ((packed)) ng_hci_inquiry_result_with_rssi_ep; *typedef* *struct* { bdaddr_t bdaddr; u_int8_t pagescan_rep_mode; u_int8_t pagescan_period_mode; u_int8_t uclass[NG_HCI_CLASS_SIZE]; u_int16_t clock_offset; char rssi; } __attribute__ ((packed)) ng_hci_inquiry_response_with_rssi; #define NG_HCI_OCF_WRITE_INQUIRY_MODE 0x0045 *typedef* *struct* { u_int8_t mode; } __attribute__ ((packed)) ng_hci_write_inquiry_mode_cp; #define NG_HCI_WRITE_INQUIRY_MODE_CP_SIZE 1 *typedef* *struct* { u_int8_t status; } __attribute__ ((packed)) ng_hci_write_inquiry_mode_rp; #define NG_HCI_WRITE_INQUIRY_MODE_RP_SIZE 1 #define NG_HCI_OCF_READ_INQUIRY_MODE 0x0044 *typedef* *struct* { u_int8_t status; u_int8_t mode; } __attribute__ ((packed)) ng_hci_read_inquiry_mode_rp; #define NG_HCI_READ_INQUIRY_MODE_RP_SIZE 2 To allow the reception of the inquiry results with rssi it's required to modify the event filter adding this line: bit_set(filter.event_mask, NG_HCI_EVENT_INQUIRY_RESULT_WITH_RSSI - 1); You can see here the implementation for the commands: static int hci_write_inquiry_mode(int s, int mode) { ng_hci_write_inquiry_mode_cp cp; ng_hci_write_inquiry_mode_rp rp; int n; int response; //* parse command parameters *// *switch* (mode) { *case* 0: cp.mode = (uint8_t) mode; *break*; *case* 1: cp.mode = (uint8_t) mode; *break*; *default*: *return* (ERROR); } n = *sizeof*(rp); *if* ((response=hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, NG_HCI_OCF_WRITE_INQUIRY_MODE), (char const *) &cp, *sizeof*(cp), (char *) &rp, &n)) == ERROR) { *return* (ERROR); } *if* (rp.status != 0x00) { fprintf(stdout, "Status: %s [%#02x]\n", hci_status2str(rp.status), rp.status); *return* (FAILED); } *return* (OK); } //* end hci_write_inquiry_mode *// static int hci_read_inquiry_mode(int s) { ng_hci_read_inquiry_mode_rp rp; int n; int response; n = *sizeof*(rp); *if* (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO, NG_HCI_OCF_READ_BDADDR), (char *) &rp, &n) == ERROR) *return* (ERROR); *if* ((response=hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, NG_HCI_OCF_READ_INQUIRY_MODE), (char *) &rp, &n)) == ERROR) { *return* (ERROR); } printf("\nInquiry mode: %d\n", rp.mode); *if* (rp.status != 0x00) { fprintf(stdout, "Status: %s [%#02x]\n", hci_status2str(rp.status), rp.status); *return* (FAILED); } *return* (OK); } //* end hci_read_inquiry_mode *// You have also to modify the hci_inquiry function to support inquiry_with_rssi adding support for its events, adding: *case* NG_HCI_EVENT_INQUIRY_RESULT_WITH_RSSI: { ng_hci_inquiry_result_with_rssi_ep *ir = (ng_hci_inquiry_result_with_rssi_ep *)(e + 1); uint8_t *r = (uint8_t *)(ir + 1); *for* (n0 = 0; n0 < ir->num_responses; n0++) hci_inquiry_response_with_rssi(&r); *goto* wait_for_more; } Finally you have to provide an event processor, that is the function: static void hci_inquiry_response_with_rssi(uint8_t **b) { ng_hci_inquiry_response_with_rssi *ir = (ng_hci_inquiry_response_with_rssi *) (*b); printf("\n btaddr: %s \tRSSI: %d \n", hci_bdaddr2str(&ir->bdaddr), ir->rssi); } /* end hci_inquiry_response_with_rssi Hope you opinions. Maksim Yevmenkin wrote: > Carlos Fernández Herranz wrote: > >> The problem was in my Bluetooth adapter, D-LINK DBT-122 which are >> said to support Bluetooth 1.2 but it's not true. >> >> Now, I've tried with some Conceptronic BT 2.0 and it works well. I've >> given support for the commands from Bluetooth 1.2: >> >> Write_Inquiry_Mode >> Read_Inquiry_Mode >> >> and the reception of Inquiry results with RSSI. >> >> I'd like to collaborate providing the solutions I've found. How can I >> do it? Posting my code in this list or sending it to Maksim? > > > posting patches here for everyone to try/review would be a good start. > i will be happy to commit them for you (after appropriate testing of > course). > > thanks, > max > Maksim Yevmenkin wrote: > Carlos Fernández Herranz wrote: > >> The problem was in my Bluetooth adapter, D-LINK DBT-122 which are >> said to support Bluetooth 1.2 but it's not true. >> >> Now, I've tried with some Conceptronic BT 2.0 and it works well. I've >> given support for the commands from Bluetooth 1.2: >> >> Write_Inquiry_Mode >> Read_Inquiry_Mode >> >> and the reception of Inquiry results with RSSI. >> >> I'd like to collaborate providing the solutions I've found. How can I >> do it? Posting my code in this list or sending it to Maksim? > > > posting patches here for everyone to try/review would be a good start. > i will be happy to commit them for you (after appropriate testing of > course). > > thanks, > max > From owner-freebsd-bluetooth@FreeBSD.ORG Mon Apr 24 10:06:18 2006 Return-Path: X-Original-To: freebsd-bluetooth@freebsd.org Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E0DA16A405 for ; Mon, 24 Apr 2006 10:06:18 +0000 (UTC) (envelope-from marcel@holtmann.org) Received: from mail.holtmann.net (coyote.holtmann.net [217.160.111.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 59E7E43D58 for ; Mon, 24 Apr 2006 10:06:13 +0000 (GMT) (envelope-from marcel@holtmann.org) Received: from blade (p5487D4AA.dip.t-dialin.net [84.135.212.170]) by mail.holtmann.net (8.13.4/8.13.4/Debian-3sarge1) with ESMTP id k3OAC7hp011290 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Mon, 24 Apr 2006 12:12:08 +0200 From: Marcel Holtmann To: Carlos =?ISO-8859-1?Q?Fern=E1ndez?= Herranz In-Reply-To: <444C9BBA.4010206@udc.es> References: <4423D096.2010205@udc.es> <44248823.3040907@savvis.net> <44291782.8010003@udc.es> <1143546159.980113.1641.nullmailer@galant.ukfsn.org> <44292470.5020803@udc.es> <1143547703.630752.2338.nullmailer@galant.ukfsn.org> <44294D1D.4010901@udc.es> <1143558548.478651.3242.nullmailer@galant.ukfsn.org> <4447A36C.8070201@udc.es> <4447BB29.906@savvis.net> <444C9BBA.4010206@udc.es> Content-Type: text/plain Date: Mon, 24 Apr 2006 12:07:06 +0200 Message-Id: <1145873226.21987.12.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_XX autolearn=no version=3.0.3 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on coyote.holtmann.net X-Virus-Scanned: ClamAV 0.84/1423/Mon Apr 24 10:24:11 2006 on coyote.holtmann.net X-Virus-Status: Clean Cc: freebsd-bluetooth@freebsd.org Subject: Re: About Inquiry_with_RSSI 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: Mon, 24 Apr 2006 10:06:18 -0000 Hi Carlos, > Firsly, the command packets and constants: > > #define NG_HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 > > *typedef* *struct* { > u_int8_t num_responses; //* number of responses *// > } __attribute__ ((packed)) ng_hci_inquiry_result_with_rssi_ep; > > *typedef* *struct* { > bdaddr_t bdaddr; > u_int8_t pagescan_rep_mode; > u_int8_t pagescan_period_mode; > u_int8_t uclass[NG_HCI_CLASS_SIZE]; > u_int16_t clock_offset; > char rssi; > } __attribute__ ((packed)) ng_hci_inquiry_response_with_rssi; and don't forget ng_hci_inquiry_response_with_rssi_and_pagescan_mode. There exists buggy Bluetooth 1.2 devices from some companies that also return the pagescan_mode field with this response even if it has been removed from the specification. To differentiate between these two events, you need to check the length of the event and the num_responses. Use BlueZ as a reference on how to do it. Regards Marcel