From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 04:40:35 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 593D95C2 for ; Mon, 16 Mar 2015 04:40:35 +0000 (UTC) Received: from mail-we0-x230.google.com (mail-we0-x230.google.com [IPv6:2a00:1450:400c:c03::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBF78D80 for ; Mon, 16 Mar 2015 04:40:34 +0000 (UTC) Received: by webcq43 with SMTP id cq43so29639288web.2 for ; Sun, 15 Mar 2015 21:40:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=yw8Ugt1FxqnV0D/ASHyEjOAJCcJP2+TS41V/229v6u8=; b=M1SBSuUVGni61sh7gUDsdbDS0YcgAOPE50q7T8TDKDveN9ElPYZHf+92FA74pSD2Em 0Z3VQgIEnKn4TqajqQDYitxiMJ/iC7/rJvcd2C0UulJaxQSI5K6MbAwHKqkZadmmKCl+ 9BAjzSqt0o5vDIJV3pXT6LEfKV90IzckJBZpJvt7b2jy9xuvm29byPLR2r9Z0tlFjabW 6Eokmy3elh8Ct258iBZhv3M3LPMOPWgU/CEI+uNjumEgymwBF0CmfH0Nd1M68wF/CJnY P0jqXQCgNDjzMhGsYeYA6+Ut030ltwOBjGl6DQi5wOdYDu8/v6kgQIwyDb7fc72mMF/L 0YRA== MIME-Version: 1.0 X-Received: by 10.180.23.106 with SMTP id l10mr50952201wif.54.1426480832771; Sun, 15 Mar 2015 21:40:32 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sun, 15 Mar 2015 21:40:32 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Mar 2015 21:40:32 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: freebsd-bluetooth@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2015 04:40:35 -0000 On Sun, Mar 15, 2015 at 6:19 PM, Waitman Gobble wrote: > On Sun, Mar 15, 2015 at 4:48 PM, Waitman Gobble wrote: >> On Sun, Mar 15, 2015 at 7:58 AM, Waitman Gobble wrote: >>> Hi, >>> >>> I'm having trouble registering HID service with sdpd, here is a simple example: >>> >>> >>> sdp_sp_profile_t sp; >>> bdaddr_t bt_addr_any; >>> void *ss; >>> uint32_t sdp_handle; >>> >>> memcpy(&addr, NG_HCI_BDADDR_ANY, sizeof(addr)); >>> memset(&sp, 0, sizeof(sp)); >>> sp.server_channel = 0; >>> >>> ss = sdp_open_local(NULL); >>> >>> sdp_register_service(ss, SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE, >>> &bt_addr_any, (void *)&sp, sizeof(sp), >>> &sdp_handle); >>> >>> >>> >>> messages I am receiving: >>> >>> sdp_error(ss) is Input/output error (5) >>> >>> sdpd[6621]: Could not process SDP request from control socket, >>> pdu->pid=129, pdu->tid=1, pdu->len=12, len=17, error=3 >>> >>> >>> I see /usr/src/usr.sbin/bluetooth/bthidd/ but I believe that's to >>> connect to remote HID services. >>> >>> >>> Also I went to the local electronics store and picked up every bt >>> dongle they had on the shelf. (it looks like v4 bt devices they have >>> use the CSR8510 chip despite the "brand name". but I also have v3, v2, >>> and v1 devices to test). Starting the bluetooth service always seems >>> to result in error for all the devices, however I can run sdpd and >>> also browse remote services and pair from client to server and >>> vice-versa, so I'm not exactly sure of the importance of the bluetooth >>> service? >>> >>> ubt0: on usbus0 >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 5 (disconnected) >>> ubt0: on usbus0 >>> ubt0: at uhub0, port 8, addr 6 (disconnected) >>> ubt0: on usbus0 >>> ng_hci_process_command_timeout: ubt0hci - unable to complete HCI >>> command OGF=0x3, OCF=0x3. Timeout >>> ng_hci_process_command_timeout: ubt0hci - unable to complete HCI >>> command OGF=0x4, OCF=0x9. Timeout >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 7 (disconnected) >>> ubt0: on usbus0 >>> ng_hci_process_command_timeout: ubt0hci - unable to complete HCI >>> command OGF=0x3, OCF=0x3. Timeout >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 8 (disconnected) >>> ubt0: on usbus0 >>> ng_hci_process_command_complete: ubt0hci - HCI command failed, >>> OGF=0x1, OCF=0xe, status=0xc >>> ng_hci_process_command_complete: ubt0hci - HCI command failed, >>> OGF=0x1, OCF=0xe, status=0xc >>> ng_hci_process_command_complete: ubt0hci - HCI command failed, >>> OGF=0x1, OCF=0xe, status=0xc >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 9 (disconnected) >>> ubt0: >> 10> on usbus0 >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 10 (disconnected) >>> ubt0: >> 11> on usbus0 >>> ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR >>> ubt0: at uhub0, port 8, addr 11 (disconnected) >>> ubt0: >> 12> on usbus0 >>> >>> >>> >>> Thank you for any pointers, help, comments. >>> >>> -- >>> Waitman Gobble >>> Los Altos, California USA >>> 510-830-7975 >> >> >> it 'seems like' the problem is that there is no corresponding profile >> implemented in sdpd, >> >> ie, /usr/src/usr.sbin/bluetooth/sdpd/profile.c >> >> profile_p profile_get_descriptor(uint16_t uuid) { ... } >> >> When I issue a request to register >> SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE it's looking for profile >> with uuid (base10) 4388 (0x1124), but >> 4355,4358,4356,4359,4354,4357,4353,4374,4375,4373 are the only ones >> defined in that function. >> >> >> -- >> Waitman Gobble >> Los Altos California USA >> 510-830-7975 > > > It's not 100% correct yet but I did have some luck making a hid > profile in sdpd, shows up in sdpcontrol local browse. So, it 'appears' > . > > https://github.com/waitman/sdpd > > > Now on to make it actually work as it's supposed to :) > > > # sdpcontrol -l browse > > Record Handle: 00000000 > Service Class ID List: > Service Discovery Server (0x1000) > Protocol Descriptor List: > L2CAP (0x0100) > SDP (0x0001) > Bluetooth Profile Descriptor List: > Service Discovery Server (0x1000) ver. 1.0 > > Record Handle: 0x00000001 > Service Class ID List: > Browse Group Descriptor (0x1001) > > Record Handle: 0x00000002 > Service Class ID List: > Human Interface Device (0x1124) > Bluetooth Profile Descriptor List: > Human Interface Device (0x1124) ver. 1.0 > > > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 I cleaned some things up in the sdpd and pushed to github, also added a simple example here: https://github.com/waitman/hid_sppd # btsockstat Active raw HCI sockets Socket PCB Flags Recv-Q Send-Q Local address fffff8003ed612e8 fffff801b62ed580 000002 0 0 * Active L2CAP sockets PCB Recv-Q Send-Q Local address/PSM Foreign address CID State fffff8000a24a500 0 0 * /19 * 0 LISTEN fffff801e299c700 0 0 * /17 * 0 LISTEN fffff801b66f5600 0 0 * /1 * 0 LISTEN fffff8000a207800 0 0 * /3 * 0 LISTEN Active RFCOMM sessions L2PCB PCB Flag MTU Out-Q DLCs State fffff8000a207800 fffff80008c9ed00 0 667 0 No LISTEN if anyone is looking to run HID host services on their FreeBSD machine, it's maybe a starting point. ALSO, I don't see "Service Name" in the output of sdpcontrol.. is this as intended? # sdpcontrol -l browse Record Handle: 0x00000011 Service Class ID List: Human Interface Device (0x1124) Protocol Descriptor List: L2CAP (0x0100) Bluetooth Profile Descriptor List: Human Interface Device (0x1124) ver. 1.0 When I see sample output from other non-FreeBSD systems I see stuff like: Service Name: "The Service Name" Service Provider: "The Service Provider" Service RecHandle: xxxx and i don't see sdpcontrol listing the channel (if using rfcomm) or PSM (hid). Maybe it's not so important. Thanks, -- Waitman Gobble Los Altos California USA 510-830-7975