From owner-freebsd-bluetooth@FreeBSD.ORG Sun Mar 15 14:58:54 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 7E3F8CC4 for ; Sun, 15 Mar 2015 14:58:54 +0000 (UTC) Received: from mail-wg0-x233.google.com (mail-wg0-x233.google.com [IPv6:2a00:1450:400c:c00::233]) (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 2746BBB6 for ; Sun, 15 Mar 2015 14:58:54 +0000 (UTC) Received: by wggv3 with SMTP id v3so21544614wgg.1 for ; Sun, 15 Mar 2015 07:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=/1Fh+bgB7ro67nLbEr4JpBBZpwjryvblJlV1Yfd9IDg=; b=rpqE3Lr5uEVhdIpVFFog0PLndg5+KNkEv26ddEhV6BVWQu+8kjui42NBlY4mpRgCOX djN8wn9sx28b48e0d+NDWcN2nswkZ+L0p/KbwgCAR3yw/DX9irhGAithdBPzQauGK3Z/ M/guAILfmrqzrT0VAHypznyNiUAN4GJhG2p0+DprEuIIFPPH04uiwxA/pPppYA3uwYnu 4RsOQh246Ta0F+VRDIUpMjMjbq2r/oe4lNVGq+UcbuUuPmQK8vEBfGYsbViucPDj2PwA sq1lqYKPZVYfWbbnrqjh3f6v5e0AmP0X0c3tD6amdgksToVB30oQMTd8SD6/SnFIG4vP DOnQ== MIME-Version: 1.0 X-Received: by 10.195.12.35 with SMTP id en3mr110096493wjd.129.1426431532524; Sun, 15 Mar 2015 07:58:52 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sun, 15 Mar 2015 07:58:52 -0700 (PDT) Date: Sun, 15 Mar 2015 07:58:52 -0700 Message-ID: Subject: 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: Sun, 15 Mar 2015 14:58:54 -0000 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: on usbus0 ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR ubt0: at uhub0, port 8, addr 10 (disconnected) ubt0: on usbus0 ubt0: ubt_bulk_read_callback:977: bulk-in transfer failed: USB_ERR_IOERROR ubt0: at uhub0, port 8, addr 11 (disconnected) ubt0: on usbus0 Thank you for any pointers, help, comments. -- Waitman Gobble Los Altos, California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Sun Mar 15 23:48:59 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 4A1DFD39 for ; Sun, 15 Mar 2015 23:48:59 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (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 CE7619A9 for ; Sun, 15 Mar 2015 23:48:58 +0000 (UTC) Received: by wifj2 with SMTP id j2so29545473wif.1 for ; Sun, 15 Mar 2015 16:48:57 -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=2sTS3+bPAmLzZzvSWe8lUe9HijR0YVAJVtwPBwTRhsA=; b=kz7AANZBmmJMxhi5/YYxY7zmSWR8/4KEaAFS3ejQVjqdrhGEMhP3MswBPi91fWKmzN lGJWwCg3aUUum+uk3zVDI5TFgrjgwnGlzNZvQDNJPS/DJByYB9oYIUFs/0HcICkaQRMq 7ysN5dgsyFVwZy84FyP3fYrmzooDRd0xt4kbKWhON1nwzvuU6PTPE6JnRuLGRSsU2JZH Seg15jSkmdnc4z1/TZ/bB/3+m8jgBI/oNhu2QMN9KZ/ZySUiUijXNfHbq+b5rZmlYhF9 JhLGLDFjAk1lSnQBFHGkffz67C9nSz1xpUxizv6PbnKaCGGrZ3X+yUPvZdcKWcsbtkEV hvPA== MIME-Version: 1.0 X-Received: by 10.195.12.97 with SMTP id ep1mr119569241wjd.134.1426463337180; Sun, 15 Mar 2015 16:48:57 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sun, 15 Mar 2015 16:48:57 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Mar 2015 16:48:57 -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: Sun, 15 Mar 2015 23:48:59 -0000 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 From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 01:19:16 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 691B6EE9 for ; Mon, 16 Mar 2015 01:19:16 +0000 (UTC) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) (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 F1C2E236 for ; Mon, 16 Mar 2015 01:19:15 +0000 (UTC) Received: by wifj2 with SMTP id j2so30522200wif.1 for ; Sun, 15 Mar 2015 18:19:13 -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=4nAUZEPf0Awl8Efxl/DGkSlfhWczMIIYFEQaGj3DRKE=; b=C4gVfpVQVpaaXSAC9XWe7QoIqAN+G/1SFJbeFmcqyLNYwRKCiyWYCVL+v+tJnp7+iq jLyrsxpEg0kBPNF5ilztDlCpIrCWNC1KA9qY0tAoD3w1+HdGvlughzBCkPatF2qQ+BAp kmYuDpUmIuWd+fBYduGrECZdRtFcXZIJZxygxeSm27nt6wtGKrHFb1/ViIKVYa7hPuQw W7rC8flNakcfQhubPhyGBBsdnBooBH0syOQ0bs22iAvSjWMbnxNLeiDwVk+TzpVCd4hO nzS3kcSWbUL7GvpcYZtBS3EIXGjse2xnUYKqR1wdwg0gSrdeLQyITYjv+TDszD408tHV kgBg== MIME-Version: 1.0 X-Received: by 10.194.75.168 with SMTP id d8mr119489247wjw.87.1426468753221; Sun, 15 Mar 2015 18:19:13 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sun, 15 Mar 2015 18:19:13 -0700 (PDT) In-Reply-To: References: Date: Sun, 15 Mar 2015 18:19:13 -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 01:19:16 -0000 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 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 From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 17:15:35 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 67585331 for ; Mon, 16 Mar 2015 17:15:35 +0000 (UTC) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (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 2D0792FE for ; Mon, 16 Mar 2015 17:15:35 +0000 (UTC) Received: by igcau2 with SMTP id au2so10781507igc.0 for ; Mon, 16 Mar 2015 10:15:34 -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 :cc:content-type; bh=bUSYAVM350Spx/Ny6EPkc80U8doM9TsU7SD7o80QFM8=; b=eTK9ErWCfVZg82zaNtrBYfxmVs0vDFofTsS3LjdyRwec/9S8HJ8wLGXMEdytcM/6hE 36+vHZ9DhVsuH3lOlC0TaJSVJzzeqhdRxF2dNpxud4b/8DEG7UJ+/skGDiDqYx05JyIO hYB44O2BjgMiZYzOtKf37tP99fiLpQz89WmUE5gXJcTbcq260pMnNr0fy8jl+i7UWfNL DgNVz3/F9Z9Cq7TT4sT9mtvOWgwA/wTjM6uLR+bLp7lNMajCVArrdG4tXPKxd6gVoxes ivvp1LW18bF3/XoDG1KJF9uVnZ8uH+4Yj/FMLCIc8QgGGeHIUnoRvtjf6XUivJoEyZuE uHQw== MIME-Version: 1.0 X-Received: by 10.107.7.141 with SMTP id g13mr76492670ioi.52.1426526134541; Mon, 16 Mar 2015 10:15:34 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Mon, 16 Mar 2015 10:15:34 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 10:15:34 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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 17:15:35 -0000 Hello, > 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); hmmm.... can you please explain what are you trying to do? as far as i can see you are trying to use UUID for SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE , but you are passing sdp_sp_profile_t data structure (which is for SDP_SERVICE_CLASS_SERIAL_PORT). [...] > I see /usr/src/usr.sbin/bluetooth/bthidd/ but I believe that's to > connect to remote HID services. well, yes and no. depending on what do you mean by "connecting to remote HID services". bthidd(8) provides support for bluetooth peripherals that implement bluetooth hid profile, for example bluetooth keyboard and mouse. > 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 if all devices give you errors, then, i would suggest starting looking at your USB setup. are there any hubs for example? also, sometimes, devices require some sort of firmware to be downloaded first to be fully operational. i doubt its the case here. though. > 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? you can run sdpd(8) even if no bluetooth devices are connected to the system. sdpd(8) is responsible for answering sdp queries from the remote devices. it effectively advertises (to remove clients) what bluetooth services are available on the local host. thanks max From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 17:32:13 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A6BF5AC for ; Mon, 16 Mar 2015 17:32:13 +0000 (UTC) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) (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 4E7906D0 for ; Mon, 16 Mar 2015 17:32:13 +0000 (UTC) Received: by iegc3 with SMTP id c3so180499567ieg.3 for ; Mon, 16 Mar 2015 10:32:12 -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 :cc:content-type; bh=iyytMTjbOz+Id+OCZaVHjfOMYnd2bRrRvQW7JDMQsVI=; b=FL/J2Lvsry3O4/+epWEuR1uuctWUw528wqyf0b3ZcUma2jjoxmE0IseggrQ5+/DwVF T947QcDDb0kzjgh3EQEnDRvA1irgo0DwFyJui2CdcQ1mWOjPgnv4QZVykwx+/Grd/OuC hg2iujTK9PQ0B5g3eoISjszDxZOczDnDWinGyGJSso5MBBfK6db2bSeYG6B/l1f7UlR6 FPq/xUpgAXoRRyzoO5YJMoIvnkA+vjM6/MgweJlQD1Ch6RhMioxveTByI2c4sk2jL8VR k2fsrCF0CjeqGMKTkKNvyHkgjWHvVobo9c9Ggh1NpNednF/tlr/I5KQZ3OpSkMbhdKWd 1xcA== MIME-Version: 1.0 X-Received: by 10.42.66.76 with SMTP id o12mr6247576ici.48.1426527132785; Mon, 16 Mar 2015 10:32:12 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Mon, 16 Mar 2015 10:32:12 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 10:32:12 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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 17:32:13 -0000 Hello, >> 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. i looked at the code, and, it does not seem entirely correct to me. first of all, you seem to keep using sdp_sp_profile_t. i'm not sure why. the way to add a profile is 1) change lib/libsdp and add appropriate structure to keep profile parameters. different profiles can have different parameters, for example serial port only needs rfcomm channel. lan profile allows you to pass a whole bunch of parameters. with respect to bluetooth hid, please tell what are you trying to implement? device side or host side? those two have different requirements for sdp records. for example, device side should provide l2cap psm for hid control and data channels, hid descriptor and other things. 2) add profile implementation to sdpd(8). you tried to do this, but its not quite right. i can only assume you are trying to implement device side (because host side is implemented with bthidd(8) already). if this is the case, then may i please suggest to read bluetooth hid spec, specifically chapter "5.3.3 SDP Attribute Summary" that talk about spd attributes that hid device must present to the remote host. thanks max From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 17:42:10 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92F428A2 for ; Mon, 16 Mar 2015 17:42:10 +0000 (UTC) Received: from mail-ig0-x231.google.com (mail-ig0-x231.google.com [IPv6:2607:f8b0:4001:c05::231]) (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 5E256875 for ; Mon, 16 Mar 2015 17:42:10 +0000 (UTC) Received: by igcqo1 with SMTP id qo1so49323391igc.0 for ; Mon, 16 Mar 2015 10:42:09 -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 :cc:content-type; bh=4XR11cH/Job3G26bcLU/uU9MvZLXmdasbD3nDRDCfCo=; b=DD0OD/6WWf4ag2rFupfu4ThhOM40H5FDUr5+Zzbh+yJSn5oaqT7PvODVJxCMWdRX78 23Ik6QslidLZgje5oIs2LwpTQEUWZPPDHdRV0vlYjQjrPcg2p/Oyta6eBjHRluohhq4Y J+ldJ8zIyCa4+5BTCLbYmh87c0f5xiipwVvgoHDCjGcFdUoWkFb3skcHA7FwL51dtaod MFVU4NKXoRuNQTaFgryD3Ca2AmIHSo7y7uJ1U/CzPCsPuqx+cKjIaj1m3tXSSpm7FR9h dUm3zffTu2fdaPT4UIjWgjzNEn7AFZpkYYgk9JZTdMqlHzHM+bE/kVDJSAaaxbRFBEyg qNIA== MIME-Version: 1.0 X-Received: by 10.107.12.70 with SMTP id w67mr74604186ioi.10.1426527729625; Mon, 16 Mar 2015 10:42:09 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Mon, 16 Mar 2015 10:42:09 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 10:42:09 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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 17:42:10 -0000 Hello, > I cleaned some things up in the sdpd and pushed to github, also added > a simple example here: > > https://github.com/waitman/hid_sppd again, i does not look correct to me. please read all my previous emails. i assume you are trying to implement device side, i.e. your freebsd machine is going to act as hid device of some sort. am i correct? > if anyone is looking to run HID host services on their FreeBSD > machine, it's maybe a starting point. it would be, but it needs to be fixed first :) > ALSO, I don't see "Service Name" in the output of sdpcontrol.. is this > as intended? did you provide service name attribute? > and i don't see sdpcontrol listing the channel (if using rfcomm) or > PSM (hid). Maybe it's not so important. again, did you provide those attributes? rfcomm has nothing to do with bluetooth hid. bluetooth hid runs over l2cap. in fact it uses two l2cap psm: one for control channel and other for data (aka interrupt). bluetooth hid is modeled after usb hid, i.e. l2cap control channel is effectively usb control transfer, and, l2cap interrupt channel is effectively usb interrupt transfer. the rest, i.e. hid device descriptor, etc. etc. (that, again, comes from usb world) has to be provided (by device) via appropriate sdp attributes. thanks max From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 18:12:34 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 116C82CA for ; Mon, 16 Mar 2015 18:12:34 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (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 941A9BF8 for ; Mon, 16 Mar 2015 18:12:33 +0000 (UTC) Received: by wgdm6 with SMTP id m6so46759485wgd.2 for ; Mon, 16 Mar 2015 11:12: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 :cc:content-type; bh=eF2J+c3l69bSg6TUsNaQEcvbb1RQfLu1x3P+Ve18S/g=; b=z9Os4WB972FDs+Z2pfvuSEXbrhYjzSOU6oBvikUjfGX/o6Wwj5EJSWsQrUPOm50vCx IbI5NkctAwacYwuX3smRJhfjxOb+RhczwcgQMscDLk2DpSKCDjtQ/DnmNUHoTDSY22OG Dq4k5UCy2r2pKZWN430sTqT/AChQKJ1ZUaoUtncPOD0wZdJALe9+CUQ5z9wAgtF0MnYV Ek/f4fgUTtruyHe7rlRiepAxArjlEr1o0fKqqGY7pYAq5iHNeyjtgx5c566Xb5VcIkp7 Ma1j3uh3UFw5CWZaqQIRrkNK+39yXPFFyBkgvHnVx/6aHs8dewRDmKayk19WD6bnvJCL 2aWA== MIME-Version: 1.0 X-Received: by 10.180.23.106 with SMTP id l10mr57172868wif.54.1426529552103; Mon, 16 Mar 2015 11:12:32 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Mon, 16 Mar 2015 11:12:32 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 11:12:32 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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 18:12:34 -0000 On Mon, Mar 16, 2015 at 10:42 AM, Maksim Yevmenkin wrote: > Hello, > >> I cleaned some things up in the sdpd and pushed to github, also added >> a simple example here: >> >> https://github.com/waitman/hid_sppd > > again, i does not look correct to me. please read all my previous > emails. i assume you are trying to implement device side, i.e. your > freebsd machine is going to act as hid device of some sort. am i > correct? > >> if anyone is looking to run HID host services on their FreeBSD >> machine, it's maybe a starting point. > > it would be, but it needs to be fixed first :) > >> ALSO, I don't see "Service Name" in the output of sdpcontrol.. is this >> as intended? > > did you provide service name attribute? > >> and i don't see sdpcontrol listing the channel (if using rfcomm) or >> PSM (hid). Maybe it's not so important. > > again, did you provide those attributes? rfcomm has nothing to do with > bluetooth hid. bluetooth hid runs over l2cap. in fact it uses two > l2cap psm: one for control channel and other for data (aka interrupt). > bluetooth hid is modeled after usb hid, i.e. l2cap control channel is > effectively usb control transfer, and, l2cap interrupt channel is > effectively usb interrupt transfer. > > the rest, i.e. hid device descriptor, etc. etc. (that, again, comes > from usb world) has to be provided (by device) via appropriate sdp > attributes. > > thanks > max Hi, Thanks for your replies and helpful information. I think I did pull out the rfcomm protocol in hid.c, and advertise l2cap. But it's obviously not 100% working.. basically what I need to do is have my FreeBSD box announce that it's a keyboard, then send strings from the box such as "012345" that appear on the client as if they were typed. Thank you, -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 18:53:46 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 C610D2D3 for ; Mon, 16 Mar 2015 18:53:46 +0000 (UTC) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) (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 866D4170 for ; Mon, 16 Mar 2015 18:53:46 +0000 (UTC) Received: by ieclw3 with SMTP id lw3so179568474iec.2 for ; Mon, 16 Mar 2015 11:53:46 -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 :cc:content-type; bh=vUp6iSh6Do7zIlJY4khcLFDX9nNUgznzW7jIlvoIfPE=; b=IvfikdUQuKbxfnaFAMUckM+Afd9CYTXYum3520Rermu5iBii1aEZMPQhE+4ix6H4Ud q39LE8lLl+DLUniG6m0jDPERU+hGCzrkAZ4BJUna8W9FmJV3mmzgDwUO1B+zGGXh/sW+ gsXYwlWeQjQQJMVL+TokEqZq+LTzq7Ng2RHsumzSsQCQgbAGiycC4Q1fkThm0uDlGMp1 f7Wh36RbbZIUOVlAZdikJz3mMtIZ6Wlq4vQ97BsXib7xvLdZrE/ZB2B34Hm3D1YcoTRu MkbJ3UvGHb+AdfJV+TE8A/n6Xusm+tIa+fet8xW2XAIZP22QdPUHaFs4X0IJMwcK2jS+ cdiw== MIME-Version: 1.0 X-Received: by 10.42.52.209 with SMTP id k17mr7324214icg.11.1426532026061; Mon, 16 Mar 2015 11:53:46 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Mon, 16 Mar 2015 11:53:46 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 11:53:46 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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 18:53:47 -0000 Hello! > Thanks for your replies and helpful information. I think I did pull > out the rfcomm protocol in hid.c, and advertise l2cap. But it's > obviously not 100% working.. > > basically what I need to do is have my FreeBSD box announce that it's > a keyboard, then send strings from the box such as "012345" that > appear on the client as if they were typed. thank you for the clarification. in this case, you need to construct sdp record as per bluetooth hid spec. if my reading of the spec if correct, you need to provide the following mandatory attributes 1) Service Class ID List 0x0001 2) Protocol Descriptor List 0x0004 3) LanguageBaseAttributeIDL 0x0006 4) AdditionalProtocolDescriptorList 0x000d 5) BluetoothProfile DescriptorList 0x0009 6) HIDParserVersion 0x0201 7) HIDDeviceSubclass 0x0202 8) HIDCountryCode 0x0203 9) HIDVirtualCable 0x0204 10) HIDReconnectInitiate 0x0205 11) HIDDescriptorList 0x0206 12) HIDLANGIDBaseList 0x0207 13) HIDBootDevice 0x020e there are others (optional) attributes as well. i might missed some, so, please, double check the spec. to "pretend" to be a keyboard, you will need to generate hid descriptor for your virtual keyboard. you can use one of the tools available for download, or, just use hid descriptor of a real usb keyboard. that hid descriptor needs to go into a sdp record as well (thus it has to be a parameter). PSMs for control and interrupt channel go into the protocol descriptor list and additional protocol descriptor list, so, those are parameters too. hid device subclass and hid country code are parameters too. so, basically, i hope you got the idea by now. once you construct the proper sdp record, your virtual keyboard should be "visible" and "usable" from the remote host. to send keystrokes, you simply need to construct and send hid reports (in the format described by hid descriptor). one hid report in one l2cap packet. bthidd(8) can be used as reference to see what happens on host side. you basically need to send something that bthidd(8) will understand. i hope it makes sense. if not, please feel free to ask. thanks max > > Thank you, > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 19:24:33 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2CF91D01 for ; Mon, 16 Mar 2015 19:24:33 +0000 (UTC) Received: from mail-wg0-x22b.google.com (mail-wg0-x22b.google.com [IPv6:2a00:1450:400c:c00::22b]) (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 A94146C5 for ; Mon, 16 Mar 2015 19:24:32 +0000 (UTC) Received: by wgra20 with SMTP id a20so48225958wgr.3 for ; Mon, 16 Mar 2015 12:24:31 -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 :cc:content-type; bh=3L62vwIvzgpNs0u8kUqaQsHXON+yTpLxv+vEemS3opQ=; b=AiVdH9Fz5Jef4PtZ15Bxrv1yvUNezbTDBjpqfs8axi1kimK8hzxDISVR0Ee+KqRAQN f+mGjqeBqdl4XbBfF3azAZrW/JS/3Ueu3DxmMXNAE3M6KbhM/fjv3X7P2v2SUeSs/koq P/sGr/A1PPyVWeBj41iz1RbtKyeeQfr0XNOljpqYE4tEQmnNri5Z6OUrl8eUbfCMN347 IY3IgYqf3HnJSajO6hJl1V24NQw44N4s5gZgJeFGuOInHr3SVTDt173wX1Me2RauV+Nu 8DJKQOi/lUt4JAjxXVhC5UWGNg3wnD44LfbS/ur3YMw6df1c6pIRS4RPqsiv3BppN39o owZw== MIME-Version: 1.0 X-Received: by 10.195.12.97 with SMTP id ep1mr128156002wjd.134.1426533871121; Mon, 16 Mar 2015 12:24:31 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Mon, 16 Mar 2015 12:24:31 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Mon, 16 Mar 2015 12:24:31 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 12:24:31 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: freebsd-bluetooth@freebsd.org 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 19:24:33 -0000 On Mar 16, 2015 11:53 AM, "Maksim Yevmenkin" wrote: > > Hello! > > > > Thanks for your replies and helpful information. I think I did pull > > out the rfcomm protocol in hid.c, and advertise l2cap. But it's > > obviously not 100% working.. > > > > basically what I need to do is have my FreeBSD box announce that it's > > a keyboard, then send strings from the box such as "012345" that > > appear on the client as if they were typed. > > thank you for the clarification. in this case, you need to construct > sdp record as per bluetooth hid spec. if my reading of the spec if > correct, you need to provide the following mandatory attributes > > 1) Service Class ID List 0x0001 > 2) Protocol Descriptor List 0x0004 > 3) LanguageBaseAttributeIDL 0x0006 > 4) AdditionalProtocolDescriptorList 0x000d > 5) BluetoothProfile DescriptorList 0x0009 > 6) HIDParserVersion 0x0201 > 7) HIDDeviceSubclass 0x0202 > 8) HIDCountryCode 0x0203 > 9) HIDVirtualCable 0x0204 > 10) HIDReconnectInitiate 0x0205 > 11) HIDDescriptorList 0x0206 > 12) HIDLANGIDBaseList 0x0207 > 13) HIDBootDevice 0x020e > > there are others (optional) attributes as well. i might missed some, > so, please, double check the spec. > > to "pretend" to be a keyboard, you will need to generate hid > descriptor for your virtual keyboard. you can use one of the tools > available for download, or, just use hid descriptor of a real usb > keyboard. that hid descriptor needs to go into a sdp record as well > (thus it has to be a parameter). PSMs for control and interrupt > channel go into the protocol descriptor list and additional protocol > descriptor list, so, those are parameters too. hid device subclass and > hid country code are parameters too. so, basically, i hope you got > the idea by now. > > once you construct the proper sdp record, your virtual keyboard should > be "visible" and "usable" from the remote host. to send keystrokes, > you simply need to construct and send hid reports (in the format > described by hid descriptor). one hid report in one l2cap packet. > > bthidd(8) can be used as reference to see what happens on host side. > you basically need to send something that bthidd(8) will understand. > > i hope it makes sense. if not, please feel free to ask. > > thanks > max > > > > > > > Thank you, > > > > -- > > Waitman Gobble > > Los Altos California USA > > 510-830-7975 Thanks, that helps alot. I am also working on my other issue, the bluetooth stack not starting. The example in the manual shows the same vendor CSR but product 0x0001, I believe all my bt devices are 0x0002. It seems that the bluetooth stack will fail if it does not identify the device.. so I'm tracking down where to add it.. this device is actually functioning even without the bluetooth stack starting. Thanks, Waitman From owner-freebsd-bluetooth@FreeBSD.ORG Mon Mar 16 20:41:16 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E16E2C4E for ; Mon, 16 Mar 2015 20:41:16 +0000 (UTC) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (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 A1B5E8E for ; Mon, 16 Mar 2015 20:41:16 +0000 (UTC) Received: by pabyw6 with SMTP id yw6so75131992pab.2 for ; Mon, 16 Mar 2015 13:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=o/Hy0nHKIo5nhODKFn/l1SMHRCMmcLnrdVKmBcPHcDQ=; b=RVnaFTbOhfyMnXZmJT8TkM5yZCBqU2ddD9G6RK+jSkmbEpfqXFY+WXhfHZnOiZGD2p jf5phtDufyMXt3m0IEHFA6/TDRddyFZUlBtJ/X1gy8+72R8m4Z0XDfQ0CBrTqgo8EdGV owDfi5hECA3/9VyaG/QgWBqNRqALpM2+gcTFVAfmq+pUL0nTdGv6pm37eJKAZ/YSi7FE 48w0UD1IKBWDSFhPrB+Wmk51a8XUUJOEz/4+zyr2XIKHk3jVPoO+QeKEQskXuLn8j5G+ 0Lp1ss9wCO77YsJCFNk8NLsM13p6zJ4ngMgqMMhExGxPNLzkuyLVmt7pqzPbFMJJrggr XsKQ== X-Received: by 10.66.63.106 with SMTP id f10mr141944667pas.0.1426538476197; Mon, 16 Mar 2015 13:41:16 -0700 (PDT) Received: from [10.71.137.194] ([128.177.161.177]) by mx.google.com with ESMTPSA id nj5sm18742661pdb.24.2015.03.16.13.41.15 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Mar 2015 13:41:15 -0700 (PDT) References: Mime-Version: 1.0 (1.0) In-Reply-To: Message-Id: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> X-Mailer: iPhone Mail (12D508) From: maksim yevmenkin Subject: Re: register HID with SDP error Date: Mon, 16 Mar 2015 13:41:13 -0700 To: Waitman Gobble Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-bluetooth@freebsd.org" 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 20:41:17 -0000 > Thanks, that helps alot. >=20 > I am also working on my other issue, the bluetooth stack not starting. The= example in the manual shows the same vendor CSR but product 0x0001, I belie= ve all my bt devices are 0x0002. It seems that the bluetooth stack will fail= if it does not identify the device.. so I'm tracking down where to add it..= this device is actually functioning even without the bluetooth stack starti= ng. >=20 Device vendor and product id pair should not matter too much. The driver mak= es the match based on usb interface class and subclass. If device is fully c= onfirms to the spec then it usually just works.=20 Some devices (Atheros and Broadcom for example) may require some sort of fir= mware download. I've also seen all sort of weirdness in devices usually requ= iring special driver or shim.=20 In most cases, if ng_ubt(4) driver attaches to the device, then it should wo= rk. If yo get usb transfer errors then I would suspect usb. I've seen this b= efore. Also what version of FreeBSD are you running this on ? Thanks Max= From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 06:34:30 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 850F3466 for ; Tue, 17 Mar 2015 06:34:30 +0000 (UTC) Received: from mail-wg0-x236.google.com (mail-wg0-x236.google.com [IPv6:2a00:1450:400c:c00::236]) (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 21A9B892 for ; Tue, 17 Mar 2015 06:34:30 +0000 (UTC) Received: by wggv3 with SMTP id v3so371445wgg.1 for ; Mon, 16 Mar 2015 23:34:28 -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 :cc:content-type; bh=VSh+yTfSnTOIl49Ac7zmWCCrHzXGKk11gpShduR0MDA=; b=vfRBkyqdzSxAXPznKowhfYQCGmeXQckA7gl2FaTl45Ipg641ZzLxfkE0qm9MZ1gZmT MkmZuPQ5T43IjknvK3TmpdjBGfqy0fXqjRoVA/H/hpY9VW+Tra5f8Q+3mwOuKGdIUwfx cWbIWG2tOT7sdEG++pGtK/7PHVWkijHdxYV3QnBCMVuP5HxvBzhXKCUNb54kyonD6iLE ZBdwvjz+SWywH5ylKDOR2DHBE76115kWVXWjuY/lDqyaJCfyLoLTne8SilwT04ByC9YI dzmIW0g9IFmG7ANskc8/wf97Nuc/PnsEy0CWt9FZQtk1/e1ALg0nm85AudnQMy74sVcv HgZQ== MIME-Version: 1.0 X-Received: by 10.194.237.34 with SMTP id uz2mr127019698wjc.157.1426574068270; Mon, 16 Mar 2015 23:34:28 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Mon, 16 Mar 2015 23:34:28 -0700 (PDT) In-Reply-To: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Mon, 16 Mar 2015 23:34:28 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: maksim yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 06:34:30 -0000 On Mon, Mar 16, 2015 at 1:41 PM, maksim yevmenkin wrote: > > Thanks, that helps alot. > > I am also working on my other issue, the bluetooth stack not starting. The > example in the manual shows the same vendor CSR but product 0x0001, I > believe all my bt devices are 0x0002. It seems that the bluetooth stack will > fail if it does not identify the device.. so I'm tracking down where to add > it.. this device is actually functioning even without the bluetooth stack > starting. > > > Device vendor and product id pair should not matter too much. The driver > makes the match based on usb interface class and subclass. If device is > fully confirms to the spec then it usually just works. > > Some devices (Atheros and Broadcom for example) may require some sort of > firmware download. I've also seen all sort of weirdness in devices usually > requiring special driver or shim. > > In most cases, if ng_ubt(4) driver attaches to the device, then it should > work. If yo get usb transfer errors then I would suspect usb. I've seen this > before. Also what version of FreeBSD are you running this on ? > > Thanks > Max I reviewed the HID_SPEC_V11 PDF and think i'm getting closer. not yet sure about 11 & 12 11) HIDDescriptorList 0x0206 12) HIDLANGIDBaseList 0x0207 I think 12 is a list of available character encodings I can't seem to find examples of people using several of the 'mandatory' attributes. I'm not yet certain if i wrote hid_profile_create_additional_protocol_descriptor_list correctly, it looks like it's the same list as the protocol descriptor list, except one level deeper nesting and I think this is supposed to have reference to the interrupt PSM. At the moment i'm presuming it's the control channel + 2 -- but I seem to remember seeing an example dump that shows "Protocol specific parameter #2" with the interrupt channel. I'll check it out tomorrow. https://github.com/waitman/sdpd/blob/master/hid.c ./sdpcontrol -l search HID Record Handle: 0x00000002 Service Class ID List: Human Interface Device (0x1124) Protocol Descriptor List: L2CAP (0x0100) Protocol specific parameter #1: u/int/uuid16 17 HIDP (0x0011) Bluetooth Profile Descriptor List: Human Interface Device (0x1124) ver. 1.0 system -> # uname -a FreeBSD afia.waitman.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279971M: Mon Mar 16 14:03:44 PDT 2015 waitman@afia.waitman.net:/usr/obj/usr/src/sys/AFIA amd64 The bt device appears to work properly, except I have no /dev/ubt0 and get errors if I try to start the 'bluetooth' service. ubt0: on usbus0 WARNING: attempt to domain_add(netgraph) after domainfinalize() # service bluetooth start ubt0 /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0 I changed sdpcontrol a bit for a little more debugging help https://github.com/waitman/sdpcontrol The changes are not that great but /slightly/ more messages in syslog. Thanks alot for your help. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 07:26:41 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 325DF9A8 for ; Tue, 17 Mar 2015 07:26:41 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:c:538::198]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B411D5B for ; Tue, 17 Mar 2015 07:26:40 +0000 (UTC) Received: from mfilter40-d.gandi.net (mfilter40-d.gandi.net [217.70.178.171]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id 1E882FB89F; Tue, 17 Mar 2015 08:26:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter40-d.gandi.net Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by mfilter40-d.gandi.net (mfilter40-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id M-ffMXCkBe65; Tue, 17 Mar 2015 08:26:36 +0100 (CET) X-Originating-IP: 31.68.1.52 Received: from galant.ogmig.net (unknown [31.68.1.52]) (Authenticated sender: plunky@ogmig.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 4E4EDFB8A4; Tue, 17 Mar 2015 08:26:29 +0100 (CET) Received: by galant.ogmig.net (Postfix, from userid 1000) id 981D92600C6; Tue, 17 Mar 2015 07:26:24 +0000 (GMT) Date: Tue, 17 Mar 2015 07:26:24 +0000 (GMT) From: Iain Hibbert To: Waitman Gobble Subject: Re: register HID with SDP error In-Reply-To: Message-ID: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> User-Agent: Alpine 2.11 (NEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 07:26:41 -0000 On Mon, 16 Mar 2015, Waitman Gobble wrote: > I reviewed the HID_SPEC_V11 PDF and think i'm getting closer. > not yet sure about 11 & 12 > > 11) HIDDescriptorList 0x0206 this is effectively the HID Descriptor, as per a USB keyboard, should be something like seq seq uint8 0x22 str8 "the descriptor itself" where 0x22 means a Report > 12) HIDLANGIDBaseList 0x0207 This should be something like seq seq uint16 0x0409 uint16 0x0100 where 0x0409 translates as "English (US)" and 0x0100 is the offset of the default language attributes, from LanguageBaseAttributeIDList both of these allow multiple versions, which is why they are wrapped in a sequence > I can't seem to find examples of people using several of the > 'mandatory' attributes. using the NetBSD sdpquery(1) program, from my Apple wireless keyboard (the old white one), I get: ServiceRecordHandle: 0x00010000 ServiceClassIDList: Human Interface Device ProtocolDescriptorList: L2CAP (PSM 0x0011) HIDP BrowseGroupList: Public Browse Root LanguageBaseAttributeIDList: en.UTF-8 base 0x0100 BluetoothProfileDescriptorList: Human Interface Device, v1.0 AdditionalProtocolDescriptorLists: L2CAP (PSM 0x0013) HIDP ServiceName: "Apple Wireless Keyboard" ServiceDescription: "Apple Wireless Keyboard" ProviderName: "Apple Computer, Inc." HIDDeviceReleaseNumber: v1.1.0 HIDParserVersion: v1.1.1 HIDDeviceSubClass: Peripheral HIDCountryCode: 0x0d HIDVirtualCable: true HIDReconnectInitiate: true HIDDescriptorList: Type 0x22: Report Data 0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01 0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05 0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff 0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00 0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00 0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06 0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02 0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04 0x81 0x01 0xc0 HIDLANGIDBaseList: English (US) base 0x0100 HIDSDPDisable: false HIDRemoteWake: true HIDProfileVersion: v1.0 HIDSupervisionTimeout: 8000 HIDNormallyConnectable: true HIDBootDevice: true which, in 'raw' form is: AttributeID 0x0000: uint32 0x00010000 AttributeID 0x0001: seq8(3) uuid16 0x1124 AttributeID 0x0004: seq8(13) seq8(6) uuid16 0x0100 uint16 0x0011 seq8(3) uuid16 0x0011 AttributeID 0x0005: seq8(3) uuid16 0x1002 AttributeID 0x0006: seq8(9) uint16 0x656e uint16 0x006a uint16 0x0100 AttributeID 0x0009: seq8(8) seq8(6) uuid16 0x1124 uint16 0x0100 AttributeID 0x000d: seq8(15) seq8(13) seq8(6) uuid16 0x0100 uint16 0x0013 seq8(3) uuid16 0x0011 AttributeID 0x0100: str8(23) "Apple Wireless Keyboard" AttributeID 0x0101: str8(23) "Apple Wireless Keyboard" AttributeID 0x0102: str8(20) "Apple Computer, Inc." AttributeID 0x0200: uint16 0x0110 AttributeID 0x0201: uint16 0x0111 AttributeID 0x0202: uint8 0x40 AttributeID 0x0203: uint8 0x0d AttributeID 0x0204: bool true AttributeID 0x0205: bool true AttributeID 0x0206: seq8(105) seq8(103) uint8 0x22 str8(99) "\^E\^A \^F\M-!\^A\M^E\^A\^E\a\^Y\M-`)\M-g\^U\0 ... AttributeID 0x0207: seq8(8) seq8(6) uint16 0x0409 uint16 0x0100 AttributeID 0x0208: bool false AttributeID 0x020a: bool true AttributeID 0x020b: uint16 0x0100 AttributeID 0x020c: uint16 0x1f40 AttributeID 0x020d: bool true AttributeID 0x020e: bool true and the plain hex values: AttributeID 0x0000: 0x0a 0x00 0x01 0x00 0x00 AttributeID 0x0001: 0x35 0x03 0x19 0x11 0x24 AttributeID 0x0004: 0x35 0x0d 0x35 0x06 0x19 0x01 0x00 0x09 0x00 0x11 0x35 0x03 0x19 0x00 0x11 AttributeID 0x0005: 0x35 0x03 0x19 0x10 0x02 AttributeID 0x0006: 0x35 0x09 0x09 0x65 0x6e 0x09 0x00 0x6a 0x09 0x01 0x00 AttributeID 0x0009: 0x35 0x08 0x35 0x06 0x19 0x11 0x24 0x09 0x01 0x00 AttributeID 0x000d: 0x35 0x0f 0x35 0x0d 0x35 0x06 0x19 0x01 0x00 0x09 0x00 0x13 0x35 0x03 0x19 0x00 0x11 AttributeID 0x0100: 0x25 0x17 0x41 0x70 0x70 0x6c 0x65 0x20 0x57 0x69 0x72 0x65 0x6c 0x65 0x73 0x73 0x20 0x4b 0x65 0x79 0x62 0x6f 0x61 0x72 0x64 AttributeID 0x0101: 0x25 0x17 0x41 0x70 0x70 0x6c 0x65 0x20 0x57 0x69 0x72 0x65 0x6c 0x65 0x73 0x73 0x20 0x4b 0x65 0x79 0x62 0x6f 0x61 0x72 0x64 AttributeID 0x0102: 0x25 0x14 0x41 0x70 0x70 0x6c 0x65 0x20 0x43 0x6f 0x6d 0x70 0x75 0x74 0x65 0x72 0x2c 0x20 0x49 0x6e 0x63 0x2e AttributeID 0x0200: 0x09 0x01 0x10 AttributeID 0x0201: 0x09 0x01 0x11 AttributeID 0x0202: 0x08 0x40 AttributeID 0x0203: 0x08 0x0d AttributeID 0x0204: 0x28 0x01 AttributeID 0x0205: 0x28 0x01 AttributeID 0x0206: 0x35 0x69 0x35 0x67 0x08 0x22 0x25 0x63 0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01 0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05 0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff 0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00 0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00 0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06 0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02 0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04 0x81 0x01 0xc0 AttributeID 0x0207: 0x35 0x08 0x35 0x06 0x09 0x04 0x09 0x09 0x01 0x00 AttributeID 0x0208: 0x28 0x00 AttributeID 0x020a: 0x28 0x01 AttributeID 0x020b: 0x09 0x01 0x00 AttributeID 0x020c: 0x09 0x1f 0x40 AttributeID 0x020d: 0x28 0x01 AttributeID 0x020e: 0x28 0x01 the HID descriptor decodes as follows: (in the style of bthidcontrol) Collection page=Generic_Desktop usage=Keyboard Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftControl Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftShift Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftAlt Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Left_GUI Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightControl Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightShift Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightAlt Variable, logical range 0..1 Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Right_GUI Variable, logical range 0..1 Input id=1 size=8 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Num_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Caps_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Scroll_Lock Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Compose Variable, logical range 0..1 Output id=1 size=1 count=1 page=LEDs usage=Kana Variable, logical range 0..1 Output id=1 size=3 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 Input id=1 size=8 count=6 page=Keyboard usage=No_Event, logical range 0..255 Input id=1 size=1 count=1 page=Consumer usage=Eject Variable Relative, logical range 0..1 Input id=1 size=1 count=1 page=Consumer usage=Mute Variable Relative, logical range 0..1 Input id=1 size=1 count=1 page=Consumer usage=Volume_Up Variable, logical range 0..1 Input id=1 size=1 count=1 page=Consumer usage=Volume_Down Variable, logical range 0..1 Input id=1 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 End collection or, in a more raw format: 05 01 Global:Usage Page (1) 09 06 Local:Usage (6) a1 01 Main:Collection(Application) 85 01 Global:Report ID (1) 05 07 Global:Usage Page (7) 19 e0 Local:Usage Minimum (-32) 29 e7 Local:Usage Maximum (-25) 15 00 Global:Logical Minimum (0) 25 01 Global:Logical Maximum (1) 75 01 Global:Report Size (1) 95 08 Global:Report Count (8) 81 02 Main:Input(Variable) 75 08 Global:Report Size (8) 95 01 Global:Report Count (1) 81 01 Main:Input(Constant) 75 01 Global:Report Size (1) 95 05 Global:Report Count (5) 05 08 Global:Usage Page (8) 19 01 Local:Usage Minimum (1) 29 05 Local:Usage Maximum (5) 91 02 Main:Output(Variable) 75 03 Global:Report Size (3) 95 01 Global:Report Count (1) 91 01 Main:Output(Constant) 75 08 Global:Report Size (8) 95 06 Global:Report Count (6) 15 00 Global:Logical Minimum (0) 26 ff 00 Global:Logical Maximum (255) 05 07 Global:Usage Page (7) 19 00 Local:Usage Minimum (0) 2a ff 00 Local:Usage Maximum (255) 81 00 Main:Input() 75 01 Global:Report Size (1) 95 01 Global:Report Count (1) 15 00 Global:Logical Minimum (0) 25 01 Global:Logical Maximum (1) 05 0c Global:Usage Page (12) 09 b8 Local:Usage (-72) 81 06 Main:Input(Variable, Relative) 09 e2 Local:Usage (-30) 81 06 Main:Input(Variable, Relative) 09 e9 Local:Usage (-23) 81 02 Main:Input(Variable) 09 ea Local:Usage (-22) 81 02 Main:Input(Variable) 75 01 Global:Report Size (1) 95 04 Global:Report Count (4) 81 01 Main:Input(Constant) c0 Main:End Collection regards, iain From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 14:26:33 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 56778799 for ; Tue, 17 Mar 2015 14:26:33 +0000 (UTC) Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [IPv6:2a00:1450:400c:c00::229]) (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 CCF1B63B for ; Tue, 17 Mar 2015 14:26:32 +0000 (UTC) Received: by wgra20 with SMTP id a20so9911574wgr.3 for ; Tue, 17 Mar 2015 07:26:30 -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 :cc:content-type; bh=4veih8zxsTDVtDP5abiQYWiqud8/PkSgJJARikh+ZAs=; b=xWRoM71TekRpDGFM1Bcyi6u0zVSi03Hp9M3wzRGAtIqAgSpKgwu0DJviF6Pn0pZKHf rpRS/ED8gsni1CYJtvW0ceDSR/YSYG9FJOyG5YFcdodvsatYezt+CLc28cz6p6Y3FtRm zrsbKxqc1h6/gyYMssMnpGUaENtu19odG9xmisCUbPDp6Ft4WtnxZ8sG9OA6ARMCKNmz JzdeMj+WaLTG4ieyG8C4w3fNLBNf8s3N95qQpx4K5xYNqAe6wlyEGaDOsUzAB0Md0m+o dS+LWa5b674N60/SQhdxE/knB7TGBZE6bc2Wdo2ml1vBOK7PY294SJePdcS9CrP9WwO8 u7cA== MIME-Version: 1.0 X-Received: by 10.194.237.34 with SMTP id uz2mr130493067wjc.157.1426602390843; Tue, 17 Mar 2015 07:26:30 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Tue, 17 Mar 2015 07:26:30 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 07:26:30 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Iain Hibbert Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 14:26:33 -0000 On Tue, Mar 17, 2015 at 12:26 AM, Iain Hibbert wrote: > On Mon, 16 Mar 2015, Waitman Gobble wrote: > >> I reviewed the HID_SPEC_V11 PDF and think i'm getting closer. >> not yet sure about 11 & 12 >> >> 11) HIDDescriptorList 0x0206 > > this is effectively the HID Descriptor, as per a USB keyboard, should be > something like > > seq > seq > uint8 0x22 > str8 "the descriptor itself" > > where 0x22 means a Report > >> 12) HIDLANGIDBaseList 0x0207 > > This should be something like > > seq > seq > uint16 0x0409 > uint16 0x0100 > > where 0x0409 translates as "English (US)" and 0x0100 is the offset of the > default language attributes, from LanguageBaseAttributeIDList > > both of these allow multiple versions, which is why they are wrapped in a > sequence > >> I can't seem to find examples of people using several of the >> 'mandatory' attributes. > > using the NetBSD sdpquery(1) program, from my Apple wireless keyboard (the > old white one), I get: > > ServiceRecordHandle: 0x00010000 > ServiceClassIDList: > Human Interface Device > ProtocolDescriptorList: > L2CAP (PSM 0x0011) > HIDP > BrowseGroupList: > Public Browse Root > LanguageBaseAttributeIDList: > en.UTF-8 base 0x0100 > BluetoothProfileDescriptorList: > Human Interface Device, v1.0 > AdditionalProtocolDescriptorLists: > L2CAP (PSM 0x0013) > HIDP > ServiceName: "Apple Wireless Keyboard" > ServiceDescription: "Apple Wireless Keyboard" > ProviderName: "Apple Computer, Inc." > HIDDeviceReleaseNumber: v1.1.0 > HIDParserVersion: v1.1.1 > HIDDeviceSubClass: Peripheral > HIDCountryCode: 0x0d > HIDVirtualCable: true > HIDReconnectInitiate: true > HIDDescriptorList: > Type 0x22: Report > Data 0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 > 0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00 > 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 > 0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01 > 0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05 > 0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01 > 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff > 0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00 > 0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00 > 0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06 > 0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02 > 0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04 > 0x81 0x01 0xc0 > HIDLANGIDBaseList: > English (US) base 0x0100 > HIDSDPDisable: false > HIDRemoteWake: true > HIDProfileVersion: v1.0 > HIDSupervisionTimeout: 8000 > HIDNormallyConnectable: true > HIDBootDevice: true > > which, in 'raw' form is: > > AttributeID 0x0000: > uint32 0x00010000 > AttributeID 0x0001: > seq8(3) > uuid16 0x1124 > AttributeID 0x0004: > seq8(13) > seq8(6) > uuid16 0x0100 > uint16 0x0011 > seq8(3) > uuid16 0x0011 > AttributeID 0x0005: > seq8(3) > uuid16 0x1002 > AttributeID 0x0006: > seq8(9) > uint16 0x656e > uint16 0x006a > uint16 0x0100 > AttributeID 0x0009: > seq8(8) > seq8(6) > uuid16 0x1124 > uint16 0x0100 > AttributeID 0x000d: > seq8(15) > seq8(13) > seq8(6) > uuid16 0x0100 > uint16 0x0013 > seq8(3) > uuid16 0x0011 > AttributeID 0x0100: > str8(23) "Apple Wireless Keyboard" > AttributeID 0x0101: > str8(23) "Apple Wireless Keyboard" > AttributeID 0x0102: > str8(20) "Apple Computer, Inc." > AttributeID 0x0200: > uint16 0x0110 > AttributeID 0x0201: > uint16 0x0111 > AttributeID 0x0202: > uint8 0x40 > AttributeID 0x0203: > uint8 0x0d > AttributeID 0x0204: > bool true > AttributeID 0x0205: > bool true > AttributeID 0x0206: > seq8(105) > seq8(103) > uint8 0x22 > str8(99) "\^E\^A \^F\M-!\^A\M^E\^A\^E\a\^Y\M-`)\M-g\^U\0 ... > AttributeID 0x0207: > seq8(8) > seq8(6) > uint16 0x0409 > uint16 0x0100 > AttributeID 0x0208: > bool false > AttributeID 0x020a: > bool true > AttributeID 0x020b: > uint16 0x0100 > AttributeID 0x020c: > uint16 0x1f40 > AttributeID 0x020d: > bool true > AttributeID 0x020e: > bool true > > and the plain hex values: > > AttributeID 0x0000: > 0x0a 0x00 0x01 0x00 0x00 > AttributeID 0x0001: > 0x35 0x03 0x19 0x11 0x24 > AttributeID 0x0004: > 0x35 0x0d 0x35 0x06 0x19 0x01 0x00 0x09 > 0x00 0x11 0x35 0x03 0x19 0x00 0x11 > AttributeID 0x0005: > 0x35 0x03 0x19 0x10 0x02 > AttributeID 0x0006: > 0x35 0x09 0x09 0x65 0x6e 0x09 0x00 0x6a > 0x09 0x01 0x00 > AttributeID 0x0009: > 0x35 0x08 0x35 0x06 0x19 0x11 0x24 0x09 > 0x01 0x00 > AttributeID 0x000d: > 0x35 0x0f 0x35 0x0d 0x35 0x06 0x19 0x01 > 0x00 0x09 0x00 0x13 0x35 0x03 0x19 0x00 > 0x11 > AttributeID 0x0100: > 0x25 0x17 0x41 0x70 0x70 0x6c 0x65 0x20 > 0x57 0x69 0x72 0x65 0x6c 0x65 0x73 0x73 > 0x20 0x4b 0x65 0x79 0x62 0x6f 0x61 0x72 > 0x64 > AttributeID 0x0101: > 0x25 0x17 0x41 0x70 0x70 0x6c 0x65 0x20 > 0x57 0x69 0x72 0x65 0x6c 0x65 0x73 0x73 > 0x20 0x4b 0x65 0x79 0x62 0x6f 0x61 0x72 > 0x64 > AttributeID 0x0102: > 0x25 0x14 0x41 0x70 0x70 0x6c 0x65 0x20 > 0x43 0x6f 0x6d 0x70 0x75 0x74 0x65 0x72 > 0x2c 0x20 0x49 0x6e 0x63 0x2e > AttributeID 0x0200: > 0x09 0x01 0x10 > AttributeID 0x0201: > 0x09 0x01 0x11 > AttributeID 0x0202: > 0x08 0x40 > AttributeID 0x0203: > 0x08 0x0d > AttributeID 0x0204: > 0x28 0x01 > AttributeID 0x0205: > 0x28 0x01 > AttributeID 0x0206: > 0x35 0x69 0x35 0x67 0x08 0x22 0x25 0x63 > 0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 > 0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00 > 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 > 0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01 > 0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05 > 0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01 > 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff > 0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00 > 0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00 > 0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06 > 0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02 > 0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04 > 0x81 0x01 0xc0 > AttributeID 0x0207: > 0x35 0x08 0x35 0x06 0x09 0x04 0x09 0x09 > 0x01 0x00 > AttributeID 0x0208: > 0x28 0x00 > AttributeID 0x020a: > 0x28 0x01 > AttributeID 0x020b: > 0x09 0x01 0x00 > AttributeID 0x020c: > 0x09 0x1f 0x40 > AttributeID 0x020d: > 0x28 0x01 > AttributeID 0x020e: > 0x28 0x01 > > the HID descriptor decodes as follows: (in the style of bthidcontrol) > > Collection page=Generic_Desktop usage=Keyboard > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftControl Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftShift Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftAlt Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Left_GUI Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightControl Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightShift Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_RightAlt Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Keyboard usage=Keyboard_Right_GUI Variable, logical range 0..1 > Input id=1 size=8 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 > Output id=1 size=1 count=1 page=LEDs usage=Num_Lock Variable, logical range 0..1 > Output id=1 size=1 count=1 page=LEDs usage=Caps_Lock Variable, logical range 0..1 > Output id=1 size=1 count=1 page=LEDs usage=Scroll_Lock Variable, logical range 0..1 > Output id=1 size=1 count=1 page=LEDs usage=Compose Variable, logical range 0..1 > Output id=1 size=1 count=1 page=LEDs usage=Kana Variable, logical range 0..1 > Output id=1 size=3 count=1 page=0x0000 usage=0x0000 Const, logical range 0..1 > Input id=1 size=8 count=6 page=Keyboard usage=No_Event, logical range 0..255 > Input id=1 size=1 count=1 page=Consumer usage=Eject Variable Relative, logical range 0..1 > Input id=1 size=1 count=1 page=Consumer usage=Mute Variable Relative, logical range 0..1 > Input id=1 size=1 count=1 page=Consumer usage=Volume_Up Variable, logical range 0..1 > Input id=1 size=1 count=1 page=Consumer usage=Volume_Down Variable, logical range 0..1 > Input id=1 size=1 count=4 page=0x0000 usage=0x0000 Const, logical range 0..1 > End collection > > or, in a more raw format: > > 05 01 Global:Usage Page (1) > 09 06 Local:Usage (6) > a1 01 Main:Collection(Application) > 85 01 Global:Report ID (1) > 05 07 Global:Usage Page (7) > 19 e0 Local:Usage Minimum (-32) > 29 e7 Local:Usage Maximum (-25) > 15 00 Global:Logical Minimum (0) > 25 01 Global:Logical Maximum (1) > 75 01 Global:Report Size (1) > 95 08 Global:Report Count (8) > 81 02 Main:Input(Variable) > 75 08 Global:Report Size (8) > 95 01 Global:Report Count (1) > 81 01 Main:Input(Constant) > 75 01 Global:Report Size (1) > 95 05 Global:Report Count (5) > 05 08 Global:Usage Page (8) > 19 01 Local:Usage Minimum (1) > 29 05 Local:Usage Maximum (5) > 91 02 Main:Output(Variable) > 75 03 Global:Report Size (3) > 95 01 Global:Report Count (1) > 91 01 Main:Output(Constant) > 75 08 Global:Report Size (8) > 95 06 Global:Report Count (6) > 15 00 Global:Logical Minimum (0) > 26 ff 00 Global:Logical Maximum (255) > 05 07 Global:Usage Page (7) > 19 00 Local:Usage Minimum (0) > 2a ff 00 Local:Usage Maximum (255) > 81 00 Main:Input() > 75 01 Global:Report Size (1) > 95 01 Global:Report Count (1) > 15 00 Global:Logical Minimum (0) > 25 01 Global:Logical Maximum (1) > 05 0c Global:Usage Page (12) > 09 b8 Local:Usage (-72) > 81 06 Main:Input(Variable, Relative) > 09 e2 Local:Usage (-30) > 81 06 Main:Input(Variable, Relative) > 09 e9 Local:Usage (-23) > 81 02 Main:Input(Variable) > 09 ea Local:Usage (-22) > 81 02 Main:Input(Variable) > 75 01 Global:Report Size (1) > 95 04 Global:Report Count (4) > 81 01 Main:Input(Constant) > c0 Main:End Collection > > > regards, > iain Thanks, that's very helpful. I added the 0x0206 and 0x0207 but NOW i see i didn't do it correctly based on your information. btw i tried running 'bluetoothctl' on a machine running mainline Linux kernel with 'hcidump' running on the FreeBSD machine, kinda looks like a good way to find issues/debug. I don't yet see how to query from FreeBSD so that it's 'parsing' the sdp records. # bluetoothctl [bluetooth]# list Controller 00:10:60:AF:5B:AF eshe [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:10:60:AF:5B:AF Discovering: yes [NEW] Device 00:1B:DC:06:94:D3 00-1B-DC-06-94-D3 [CHG] Device 00:1B:DC:06:94:D3 RSSI: -61 [CHG] Device 00:1B:DC:06:94:D3 LegacyPairing: no [CHG] Device 00:1B:DC:06:94:D3 Name: afia.waitman.net (ubt0) [CHG] Device 00:1B:DC:06:94:D3 Alias: afia.waitman.net (ubt0) [CHG] Device 00:1B:DC:06:94:D3 LegacyPairing: yes [CHG] Device 00:1B:DC:06:94:D3 RSSI: -52 [bluetooth]# connect 00:1B:DC:06:94:D3 Attempting to connect to 00:1B:DC:06:94:D3 [CHG] Device 00:1B:DC:06:94:D3 Connected: yes [CHG] Device 00:1B:DC:06:94:D3 UUIDs: 00001000-0000-1000-8000-00805f9b34fb 00001001-0000-1000-8000-00805f9b34fb 00001124-0000-1000-8000-00805f9b34fb Failed to connect: org.bluez.Error.Failed [CHG] Device 00:1B:DC:06:94:D3 RSSI: -51 [bluetooth]# pairable on Changing pairable on succeeded [bluetooth]# pair 00:1B:DC:06:94:D3 Attempting to pair with 00:1B:DC:06:94:D3 Failed to pair: org.bluez.Error.AuthenticationFailed hcidump log https://gist.github.com/waitman/c3f8a3bc9b046e36dbb5 it's showing me the 0x0206 is incorrect, but now i think realize how it should be structured based on your information. Thank you. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 16:29:30 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A0AA9E0 for ; Tue, 17 Mar 2015 16:29:30 +0000 (UTC) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (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 CC71A650 for ; Tue, 17 Mar 2015 16:29:29 +0000 (UTC) Received: by igbue6 with SMTP id ue6so17272188igb.1 for ; Tue, 17 Mar 2015 09:29:29 -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 :cc:content-type; bh=MFaYMCxMt3medVMSigna0gUZQOme7wekdu/b2lL74NM=; b=xDJcZk85B/ohYwubRezhCvDnUZdcxcSmBTrO9hpQvdIlkzBJLcV9vPtLSmoSc+nd3X h9D05kWMJs8gCF/WNcBxrzPkcOwAQbyT0XHuGk0QyXgl6TJk4uum+j3EQstNPXqo49l4 HQeUuMQp5ahHJ54N8YiJtATPY8OIehZoVyPnQPckVlGCVxlIk2I3XaTNljvdRb8wkJkC SkMBHHCp1pajXp8JNYUsb3nkEtnWuTcQBq1MzQPDc8E0JWNAKzCb+dop7nx6XNAb5UEF C4Xrn+a2A2UHXtXNmHc7Oz4AFlM/3jlOqVvrLdq37X6orTqxGi+hQX2TSPORfwmda3Z7 869A== MIME-Version: 1.0 X-Received: by 10.107.6.212 with SMTP id f81mr117178187ioi.37.1426609769223; Tue, 17 Mar 2015 09:29:29 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Tue, 17 Mar 2015 09:29:29 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 09:29:29 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 16:29:30 -0000 Hello, > I reviewed the HID_SPEC_V11 PDF and think i'm getting closer. > not yet sure about 11 & 12 > > 11) HIDDescriptorList 0x0206 please take a look at section "5.3.4.7 HIDDescriptorList". this is basically usb hid descriptor (so might be a good idea to have usb hid spec handy too). also, and i quote "...The HIDDescriptorList is a data element sequence..." > 12) HIDLANGIDBaseList 0x0207 > > I think 12 is a list of available character encodings > I can't seem to find examples of people using several of the > 'mandatory' attributes. section "5.3.4.8 HIDLANGIDBaseList" :) again this is related to usb :) > I'm not yet certain if i wrote > hid_profile_create_additional_protocol_descriptor_list correctly, it > looks like it's the same list as the protocol descriptor list, except > one level deeper nesting and I think this is supposed to have > reference to the interrupt PSM. At the moment i'm presuming it's the > control channel + 2 -- but I seem to remember seeing an example dump > that shows "Protocol specific parameter #2" with the interrupt > channel. I'll check it out tomorrow. i see Iain already has given you enough details. Thanks Iain!! thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 16:33:26 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D71A5A42 for ; Tue, 17 Mar 2015 16:33:26 +0000 (UTC) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) (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 92FA9769 for ; Tue, 17 Mar 2015 16:33:26 +0000 (UTC) Received: by ieclw3 with SMTP id lw3so14968850iec.2 for ; Tue, 17 Mar 2015 09:33:26 -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 :cc:content-type; bh=fcC3x7/IpsMImfmkhsTb3K7+QX9xUUbJvStOr7UDa2Q=; b=Q7j4tqEg+d9u0sGCa49adtCqHOZ7B1UbO8PXwYv+PTLt4QYUWgSPmWc+CBXsUjq08f /IftTklW71xp1Jy/UDAIMhKYfan0HCFkh2NfCawK9hsELugraeTZqam6bJfSbsCAj//T 0t4IuVkjKAT5Kc8OtLTgv1XI4nisnpDpgpdvYWk7iSd4a8tGbHY+IGTGTsjnRIN2/jT+ QtFsOG3hLAD901LFpYVZeqhY/RrFGAjOjYOLGj2GNHleETC0Y0LHKahPxMoemS6QkSPe t3uoqqBBc1h89XnOCPUZuZsK/NoVT/N4zbgZn8yMjmN/kfz17YzjO5o3pLoupExJRE8l aGKA== MIME-Version: 1.0 X-Received: by 10.50.107.36 with SMTP id gz4mr121226866igb.25.1426610005949; Tue, 17 Mar 2015 09:33:25 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Tue, 17 Mar 2015 09:33:25 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 09:33:25 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Tue, 17 Mar 2015 16:33:26 -0000 > Thanks, that's very helpful. I added the 0x0206 and 0x0207 but NOW i > see i didn't do it correctly based on your information. > > btw i tried running 'bluetoothctl' on a machine running mainline Linux > kernel with 'hcidump' running on the FreeBSD machine, kinda looks like > a good way to find issues/debug. I don't yet see how to query from > FreeBSD so that it's 'parsing' the sdp records. can't you just use bthidcontrol(8)? the "query" command is what you are looking for. thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 16:52:37 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 386DFD99 for ; Tue, 17 Mar 2015 16:52:37 +0000 (UTC) Received: from mail-wg0-x22a.google.com (mail-wg0-x22a.google.com [IPv6:2a00:1450:400c:c00::22a]) (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 C4732982 for ; Tue, 17 Mar 2015 16:52:36 +0000 (UTC) Received: by wggv3 with SMTP id v3so13520649wgg.1 for ; Tue, 17 Mar 2015 09:52:35 -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 :cc:content-type; bh=c1l8hv8tpqefiYZvSR+nQiBwBBs7Ug1jJ/WDtcjouyY=; b=cTgtOqP9liRGjI4LFOz+GFXAtqEm01TxKj2ZN9E7EDG84YSHm/TGKt/kGQ7+Ocjf54 /k+0GlYwBzVA2iqP/voBmVMH3qh3Iwpeg/2XOuY90MFihp62hKaH7PcDNAqsM36hUHfy 3rVonjC8wsbRP5ekPGshTqP67W3HswNxX1QjUTlkSUSIP174DlbE31hCLEd2hJHId8g4 tyumCjlqPeKc5dssTJWldiQNL5tdTl2hsl5SPD4/VlOFp/HI9j5KkjYQdl6tBUNn5Hsb GoxtP8FoUeluemIQApcTa7UkZ2bdqFncHVRi1vI4gtaVrgwQ1iml4cG802cMeLQqzrGH n3cw== MIME-Version: 1.0 X-Received: by 10.194.75.168 with SMTP id d8mr136293172wjw.87.1426611154992; Tue, 17 Mar 2015 09:52:34 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Tue, 17 Mar 2015 09:52:34 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 09:52:34 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Tue, 17 Mar 2015 16:52:37 -0000 On Tue, Mar 17, 2015 at 9:33 AM, Maksim Yevmenkin wrote: >> Thanks, that's very helpful. I added the 0x0206 and 0x0207 but NOW i >> see i didn't do it correctly based on your information. >> >> btw i tried running 'bluetoothctl' on a machine running mainline Linux >> kernel with 'hcidump' running on the FreeBSD machine, kinda looks like >> a good way to find issues/debug. I don't yet see how to query from >> FreeBSD so that it's 'parsing' the sdp records. > > can't you just use bthidcontrol(8)? the "query" command is what you > are looking for. > > thanks, > max Thanks for the tip, I'll check it out. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 18:20:48 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4055CF8B for ; Tue, 17 Mar 2015 18:20:48 +0000 (UTC) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:c:538::197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5E2D320 for ; Tue, 17 Mar 2015 18:20:47 +0000 (UTC) Received: from mfilter37-d.gandi.net (mfilter37-d.gandi.net [217.70.178.168]) by relay5-d.mail.gandi.net (Postfix) with ESMTP id E458F41C07E; Tue, 17 Mar 2015 19:20:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter37-d.gandi.net Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by mfilter37-d.gandi.net (mfilter37-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id QvsmnQDpBjj8; Tue, 17 Mar 2015 19:20:43 +0100 (CET) X-Originating-IP: 31.68.1.52 Received: from galant.ogmig.net (unknown [31.68.1.52]) (Authenticated sender: plunky@ogmig.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id CAA1441C05A; Tue, 17 Mar 2015 19:20:41 +0100 (CET) Received: by galant.ogmig.net (Postfix, from userid 1000) id 1903A2600C6; Tue, 17 Mar 2015 18:20:37 +0000 (GMT) Date: Tue, 17 Mar 2015 18:20:36 +0000 (GMT) From: Iain Hibbert To: Waitman Gobble Subject: Re: register HID with SDP error In-Reply-To: Message-ID: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> User-Agent: Alpine 2.11 (NEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 18:20:48 -0000 On Tue, 17 Mar 2015, Waitman Gobble wrote: > hcidump log https://gist.github.com/waitman/c3f8a3bc9b046e36dbb5 Kind of unrelatedly, from that log, the Linux machine requests a search for Protocol UUID 0x0100 (L2CAP) but gets nothing in return.. > ACL data: handle 0x0048 flags 0x02 dlen 24 L2CAP(d): cid 0x44 len 20 [psm 1] SDP SSA Req: tid 0x0 len 0xf pat uuid-16 0x0100 (L2CAP) max 0xffff aid(s) 0x0000 - 0xffff cont 00 < ACL data: handle 0x0048 flags 0x02 dlen 15 L2CAP(d): cid 0x40 len 11 [psm 1] SDP SSA Rsp: tid 0x0 len 0x6 cnt 0x3 cont 00 ..does the SDP server not return results for that, Max? Then, more pertinently the unexpected syntax is probably an artifact of your modifications, as hcidump should be able to parse anything legal. can you save the binary dump next time? (hcidump -w ) you can look at it with "hcidump -r " but it might help to be able to examine the hex values, in the case where an unexpected syntax occurs.. btw .. if you use sdpcontrol(1) to query the local SDP server (see -l) then hcidump will not see anything of the interchange, since it does not go through the Bluetooth stack. regards, iain From owner-freebsd-bluetooth@FreeBSD.ORG Tue Mar 17 18:33:24 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0141B2EB for ; Tue, 17 Mar 2015 18:33:23 +0000 (UTC) Received: from mail-ie0-x234.google.com (mail-ie0-x234.google.com [IPv6:2607:f8b0:4001:c03::234]) (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 B06A76BC for ; Tue, 17 Mar 2015 18:33:23 +0000 (UTC) Received: by iecvj10 with SMTP id vj10so18993073iec.0 for ; Tue, 17 Mar 2015 11:33:23 -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 :cc:content-type; bh=zi9j8w+jOe/O8455J2E7mLxmrC7hAOQ1sLgl62VhzsM=; b=DmrbaXmIBpaNyI7O8LDgp9IZ7Qx5vsYwvtBlVkMyeLP9QWjVarc5vEI+QJUfxJlipa DoeobiSBgQ1KsiOwokq9ofhQlcE5m59OV/Qwu/8FfKNmH6Fwfg29KDTDMY+BjydTkR0w 8a4JDDUhEraWGGVWIXAeOaLm8zsbuUBauQM0gY/JJuVOtPzEYwoXXMGEwHO4SrR5IPma FkbZXQv1eML8xf72ES9mxtx12nVQ4Q9ilqbVmjTdnngdYiprZA58gQiP886CP4C7k3lc KZCUwt/xt9PBeSmMwHvd986POy4KCmOjHwj+XU3ZRSkkoAPPrnokAt0a8PPcNkB3bleV 2VOA== MIME-Version: 1.0 X-Received: by 10.50.56.82 with SMTP id y18mr177648igp.25.1426617203127; Tue, 17 Mar 2015 11:33:23 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Tue, 17 Mar 2015 11:33:23 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 11:33:23 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Iain Hibbert Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" 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: Tue, 17 Mar 2015 18:33:24 -0000 On Tue, Mar 17, 2015 at 11:20 AM, Iain Hibbert wrote: > On Tue, 17 Mar 2015, Waitman Gobble wrote: > >> hcidump log https://gist.github.com/waitman/c3f8a3bc9b046e36dbb5 > > Kind of unrelatedly, from that log, the Linux machine requests a search > for Protocol UUID 0x0100 (L2CAP) but gets nothing in return.. > >> ACL data: handle 0x0048 flags 0x02 dlen 24 > L2CAP(d): cid 0x44 len 20 [psm 1] > SDP SSA Req: tid 0x0 len 0xf > pat uuid-16 0x0100 (L2CAP) > max 0xffff > aid(s) 0x0000 - 0xffff > cont 00 > < ACL data: handle 0x0048 flags 0x02 dlen 15 > L2CAP(d): cid 0x40 len 11 [psm 1] > SDP SSA Rsp: tid 0x0 len 0x6 > cnt 0x3 > cont 00 > > ..does the SDP server not return results for that, Max? well, i don't think i ever got around to adding a feature that looks for uuid inside records. it currently only matches service class uuid's. so, yes, query for l2cap uuid will return nothing currently. its trivial to add this though. i think i even have a patch somewhere. [...] > btw .. if you use sdpcontrol(1) to query the local SDP server (see -l) > then hcidump will not see anything of the interchange, since it does not > go through the Bluetooth stack. absolutely correct thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 02:22:04 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B1413111 for ; Wed, 18 Mar 2015 02:22:04 +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 3A329617 for ; Wed, 18 Mar 2015 02:22:04 +0000 (UTC) Received: by webcq43 with SMTP id cq43so21299292web.2 for ; Tue, 17 Mar 2015 19:22:01 -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 :cc:content-type; bh=fxiPqLRnwHtA1UeP1pgHEz2UvRyCoPXe4rQVzUVNjI4=; b=bctquSMuYW3q/b0fHp5ieo/+hoJpFP5ZNKrEZ2JcyLFTST/hnzSGLv+ltIXLgrOxHW dYNf5eo94Hih5NM7J28pGPmBRywhtBdQgQW/fI2XLIQ5nFnuGYT4ObKJf1EI3dPxq4vr rXi/ZGU5NCrwbz3IJd4JWPl4nbuhtV1fI0CfV0ylBn02oKO+8ZLmQL7ZB/C+LiK46l/S L3VeoqI3BV2D3AFm1GUPLFsAcjnZY1+/fK2KfTFvkWOGfYhVGhiRjaRmI8fiTY3oIYyW Rxm/RzSMEDmMzLQa3Mq5ZeOAlcvVhGE7sVA/yo4ZdZLecQ5NnYgCIiw/ft+UFCJXyWm1 peKg== MIME-Version: 1.0 X-Received: by 10.194.75.168 with SMTP id d8mr139793079wjw.87.1426645321891; Tue, 17 Mar 2015 19:22:01 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Tue, 17 Mar 2015 19:22:01 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 19:22:01 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 02:22:04 -0000 On Tue, Mar 17, 2015 at 9:33 AM, Maksim Yevmenkin wrote: >> Thanks, that's very helpful. I added the 0x0206 and 0x0207 but NOW i >> see i didn't do it correctly based on your information. >> >> btw i tried running 'bluetoothctl' on a machine running mainline Linux >> kernel with 'hcidump' running on the FreeBSD machine, kinda looks like >> a good way to find issues/debug. I don't yet see how to query from >> FreeBSD so that it's 'parsing' the sdp records. > > can't you just use bthidcontrol(8)? the "query" command is what you > are looking for. > > thanks, > max Yes, bthidcontrol does work, thank you Max, that really helps. Debugging has been a great deal of trouble for me without seeing this information. scan from r277133 machine https://gist.github.com/waitman/d08c2a027479137c2a3a dump (r279971M machine) https://gist.github.com/waitman/c5cc2c9a75eefcf9231a still more items to I'm still troubled by the bluetooth errors though.. I wish I could solve that problem. This device reports mfg 0x0a12 product 0x0001 (well idProduct is 0x0001, iProduct is 0x0002?) on a laptop running r275492, I cannot get bluetooth to work at all with any of the CSR devices I have on hand. (apparently all bt devices at the local electronics store are CSR based. I bought every V1, 2, 3, 4 device they had on the shelf ) here's log from that r275492 machine. https://gist.github.com/waitman/d5659088f572f431b20b Yes that laptop it is past due for a system rebuild... about 5k commits back. I can order some bt dongles online with an aim to get various chipsets, which I should probably do anyway to experiment. BUT, i'm curious mostly because the example in the FreeBSD manual page actually shows the 0x0a12 0x0001 device as working. :) I don't think these devices require firmware, they seem to work fine (without bluetooth stack 'running') with the work I've been doing so far on two machines, just not the laptop. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 02:59:39 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 3CE36787 for ; Wed, 18 Mar 2015 02:59:39 +0000 (UTC) Received: from mail-we0-x22e.google.com (mail-we0-x22e.google.com [IPv6:2a00:1450:400c:c03::22e]) (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 B78889AF for ; Wed, 18 Mar 2015 02:59:38 +0000 (UTC) Received: by weop45 with SMTP id p45so21755134weo.0 for ; Tue, 17 Mar 2015 19:59:37 -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 :cc:content-type; bh=lR/NdNOw8YSgLJpjifnG/3rG5DXFbLBoEZahX2s6XF8=; b=qlHhZ4YsEDmz0J8Heqyw6FwI8x+y8MyEiEDo/r2JThTF+uxRYuOjACFG+7IiSAMc1I Cb0OOTrl2dafMV9QS2P7RiSbaTZZiX0BcyX4S069I3HCSsktVH/eYi5geRKnApQYAluc TK0Q7RDoiQwmgpWJS8eFuZgi4IW6lJ4LxfCuhwollF0USfyN2fYTDHdkzP9MzGZjEi1w ICs2VZZoHGELpGsQmnKfg/ATK1SN4N0/fMkHDe+xp8SqPSkdrwpbW/Qae0IlsK4/nJG/ sYNMMxfwYkpwgzfgkl1Tf7uGo6zdiJdr1yfF1IunZfeYjXbswgfRHLQE5ldJTjf26BoR 5zwQ== MIME-Version: 1.0 X-Received: by 10.195.12.35 with SMTP id en3mr133076392wjd.129.1426647577190; Tue, 17 Mar 2015 19:59:37 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Tue, 17 Mar 2015 19:59:37 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Tue, 17 Mar 2015 19:59:37 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 02:59:39 -0000 On Tue, Mar 17, 2015 at 7:22 PM, Waitman Gobble wrote: > On Tue, Mar 17, 2015 at 9:33 AM, Maksim Yevmenkin > wrote: >>> Thanks, that's very helpful. I added the 0x0206 and 0x0207 but NOW i >>> see i didn't do it correctly based on your information. >>> >>> btw i tried running 'bluetoothctl' on a machine running mainline Linux >>> kernel with 'hcidump' running on the FreeBSD machine, kinda looks like >>> a good way to find issues/debug. I don't yet see how to query from >>> FreeBSD so that it's 'parsing' the sdp records. >> >> can't you just use bthidcontrol(8)? the "query" command is what you >> are looking for. >> >> thanks, >> max > > > Yes, bthidcontrol does work, thank you Max, that really helps. > Debugging has been a great deal of trouble for me without seeing this > information. > > scan from r277133 machine > https://gist.github.com/waitman/d08c2a027479137c2a3a > > dump (r279971M machine) > https://gist.github.com/waitman/c5cc2c9a75eefcf9231a > > still more items to > > I'm still troubled by the bluetooth errors though.. I wish I could > solve that problem. This device reports mfg 0x0a12 product 0x0001 > (well idProduct is 0x0001, iProduct is 0x0002?) > > on a laptop running r275492, I cannot get bluetooth to work at all > with any of the CSR devices I have on hand. (apparently all bt devices > at the local electronics store are CSR based. I bought every V1, 2, 3, > 4 device they had on the shelf ) > > here's log from that r275492 machine. > https://gist.github.com/waitman/d5659088f572f431b20b > > Yes that laptop it is past due for a system rebuild... about 5k commits back. > > I can order some bt dongles online with an aim to get various > chipsets, which I should probably do anyway to experiment. BUT, i'm > curious mostly because the example in the FreeBSD manual page actually > shows the 0x0a12 0x0001 device as working. :) > I don't think these devices require firmware, they seem to work fine > (without bluetooth stack 'running') with the work I've been doing so > far on two machines, just not the laptop. > > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 I think I'm getting close, I finally have a good scan with bthidcontrol Note that bthidcontrol doesn't seem to connect after sdpd is restarted on the server, unless I do sdpcontrol browse first. #sdpcontrol -a 00:1b:dc:06:94:d3 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) Protocol Descriptor List: L2CAP (0x0100) Protocol specific parameter #1: u/int/uuid16 17 HIDP (0x0011) Bluetooth Profile Descriptor List: Human Interface Device (0x1124) ver. 1.0 # bthidcontrol -a 00:1b:dc:06:94:d3 query device { bdaddr 00:1b:dc:06:94:d3; control_psm 0x11; interrupt_psm 0x13; reconnect_initiate false; battery_power false; normally_connectable false; hid_descriptor { 0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01 0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00 0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02 0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01 0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05 0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01 0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff 0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00 0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00 0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06 0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02 0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04 0x81 0x01 0xc0 }; } latest version at https://github.com/waitman/sdpd/blob/master/hid.c I didn't see a "bool(8)" defined in sdp.h, I was thinking maybe it was the same as UINT8 but then I noticed Iain's post that showed a 'bool(8)' as 0x28 instead of 0x08, thank you. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 03:22:53 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D955FEA0 for ; Wed, 18 Mar 2015 03:22:53 +0000 (UTC) Received: from mail-pd0-x230.google.com (mail-pd0-x230.google.com [IPv6:2607:f8b0:400e:c02::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 975D1DCE for ; Wed, 18 Mar 2015 03:22:53 +0000 (UTC) Received: by pdnc3 with SMTP id c3so29099701pdn.0 for ; Tue, 17 Mar 2015 20:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=DMrSP4s9FkymTI9hYFzE0N0l4bSEDxUngCscsVhKxDg=; b=ylDIVWMGNQ3w8ddPG9D3wcMrpZLAku8mp3RECASS5n8UQAlU+kxYBfW3xURSZyq3FS I/C1AfqyzC58GbLYTBYrlJ2+6b/6j3BLvCQFUaYqBKHlb4Cz022ZyshjXHi53pTtXEsP q9Q65kRIBTEVc74oUC55asCUaU5DzU7TIkhBB+V65kF1yLQtNlw6s8UqTc3l+Zd2K4nL Otarr5MPf0WIKxMq1WHSCmukc6+t9+pPBdv5R1Rh8lz9m393iH/pdV1FJOgDcAMD58wB ohePpMC7HhTFH7TZ+nxLqtxiWwqOwGuaBTCSfNpv7o/4UHGjg+8fD9C4hPTf2uKktmud jdWg== X-Received: by 10.70.94.101 with SMTP id db5mr1656069pdb.62.1426648972848; Tue, 17 Mar 2015 20:22:52 -0700 (PDT) Received: from [10.1.10.41] (c-67-170-236-210.hsd1.ca.comcast.net. [67.170.236.210]) by mx.google.com with ESMTPSA id pi2sm24728928pdb.47.2015.03.17.20.22.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Mar 2015 20:22:52 -0700 (PDT) References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <1AF1A5DD-44EC-4A76-AB1E-236ED2DC622B@gmail.com> X-Mailer: iPad Mail (12D508) From: Maksim Yevmenkin Subject: Re: register HID with SDP error Date: Tue, 17 Mar 2015 20:22:51 -0700 To: Waitman Gobble Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 03:22:53 -0000 > I'm still troubled by the bluetooth errors though.. I wish I could > solve that problem. This device reports mfg 0x0a12 product 0x0001 > (well idProduct is 0x0001, iProduct is 0x0002?) >=20 Hmmm.... I think I might have an idea. Do you run /etc/rc.d/bluetooth by han= d by any chance ? If so, can you please do not do it? Basically /etc/rc.d/Bl= uetooth is run from devd.conf currently. Devd responds to ubt device arrival= by calling start on /etc/rc.d/Bluetooth. Similarly when ubt device departs d= evd will call stop on /etc/rc.d/Bluetooth. When you call start on /etc/rc.d/Bluetooth on already setup stack, you might= get errors. So either try not calling start by hand, or, try to call resta= rt. Restart will tear down struck and then set it up from scratch.=20 Thanks Max From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 17:06:47 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 956352C8 for ; Wed, 18 Mar 2015 17:06:47 +0000 (UTC) Received: from mail-ig0-x236.google.com (mail-ig0-x236.google.com [IPv6:2607:f8b0:4001:c05::236]) (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 4E8749AB for ; Wed, 18 Mar 2015 17:06:47 +0000 (UTC) Received: by ignm3 with SMTP id m3so77088582ign.0 for ; Wed, 18 Mar 2015 10:06:46 -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 :cc:content-type; bh=WtZ6+HyRm8vvyW7+DwnBGMbwjf3mj9W10cMH6/tq7lc=; b=KDrGVSWoy2kGPD/VD8Qfo5TzmEuQtnY3vD3mlgW2XW0pCAUi31M6W1sqwVt1myCm5V hYI4NQkoAyxy4XgybRBctCTkWCFhTobguhzRbyd+/Ort854edl30VcHroffD3i3tQnDI MLRJXACiXFRIG+jpwkHEd7xNAsrLVtTsMBfJJ9RxuTZOdZHL3+i650u6FOA63auaHlGW //W5NXmQoAhxJasrLgghyn/y5vzmAHQ2XF3kpW3sZL+OhLVToq2HPXOKIm8LWXEgBSU8 7uR8rekGr6vCLiC2AIYPFK+uOCOJ7+f50ZeQlPC/+RFZM1z33qs1lD7NtV/MJtcRcOe4 oXEg== MIME-Version: 1.0 X-Received: by 10.50.32.70 with SMTP id g6mr8679233igi.35.1426698406725; Wed, 18 Mar 2015 10:06:46 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Wed, 18 Mar 2015 10:06:46 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Wed, 18 Mar 2015 10:06:46 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 17:06:47 -0000 Hello, [...] > I think I'm getting close, I finally have a good scan with bthidcontrol > > Note that bthidcontrol doesn't seem to connect after sdpd is restarted > on the server, unless I do sdpcontrol browse first. hmm... i'm sorry, i do not follow. both bthidcontrol(8) and sdpcontrol(8) are using exactly the same way to obtain sdp records. it should not make any difference. > #sdpcontrol -a 00:1b:dc:06:94:d3 browse [...] > # bthidcontrol -a 00:1b:dc:06:94:d3 query [...] this looks better to me. > latest version at https://github.com/waitman/sdpd/blob/master/hid.c thanks! i will take a look. few minor nits: attribute list must be sorted. when generating protocol descriptor list and additional protocol descriptor list, you may re-use one function, i.e. additional protocol descriptor list is just a protocol descriptor list wrapped into a sequence. you hardwired lots of hid related things. while its ok for testing, i feel like it should be moved to parameters so clients can set those up as needed. > I didn't see a "bool(8)" defined in sdp.h, I was thinking maybe it was > the same as UINT8 but then I noticed Iain's post that showed a > 'bool(8)' as 0x28 instead of 0x08, thank you. huh? from /usr/include/sdp.h /* Unsigned integer */ #define SDP_DATA_UINT8 0x08 /* Boolean */ #define SDP_DATA_BOOL 0x28 thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 18:14:46 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0BDC3DE for ; Wed, 18 Mar 2015 18:14:45 +0000 (UTC) Received: from mail-we0-x235.google.com (mail-we0-x235.google.com [IPv6:2a00:1450:400c:c03::235]) (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 7554826B for ; Wed, 18 Mar 2015 18:14:45 +0000 (UTC) Received: by wegp1 with SMTP id p1so38908635weg.1 for ; Wed, 18 Mar 2015 11:14:44 -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 :cc:content-type; bh=rq8yq7R8jf4BxIuxp8jZ107L8Ad0d3JKr7Z82VIobQU=; b=HL1zAfWzcCbPOoT1wR8Is9TU2j3vY7w/8UWFdbUspI7TsWBn9vPwMsNNzQ7bNFpj4n tAMDAOVZW2uupRafO1Pg655kywbNe7mhBKut+kxrK1fJ2j2/bkXYb0W1U4c9wyiO6Wf4 zaN2vpICW4j++MwdIzG4PzcLTuvTcqxvcCRIz0iGhy653YyB2iAJ64lXglNAFSK/eTgQ x5Ie34wJ53j1yOB6ZmsJWPJ8VJg8DpbXByGKh+m3wp5ildh1xyIUQqDEJNosd+LG1f/x N9lfTesXKH6hDuF7KGqSJpS/qiVE7hAvMiztOUcxQV0ztpeuUklnK+8FJ5lxj0V1vMGq wO+g== MIME-Version: 1.0 X-Received: by 10.195.12.97 with SMTP id ep1mr147415559wjd.134.1426702483953; Wed, 18 Mar 2015 11:14:43 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Wed, 18 Mar 2015 11:14:43 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Wed, 18 Mar 2015 11:14:43 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 18:14:46 -0000 On Wed, Mar 18, 2015 at 10:06 AM, Maksim Yevmenkin wrote: > Hello, > > [...] > >> I think I'm getting close, I finally have a good scan with bthidcontrol >> >> Note that bthidcontrol doesn't seem to connect after sdpd is restarted >> on the server, unless I do sdpcontrol browse first. > > hmm... i'm sorry, i do not follow. both bthidcontrol(8) and > sdpcontrol(8) are using exactly the same way to obtain sdp records. it > should not make any difference. > > >> #sdpcontrol -a 00:1b:dc:06:94:d3 browse > > [...] > >> # bthidcontrol -a 00:1b:dc:06:94:d3 query > > [...] > > this looks better to me. > >> latest version at https://github.com/waitman/sdpd/blob/master/hid.c > > thanks! i will take a look. few minor nits: attribute list must be > sorted. when generating protocol descriptor list and additional > protocol descriptor list, you may re-use one function, i.e. additional > protocol descriptor list is just a protocol descriptor list wrapped > into a sequence. you hardwired lots of hid related things. while its > ok for testing, i feel like it should be moved to parameters so > clients can set those up as needed. > >> I didn't see a "bool(8)" defined in sdp.h, I was thinking maybe it was >> the same as UINT8 but then I noticed Iain's post that showed a >> 'bool(8)' as 0x28 instead of 0x08, thank you. > > huh? from /usr/include/sdp.h > > /* Unsigned integer */ > #define SDP_DATA_UINT8 0x08 > > /* Boolean */ > #define SDP_DATA_BOOL 0x28 > > thanks, > max Max, I'm wrong on both accounts, I'm not sure why I missed the 0x28 definition before and I'm also not sure why yesterday it seemed that bthidcontrol was not connecting without first doing spdcontrol. But it's working today. Sorry about my mistake. I'm working on the hid code. It opens the l2cap control and interrupt sockets then waits for client connect. When the client connects it sends the key codes. very simply, struct sockaddr_l2cap l2addr, cli_addr; controlsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); bind(controlsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); intrsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); bind(intrsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); clilen = sizeof(cli_addr); newsockfd = accept(controlsock, (struct sockaddr *) &cli_addr, &clilen); //blocks until client connect then loop while reading chars from FIFO: evkeyb->btcode = 0xA1; evkeyb->rep_id = REPORTID_KEYBD; evkeyb->key[0] = retkey(sfifo[i]); //translate to key code send ( newsockfd, evkeyb,sizeof(struct hidrep_keyb_t),MSG_NOSIGNAL ); The client is connecting (seen in btsockstat) # btsockstat Active raw HCI sockets Socket PCB Flags Recv-Q Send-Q Local address fffff8003a505000 fffff8011a6bd180 000003 0 0 * fffff801554418b8 fffff80004765780 000002 0 0 * Active L2CAP sockets PCB Recv-Q Send-Q Local address/PSM Foreign address CID State fffff8000d2d7100 0 0 00:1b:dc:06:94:d3/19 00:10:60:af:5b:af 157 CLOSED fffff8000d0a4600 0 0 00:1b:dc:06:94:d3/17 00:10:60:af:5b:af 156 OPEN fffff8000d2d6000 0 0 * /19 * 0 LISTEN fffff8000d0a7500 0 0 * /17 * 0 LISTEN fffff801a19b8c00 0 0 * /1 * 0 LISTEN # ./hid_sppd control socket created interrupt socket created waiting for connect waiting for fifo.. press Control-C to exit. sent data 38 "key 0" sent data 29 "key 1" sent data 30 "key 2" sent data 31 "key 3" sent data 32 "key 4" ... ...and it's reading the fifo buffer and sending the keys through the clientfd, but nothing useful is happening on client.. So I think I'm either doing this wrong, or my SDP record is still incorrect. Thank you, -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Wed Mar 18 18:48: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 3C5298C0 for ; Wed, 18 Mar 2015 18:48:35 +0000 (UTC) Received: from mail-ig0-x234.google.com (mail-ig0-x234.google.com [IPv6:2607:f8b0:4001:c05::234]) (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 E5D0C80A for ; Wed, 18 Mar 2015 18:48:34 +0000 (UTC) Received: by igcau2 with SMTP id au2so1109582igc.1 for ; Wed, 18 Mar 2015 11:48:34 -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 :cc:content-type; bh=0soVcngmuXuz/ocxBkESybasoPpL1ZKn3nUDL7bdqUQ=; b=ZafSlidprcXf4pmtLEMyHV2L1JtMvTidH9mMOVd3If4hgSQJMbgJUpgUArYyNoXMDq jc8+ywlwN0Ly83e7fuTdZ7qeBMy9LjcNmMgL4N3XvGtuW9idj8cXGQrdXTKXlu9GVrJ/ WUA2Yr5YQMcT5AQXkQW1lagbmWuCENL4P/igffU+/GXQOOCwz9jUXgB0+SznXsCvzo7J QXdAk7xAB0I9JTuRzBOROAzlH0mfk/7UYqDfYHFV7VcysMZ22ZU5yRDdBsbuvNh65pfy nEf67qd3BOYCWmlGHMLIieKmzAgL18/a8yGS516vabFObIndWrK8MA/qSQvPqd1+3c1n z2Gg== MIME-Version: 1.0 X-Received: by 10.107.7.141 with SMTP id g13mr96877400ioi.52.1426704514416; Wed, 18 Mar 2015 11:48:34 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Wed, 18 Mar 2015 11:48:34 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Wed, 18 Mar 2015 11:48:34 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Wed, 18 Mar 2015 18:48:35 -0000 [...] > I'm working on the hid code. It opens the l2cap control and interrupt > sockets then waits for client connect. When the client connects it > sends the key codes. > > very simply, > > struct sockaddr_l2cap l2addr, cli_addr; > > controlsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); > bind(controlsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); > > intrsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); > bind(intrsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); > > > clilen = sizeof(cli_addr); > newsockfd = accept(controlsock, (struct sockaddr *) &cli_addr, > &clilen); //blocks until client connect ok... are you also accepting connection on interrupt channel? please recall, i've mentioned that buetooth hid is modeled after usb hid. there are two channels: control and interrupt. > then loop while reading chars from FIFO: > > evkeyb->btcode = 0xA1; > evkeyb->rep_id = REPORTID_KEYBD; > evkeyb->key[0] = retkey(sfifo[i]); //translate to key code > send ( newsockfd, evkeyb,sizeof(struct hidrep_keyb_t),MSG_NOSIGNAL ); hmm.... i don't think its quite correct. all the hid reports should be sent on the interrupt channel (just like usb hid device uses interrupt transfer endpoint to send its reports back to host). if i'm reading your code correctly, newsockfd is an accepted connection on the control socket. i presume you have constructed correct hid report sequence to send too (as per hid descriptor you have given out to remote host via sdp). [...] > # ./hid_sppd > control socket created > interrupt socket created > waiting for connect > waiting for fifo.. press Control-C to exit. > sent data 38 "key 0" > sent data 29 "key 1" > sent data 30 "key 2" > sent data 31 "key 3" > sent data 32 "key 4" > ... > > ...and it's reading the fifo buffer and sending the keys through the > clientfd, but nothing useful is happening on client.. So I think I'm > either doing this wrong, or my SDP record is still incorrect. well, if remote host has connected then, presumably, it has found everything that it needed from sdp. so, i would guess that your sdp records are probably correct. i suspect that you need to sort out your hid reports format and send them via interrupt channel, not control. you also might want to take a look at USBHID(3), specifically hid_set_data(). you can use bthidd(8) code as an example of what host *might* be doing and how host *might* expect data. in fact, you can probably use bthidd(8) to test your virtual hid device. one thing to keep in mind is the initial "handshake" setup. when hid device is "unknown" to host, host must initiate connection to the device first. later, host must respect value of reconnect_initiate attribute, and, if its set, host must wait for hid device to re-connect. this way, say, keyboard may put itself to sleep, and, wake up and reconnect when user presses a button. thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Thu Mar 19 01:46:43 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 362145EE for ; Thu, 19 Mar 2015 01:46:43 +0000 (UTC) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [IPv6:2a00:1450:400c:c05::22f]) (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 A6322E3A for ; Thu, 19 Mar 2015 01:46:42 +0000 (UTC) Received: by wibdy8 with SMTP id dy8so105115092wib.0 for ; Wed, 18 Mar 2015 18:46:40 -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 :cc:content-type; bh=GziXmn/ek7ubnhti5COuVCkAmwlIKhlU7kxq0Swl2LA=; b=Gcs2vDPeNW0YjYLaEcMwGUqxG+4RBZwcFcx0AUnPAqEDCQ+E/wTNZ/HSE4q8fhGaU9 eEUlvihYUPO/9LdotwNgZcem7BlTWbI5KICxmZyWBjbfBl2leV2Fxrl2CHqc4Qk+Tciz 8cC4YvscgdgGaWr7aq/riQr45RSyLxTCYEtkcydvg//yLGDjae5mETufsJZ8faKGLJZn wULfNHmfbVFsYz2fyTb1MEcpYmSyOJxqs2HSMXSvpSp0o01/AeK5/fJ/diAjbGj5F7n3 uwgI4aRFTME7esDbE38nYQp0VQbeWrwdAcwaLspgUe+eEf9iu7mO437Pof4I/f0Sg/s/ WjIQ== MIME-Version: 1.0 X-Received: by 10.180.76.77 with SMTP id i13mr12244586wiw.6.1426729600176; Wed, 18 Mar 2015 18:46:40 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Wed, 18 Mar 2015 18:46:40 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Wed, 18 Mar 2015 18:46:40 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Thu, 19 Mar 2015 01:46:43 -0000 On Wed, Mar 18, 2015 at 11:48 AM, Maksim Yevmenkin wrote: > [...] > >> I'm working on the hid code. It opens the l2cap control and interrupt >> sockets then waits for client connect. When the client connects it >> sends the key codes. >> >> very simply, >> >> struct sockaddr_l2cap l2addr, cli_addr; >> >> controlsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); >> bind(controlsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); >> >> intrsock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP); >> bind(intrsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); >> >> >> clilen = sizeof(cli_addr); >> newsockfd = accept(controlsock, (struct sockaddr *) &cli_addr, >> &clilen); //blocks until client connect > > ok... are you also accepting connection on interrupt channel? please > recall, i've mentioned that buetooth hid is modeled after usb hid. > there are two channels: control and interrupt. > >> then loop while reading chars from FIFO: >> >> evkeyb->btcode = 0xA1; >> evkeyb->rep_id = REPORTID_KEYBD; >> evkeyb->key[0] = retkey(sfifo[i]); //translate to key code >> send ( newsockfd, evkeyb,sizeof(struct hidrep_keyb_t),MSG_NOSIGNAL ); > > hmm.... i don't think its quite correct. all the hid reports should be > sent on the interrupt channel (just like usb hid device uses interrupt > transfer endpoint to send its reports back to host). if i'm reading > your code correctly, newsockfd is an accepted connection on the > control socket. i presume you have constructed correct hid report > sequence to send too (as per hid descriptor you have given out to > remote host via sdp). > > [...] > >> # ./hid_sppd >> control socket created >> interrupt socket created >> waiting for connect >> waiting for fifo.. press Control-C to exit. >> sent data 38 "key 0" >> sent data 29 "key 1" >> sent data 30 "key 2" >> sent data 31 "key 3" >> sent data 32 "key 4" >> ... >> >> ...and it's reading the fifo buffer and sending the keys through the >> clientfd, but nothing useful is happening on client.. So I think I'm >> either doing this wrong, or my SDP record is still incorrect. > > well, if remote host has connected then, presumably, it has found > everything that it needed from sdp. so, i would guess that your sdp > records are probably correct. i suspect that you need to sort out your > hid reports format and send them via interrupt channel, not control. > you also might want to take a look at USBHID(3), specifically > hid_set_data(). > > you can use bthidd(8) code as an example of what host *might* be doing > and how host *might* expect data. in fact, you can probably use > bthidd(8) to test your virtual hid device. > > one thing to keep in mind is the initial "handshake" setup. when hid > device is "unknown" to host, host must initiate connection to the > device first. later, host must respect value of reconnect_initiate > attribute, and, if its set, host must wait for hid device to > re-connect. this way, say, keyboard may put itself to sleep, and, wake > up and reconnect when user presses a button. > > thanks, > max Thanks Max, that is super great help. Hopefully I can get it straightened out tonight. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Thu Mar 19 04:35:54 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 4746FCC9 for ; Thu, 19 Mar 2015 04:35:54 +0000 (UTC) Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) (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 B953512A for ; Thu, 19 Mar 2015 04:35:53 +0000 (UTC) Received: by wifj2 with SMTP id j2so57839976wif.1 for ; Wed, 18 Mar 2015 21:35:51 -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 :cc:content-type:content-transfer-encoding; bh=k100TS4Z3W4AbE4SbnSZ1TNgc4UTuBSMNzkxle2/ydA=; b=QSdukdgoHu4qTjQiJjWFpcfuK1P17YSN5nb1tYkNTtQBWQQCv5VqejjMPKxmHCEhpa 53PwGfDZZjEEFf7N/xY4CVrTRWISQAWAYwkNUlmNi0LoNobskA3v4TsvqvLSpTlH3ftG s8UK81UIKU/BYL8FbhT752PtveGbvQAZgrPJqye8ErMtnidEpss7/3JmYWToeXpP9sCd EM/yGqSWMCYXN0v++um9cf+Agv/z7yELi8y6uAoHXpPyCnv1JWK6gmJEhqxNqoG/ostv L9HO3ETy29skQ8yKONh0DmPdOyvV/sozXHGmjQs7852I4t77+PB8RLPnCQierzWe7CLg qwSw== MIME-Version: 1.0 X-Received: by 10.194.237.34 with SMTP id uz2mr145438821wjc.157.1426739751558; Wed, 18 Mar 2015 21:35:51 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Wed, 18 Mar 2015 21:35:51 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Wed, 18 Mar 2015 21:35:51 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Thu, 19 Mar 2015 04:35:54 -0000 On Wed, Mar 18, 2015 at 6:46 PM, Waitman Gobble wrote= : > On Wed, Mar 18, 2015 at 11:48 AM, Maksim Yevmenkin > wrote: >> [...] >> >>> I'm working on the hid code. It opens the l2cap control and interrupt >>> sockets then waits for client connect. When the client connects it >>> sends the key codes. >>> >>> very simply, >>> >>> struct sockaddr_l2cap l2addr, cli_addr; >>> >>> controlsock =3D socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2= CAP); >>> bind(controlsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); >>> >>> intrsock =3D socket(AF_BLUETOOTH, SOCK_SEQPACKET, BLUETOOTH_PROTO_L2CAP= ); >>> bind(intrsock, (struct sockaddr *) &l2addr, sizeof(l2addr)); >>> >>> >>> clilen =3D sizeof(cli_addr); >>> newsockfd =3D accept(controlsock, (struct sockaddr *) &cli_addr, >>> &clilen); //blocks until client connect >> >> ok... are you also accepting connection on interrupt channel? please >> recall, i've mentioned that buetooth hid is modeled after usb hid. >> there are two channels: control and interrupt. >> >>> then loop while reading chars from FIFO: >>> >>> evkeyb->btcode =3D 0xA1; >>> evkeyb->rep_id =3D REPORTID_KEYBD; >>> evkeyb->key[0] =3D retkey(sfifo[i]); //translate to key code >>> send ( newsockfd, evkeyb,sizeof(struct hidrep_keyb_t),MSG_NOSIGNAL ); >> >> hmm.... i don't think its quite correct. all the hid reports should be >> sent on the interrupt channel (just like usb hid device uses interrupt >> transfer endpoint to send its reports back to host). if i'm reading >> your code correctly, newsockfd is an accepted connection on the >> control socket. i presume you have constructed correct hid report >> sequence to send too (as per hid descriptor you have given out to >> remote host via sdp). >> >> [...] >> >>> # ./hid_sppd >>> control socket created >>> interrupt socket created >>> waiting for connect >>> waiting for fifo.. press Control-C to exit. >>> sent data 38 "key 0" >>> sent data 29 "key 1" >>> sent data 30 "key 2" >>> sent data 31 "key 3" >>> sent data 32 "key 4" >>> ... >>> >>> ...and it's reading the fifo buffer and sending the keys through the >>> clientfd, but nothing useful is happening on client.. So I think I'm >>> either doing this wrong, or my SDP record is still incorrect. >> >> well, if remote host has connected then, presumably, it has found >> everything that it needed from sdp. so, i would guess that your sdp >> records are probably correct. i suspect that you need to sort out your >> hid reports format and send them via interrupt channel, not control. >> you also might want to take a look at USBHID(3), specifically >> hid_set_data(). >> >> you can use bthidd(8) code as an example of what host *might* be doing >> and how host *might* expect data. in fact, you can probably use >> bthidd(8) to test your virtual hid device. >> >> one thing to keep in mind is the initial "handshake" setup. when hid >> device is "unknown" to host, host must initiate connection to the >> device first. later, host must respect value of reconnect_initiate >> attribute, and, if its set, host must wait for hid device to >> re-connect. this way, say, keyboard may put itself to sleep, and, wake >> up and reconnect when user presses a button. >> >> thanks, >> max > > Thanks Max, that is super great help. Hopefully I can get it > straightened out tonight. > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 maybe getting closer. bthidd connects and opens control and interrupt channels, and i can see data on the interrupt line. # btsockstat Active raw HCI sockets Socket PCB Flags Recv-Q Send-Q Local address fffff8003a505000 fffff8011a6bd180 000003 0 0 * fffff801554418b8 fffff80004765780 000002 0 0 * Active L2CAP sockets PCB Recv-Q Send-Q Local address/PSM Foreign address CID Stat= e fffff80241338a00 3 0 00:1b:dc:06:94:d3/19 00:1b:dc:06:ae:4c 220 OPEN fffff8000d2d8d00 0 0 00:1b:dc:06:94:d3/17 00:1b:dc:06:ae:4c 219 OPEN fffff8000d059c00 0 0 * /19 * 0 LISTEN fffff8000d2d9100 0 0 * /17 * 0 LISTEN fffff8000d0a7b00 0 0 * /1 * 0 LISTEN # ./hid_sppd control socket created interrupt socket created waiting for connect waiting for fifo.. press Control-C to exit. ... send characters to FIFO # echo "ABEF010231" >> /tmp/ain ... sent data 3 sent data 4 sent data 7 sent data 8 sent data 38 sent data 29 sent data 38 sent data 30 sent data 31 sent data 29 this shows up on the client .. simple syslog(LOG_ERR,"%s",data.b); Mar 18 21:23:32 rpidev bthidd[4948]: Opening outbound session for 00:1b:dc:06:94:d3 (new_device=3D0, reconnect_initiate=3D0) Mar 18 21:23:32 rpidev kernel: kbd2 at vkbd16 Mar 18 21:23:35 rpidev bthidd[4948]: Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^C Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^D Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^G Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^H Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^^ Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^_ Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] I'm guessing I'll have to hook up a display to that machine to see if the virtual keyboard device is working right. modified bthidd https://github.com/waitman/bthidd However, from Linux bluedevil client it opens both control and interrupt but closes interrupt # btsockstat Active raw HCI sockets Socket PCB Flags Recv-Q Send-Q Local address fffff8003a505000 fffff8011a6bd180 000003 0 0 * fffff801554418b8 fffff80004765780 000002 0 0 * Active L2CAP sockets PCB Recv-Q Send-Q Local address/PSM Foreign address CID Stat= e fffff8000d05be00 0 0 00:1b:dc:06:94:d3/19 00:10:60:af:5b:af 216 CLOSED fffff8000d0a6c00 0 0 00:1b:dc:06:94:d3/17 00:10:60:af:5b:af 215 OPEN fffff8000d2d6e00 0 0 * /19 * 0 LISTEN fffff8000d058e00 0 0 * /17 * 0 LISTEN fffff8000d0a7b00 0 0 * /1 * 0 LISTEN (using 'hcitool cc 00:1b:dc:06:94:d3' connects but doesn't open control or interrupt) Samsung S4 pairs but doesn't open control or interrupt. I have seen yt videos of hooking up 'generic' bluetooth keyboard so I believe the device is capable. I have a feeling that Android caches connection info so it's not seeing the HID. I might need to reboot the device. I'm going to have to go through everything from the beginning and make sure everything is correct. Here's what I did to generate bthidd.conf - maybe I can make a man page for bthidd.conf? There's a note on the bthidd man page about needing a bthidd.conf man page. (but maybe there's a better way than the way I did it?) https://gist.github.com/waitman/d77440b82dcb2463e5c3 also, I'll try the manual restart of bluetooth stack and let you know if that works. Thank you, --=20 Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Thu Mar 19 15:53:11 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9938711B for ; Thu, 19 Mar 2015 15:53:11 +0000 (UTC) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (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 4D9725F8 for ; Thu, 19 Mar 2015 15:53:11 +0000 (UTC) Received: by igcqo1 with SMTP id qo1so78789870igc.0 for ; Thu, 19 Mar 2015 08:53:10 -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 :cc:content-type:content-transfer-encoding; bh=5OMNhcKS3Eya9vvL3qEiOAcq98vkyThbZhi5ViSh20g=; b=PtjRwiV2Q/zSYgM/aEP2arOPdqN1NxlTTrPHBRd+Lhqm07Wv4LxLhjNlGOpj7K0mXy drQsoN0ebyzplARmomIRG42k0XT8ScmgWS8+b+Ice0bsqVWSvG7kj9JNA7lmPzG36Gje jAThGgsioVirAGug93slJ0Rpm44G6diYrIUt62pKJSTtAdm1UcG22VHh1bKbaUNe7uYc nCbUpASNIPd8TPMKI7ZoLE+PJj7hiWNMzegpe7Owapn84SJ8Ww/JWkTwUv5lA4QW6gSi 5YbOxHWi8AeE/WS2OOwuuKhucOw7e02uXnzfVC4RRSvHvxAbiLKU5yWHClX1Ty7zzQxT wGuQ== MIME-Version: 1.0 X-Received: by 10.42.79.8 with SMTP id p8mr10401945ick.51.1426780390608; Thu, 19 Mar 2015 08:53:10 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Thu, 19 Mar 2015 08:53:10 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Thu, 19 Mar 2015 08:53:10 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Thu, 19 Mar 2015 15:53:11 -0000 Hello, > maybe getting closer. bthidd connects and opens control and interrupt > channels, and i can see data on the interrupt line. [...] > send characters to FIFO > # echo "ABEF010231" >> /tmp/ain > > ... > sent data 3 > sent data 4 > sent data 7 > sent data 8 > sent data 38 > sent data 29 > sent data 38 > sent data 30 > sent data 31 > sent data 29 > > this shows up on the client .. simple syslog(LOG_ERR,"%s",data.b); > > Mar 18 21:23:32 rpidev bthidd[4948]: Opening outbound session for > 00:1b:dc:06:94:d3 (new_device=3D0, reconnect_initiate=3D0) > Mar 18 21:23:32 rpidev kernel: kbd2 at vkbd16 > Mar 18 21:23:35 rpidev bthidd[4948]: > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^C > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^D > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^G > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^H > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^^ > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^_ > Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] > > I'm guessing I'll have to hook up a display to that machine to see if > the virtual keyboard device is working right. ok. so seems like your data are making it all the way to bthidd(8). its good. a couple things (1) please make sure your hid report is correctly encoded. i don't recall all the specifics at this time, but, i'm fairly certain you need to actually send two hid reports for each character, i.e. one for key being pressed and one for key being released; (2) with respect to virtual keyboard working, please make sure that machine that runs bthidd(8) also has kbdmux(4) loaded. kbdmux(4) should be enabled by default in GENERIC, but please double check. if its not, please make sure to either kldload kbdmux (you can do it from loader.conf), or, compile it into the kernel. > modified bthidd https://github.com/waitman/bthidd can you please point me to your modifications? [...] > I'm going to have to go through everything from the beginning and make > sure everything is correct. i suspect that your hid reports are not quite correct. > Here's what I did to generate bthidd.conf - maybe I can make a man > page for bthidd.conf? There's a note on the bthidd man page about > needing a bthidd.conf man page. (but maybe there's a better way than > the way I did it?) i think the way you did it is correct. bthidd.conf contains entries produced by "bthidcontrol query" command. normally it is not needed to do modify entries in any way. > also, I'll try the manual restart of bluetooth stack and let you know > if that works. you really should not need to do anything manually. everything should be started automatically (from devd.conf) when ng_ubt(4) device attaches. thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Thu Mar 19 19:48:13 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1A29100 for ; Thu, 19 Mar 2015 19:48:12 +0000 (UTC) Received: from mail-we0-x231.google.com (mail-we0-x231.google.com [IPv6:2a00:1450:400c:c03::231]) (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 61EE2D8F for ; Thu, 19 Mar 2015 19:48:12 +0000 (UTC) Received: by webcq43 with SMTP id cq43so65994038web.2 for ; Thu, 19 Mar 2015 12:48:10 -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 :cc:content-type:content-transfer-encoding; bh=fpLOpmdkShJUbeYLfFcvEAPh65TZe3U2ZR0fXeDmUc8=; b=QwI6wB6UlcfsZ797pj2sefGPvBrW8qsXd3HYJGjeiL9nIg9W8E0Pv43g5iKk4bjzOB ZnVzR3jS0UGScmuW3IFKxbzLoH8yzNXe8VRcixSL/2yC6YM2u0dk7gbdYNTahZVO0gTh aW7+/wnPD+JQPNhKNW77ya0Fn7J7AshE/wtpxwMEQYP3LyjDcqdyt/bKGslbEoh46Eme qfejEbkbt+gP9c9Pfmf08a0ruqVj68n1iUx7hG/8FUNnAgJ7ZpiPWnatNyVqqcsn0eyx Ae8o8cItDfxBFMpyv6HGyy7V35eRrLcbSO+jnlaaZjd+tR3AvOfRBQLYStEXaIZ1lidr eZ8g== MIME-Version: 1.0 X-Received: by 10.180.218.71 with SMTP id pe7mr19329830wic.70.1426794490853; Thu, 19 Mar 2015 12:48:10 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Thu, 19 Mar 2015 12:48:10 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Thu, 19 Mar 2015 12:48:10 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Thu, 19 Mar 2015 19:48:13 -0000 On Thu, Mar 19, 2015 at 8:53 AM, Maksim Yevmenkin wrote: > Hello, > >> maybe getting closer. bthidd connects and opens control and interrupt >> channels, and i can see data on the interrupt line. > > [...] > >> send characters to FIFO >> # echo "ABEF010231" >> /tmp/ain >> >> ... >> sent data 3 >> sent data 4 >> sent data 7 >> sent data 8 >> sent data 38 >> sent data 29 >> sent data 38 >> sent data 30 >> sent data 31 >> sent data 29 >> >> this shows up on the client .. simple syslog(LOG_ERR,"%s",data.b); >> >> Mar 18 21:23:32 rpidev bthidd[4948]: Opening outbound session for >> 00:1b:dc:06:94:d3 (new_device=3D0, reconnect_initiate=3D0) >> Mar 18 21:23:32 rpidev kernel: kbd2 at vkbd16 >> Mar 18 21:23:35 rpidev bthidd[4948]: >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^C >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^D >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^G >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^H >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- & >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^^ >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^_ >> Mar 18 21:23:51 rpidev bthidd[4948]: =C2=A1^BM- ^] >> >> I'm guessing I'll have to hook up a display to that machine to see if >> the virtual keyboard device is working right. > > ok. so seems like your data are making it all the way to bthidd(8). > its good. a couple things > > (1) please make sure your hid report is correctly encoded. i don't > recall all the specifics at this time, but, i'm fairly certain you > need to actually send two hid reports for each character, i.e. one for > key being pressed and one for key being released; > > (2) with respect to virtual keyboard working, please make sure that > machine that runs bthidd(8) also has kbdmux(4) loaded. kbdmux(4) > should be enabled by default in GENERIC, but please double check. if > its not, please make sure to either kldload kbdmux (you can do it from > loader.conf), or, compile it into the kernel. > >> modified bthidd https://github.com/waitman/bthidd > > can you please point me to your modifications? Hi, It's not for production use, but if someone comes across this post in the future maybe save a few minutes when tinkering and troubleshooting. I changed the Makefile so it will 'more easily' build as a standalone outside /usr/src I added the syslog line around ln 324 in server.c - just wanted to see that data was coming in. do { len =3D read(fd, &data, to_read); syslog(LOG_ERR,"%s",data.b); } while (len < 0 && errno =3D=3D EINTR); > > [...] > >> I'm going to have to go through everything from the beginning and make >> sure everything is correct. > > i suspect that your hid reports are not quite correct. > >> Here's what I did to generate bthidd.conf - maybe I can make a man >> page for bthidd.conf? There's a note on the bthidd man page about >> needing a bthidd.conf man page. (but maybe there's a better way than >> the way I did it?) > > i think the way you did it is correct. bthidd.conf contains entries > produced by "bthidcontrol query" command. normally it is not needed to > do modify entries in any way. Ok great i'll create a man page for bthidd.conf > >> also, I'll try the manual restart of bluetooth stack and let you know >> if that works. > > you really should not need to do anything manually. everything should > be started automatically (from devd.conf) when ng_ubt(4) device > attaches. > Sorry, I was referring to your previous message about trying to restart bluetooth 'manually' to see if it works. > thanks, > max --=20 Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Thu Mar 19 20:24:17 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 3DCA3C54 for ; Thu, 19 Mar 2015 20:24:17 +0000 (UTC) Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com [IPv6:2607:f8b0:4001:c03::22e]) (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 E47D022A for ; Thu, 19 Mar 2015 20:24:16 +0000 (UTC) Received: by iecsl2 with SMTP id sl2so76458718iec.1 for ; Thu, 19 Mar 2015 13:24:16 -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 :cc:content-type; bh=NAGQ62VcMD5+OZoZ68p9jErfeC0o2XZMJmtDo5VAkHo=; b=Dw8CW+jCMtwejHXp9D+ucfp3/ACTLm3LNs4ZsGujY84P/bZZRNQ4/3qsFal6VaYcY4 IQLk1h6c4uBK920YmTFy0srHiPY7s85fwrt/1ZCouQcKyjMbcyZRpLUkU7eG11vZlNEq DyvCVTyjKnItuWSGUCYrND2Tri6T34QXvz0E4s/OyclLxlh/SOtLWmlKO6+34CQpsd2i pFUJrSvIgPZOhgUCtYXwUG4TWZLflmP7r+X9CPZ9PJP3EwKF9iedHOldxFaIr1FdCVht +IlAvEmr6h3dGJLKZbibUkB5Sq/L63QAlNp24MfWXbv0xVO9+ZVV/KMLgJOViJSAhz2O MfvA== MIME-Version: 1.0 X-Received: by 10.50.56.82 with SMTP id y18mr19938336igp.25.1426796656298; Thu, 19 Mar 2015 13:24:16 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Thu, 19 Mar 2015 13:24:16 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Thu, 19 Mar 2015 13:24:16 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Thu, 19 Mar 2015 20:24:17 -0000 > Hi, > > It's not for production use, but if someone comes across this post in > the future maybe save a few minutes when tinkering and > troubleshooting. > > I changed the Makefile so it will 'more easily' build as a standalone > outside /usr/src > I added the syslog line around ln 324 in server.c - just wanted to see > that data was coming in. > > do { > len = read(fd, &data, to_read); > syslog(LOG_ERR,"%s",data.b); > } while (len < 0 && errno == EINTR); ok, thanks. so, yes, please check your hid report format. this it the input report you should be using (this is taken from your hid descriptor) Input id=1 size=8 count=6 page=Keyboard usage=Reserved_(no_event_indicated), logical range 0..255 so, it means that on-the-wire packet should be 10 bytes byte 0: 0xA1 -- bluetooth header byte 1: 0x01 -- hid report id byte 2: 0xXX -- bitmask for modifier key pressed, i.e. ctrl, shift, alt, etc. byte 3: 0x00 -- padding byte 4: 0xXX -- key code pressed #1 byte 5: 0xXX -- key code pressed #2 byte 6: 0xXX -- key code pressed #3 byte 7: 0xXX -- key code pressed #4 byte 8: 0xXX -- key code pressed #5 byte 9: 0xXX -- key code pressed #6 hid repot should tell which keys (scan codes 1..6) are pressed currently, and, which modifier keys are pressed currently (byte 2). if no keys are pressed currently, then, 0x00 should be used. host should keep track of which keys were pressed previously, and, effectively build a press/release logic itself. meaning if hid report N had key code K, and, hid report N+1 did not have key code K, then it means that key code K was pressed and subsequently released. here is another example that my be easier to understand. suppose we start with no keys pressed. hid report will look like byte 0: 0xA1 byte 1: 0x01 byte 2: 0x00 byte 3: 0x00 byte 4: 0x00 byte 5: 0x00 byte 6: 0x00 byte 7: 0x00 byte 8: 0x00 byte 9: 0x00 now, suppose key 'a' was pressed and then released. two hid reports will go out, i.e. byte 0: 0xA1 byte 1: 0x01 byte 2: 0x00 byte 3: 0x00 byte 4: key code for 'a' key byte 5: 0x00 byte 6: 0x00 byte 7: 0x00 byte 8: 0x00 byte 9: 0x00 followed by byte 0: 0xA1 byte 1: 0x01 byte 2: 0x00 byte 3: 0x00 byte 4: 0x00 byte 5: 0x00 byte 6: 0x00 byte 7: 0x00 byte 8: 0x00 byte 9: 0x00 meaning key 'a' was released and no other keys were pressed. i hope it makes sense to you. thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 14:46:21 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 063B7E4D for ; Sat, 21 Mar 2015 14:46:21 +0000 (UTC) Received: from mail-we0-x22a.google.com (mail-we0-x22a.google.com [IPv6:2a00:1450:400c:c03::22a]) (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 7B764E2A for ; Sat, 21 Mar 2015 14:46:20 +0000 (UTC) Received: by wetk59 with SMTP id k59so103230513wet.3 for ; Sat, 21 Mar 2015 07:46:19 -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 :cc:content-type; bh=9MC3YVWEUZT572mGbnVQ8ONEQHAOkerHy2flavBX3CA=; b=mnqMPm7mlKtH8lTHEtb4/Z6IQmFicKp+Y9GqPK3ITBthSUHvhx2d7ZKPdt8KOBiwHV bRdHbf6MfGV3BTZHkmCe0vEfgk2AQjyINwGbVzkoN/6x4kDCulp9EyQN/FHEGsWITntT kqeezNEWZf1UBkbP58NvKZTUeOtOuWr0AT5ick9/4p0nmi80lMvsyHmH7ydkDbLppxIb tVR8cwjCP5fC//No3+Jwknazw7McutSZtt3dw2Pkb8xNuZF4tPm2dHS7VswQqZpyzHPN wir7uh8bXTTrn98b4S6yeZzq0Vv/AXktcGrumdIrLHAWP2RVo3D9IKlIKg36zPr04DBQ 7gWA== MIME-Version: 1.0 X-Received: by 10.194.187.46 with SMTP id fp14mr83530702wjc.86.1426949179079; Sat, 21 Mar 2015 07:46:19 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sat, 21 Mar 2015 07:46:18 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Sat, 21 Mar 2015 07:46:18 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 14:46:21 -0000 On Thu, Mar 19, 2015 at 1:24 PM, Maksim Yevmenkin wrote: >> Hi, >> >> It's not for production use, but if someone comes across this post in >> the future maybe save a few minutes when tinkering and >> troubleshooting. >> >> I changed the Makefile so it will 'more easily' build as a standalone >> outside /usr/src >> I added the syslog line around ln 324 in server.c - just wanted to see >> that data was coming in. >> >> do { >> len = read(fd, &data, to_read); >> syslog(LOG_ERR,"%s",data.b); >> } while (len < 0 && errno == EINTR); > > ok, thanks. > > so, yes, please check your hid report format. > > this it the input report you should be using (this is taken from your > hid descriptor) > > Input id=1 size=8 count=6 page=Keyboard > usage=Reserved_(no_event_indicated), logical range 0..255 > > so, it means that on-the-wire packet should be 10 bytes > > byte 0: 0xA1 -- bluetooth header > byte 1: 0x01 -- hid report id > byte 2: 0xXX -- bitmask for modifier key pressed, i.e. ctrl, shift, alt, etc. > byte 3: 0x00 -- padding > byte 4: 0xXX -- key code pressed #1 > byte 5: 0xXX -- key code pressed #2 > byte 6: 0xXX -- key code pressed #3 > byte 7: 0xXX -- key code pressed #4 > byte 8: 0xXX -- key code pressed #5 > byte 9: 0xXX -- key code pressed #6 > > hid repot should tell which keys (scan codes 1..6) are pressed > currently, and, which modifier keys are pressed currently (byte 2). if > no keys are pressed currently, then, 0x00 should be used. host should > keep track of which keys were pressed previously, and, effectively > build a press/release logic itself. meaning if hid report N had key > code K, and, hid report N+1 did not have key code K, then it means > that key code K was pressed and subsequently released. > > here is another example that my be easier to understand. suppose we > start with no keys pressed. hid report will look like > > byte 0: 0xA1 > byte 1: 0x01 > byte 2: 0x00 > byte 3: 0x00 > byte 4: 0x00 > byte 5: 0x00 > byte 6: 0x00 > byte 7: 0x00 > byte 8: 0x00 > byte 9: 0x00 > > now, suppose key 'a' was pressed and then released. two hid reports > will go out, i.e. > > byte 0: 0xA1 > byte 1: 0x01 > byte 2: 0x00 > byte 3: 0x00 > byte 4: key code for 'a' key > byte 5: 0x00 > byte 6: 0x00 > byte 7: 0x00 > byte 8: 0x00 > byte 9: 0x00 > > followed by > > byte 0: 0xA1 > byte 1: 0x01 > byte 2: 0x00 > byte 3: 0x00 > byte 4: 0x00 > byte 5: 0x00 > byte 6: 0x00 > byte 7: 0x00 > byte 8: 0x00 > byte 9: 0x00 > > meaning key 'a' was released and no other keys were pressed. > > i hope it makes sense to you. > > thanks, > max Yes, thank you Max, that helps alot. One question, where is "Class" set? I believe this is causing me trouble # hccontrol -n ubt0hci inquiry Inquiry result, num_responses=1 Inquiry result #0 BD_ADDR: 00:1b:dc:06:94:d3 Page Scan Rep. Mode: 0x1 Page Scan Period Mode: 0x2 Page Scan Mode: 00 Class: ff:01:0c Clock offset: 0x2658 Inquiry complete. Status: No error [00] "Class: ff:01:0c" If I understand correctly, this is advertising this machine as a "computer" (actually the "C" is a laptop even though this machine isn't actually a laptop) right? So at the moment I'm announcing (through sdpd) that this is a computer with an 'available' 1124 HID interface. I'm guessing this is why it shows up on other machines as a "computer". I think what I really want to do is advertise the class to be something like 0x540, which I think I understand to be in the peripheral / keyboard class. Thank you, -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 14:55:50 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B62781D1 for ; Sat, 21 Mar 2015 14:55:50 +0000 (UTC) Received: from mail-pd0-x22a.google.com (mail-pd0-x22a.google.com [IPv6:2607:f8b0:400e:c02::22a]) (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 6C008F19 for ; Sat, 21 Mar 2015 14:55:50 +0000 (UTC) Received: by pdbop1 with SMTP id op1so137595823pdb.2 for ; Sat, 21 Mar 2015 07:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=vB5wX0p+XJqwr5Ym3H+i3/bVkpe5akVdHxyg6UuGBgo=; b=Ydt+bmrBaRC9uJ5w1KjvujZ/GGP4/qPGg7HIAeZJ37Yd0RQW1H7QFCZtfqoZlUQ7AL eM2yywQioZa8WWFxAjwF/BUnOUUgnQWIQZlM5kg15CG7XfT/9MfV4nmJZ7568ocfTKlB 4/X0MWdidDfb14X9OBPitj5yLmDNGGs3+C2hfp0boEqueDnzoV6SsANXKV2ZSAVmS8oK xZ2hLwJ142F6t7MjqC9H2biHQXn61QJEAkZrhkxFw7wD2HWUpMMJyQDb9IOeD4TmkYy4 K4Zr45/uVkeq1PdAPruysY3ViIBRXCeIFV6fWPVDKrHCLMj8JT2wOyvxW4ZVaL5zqa0H plIw== X-Received: by 10.70.28.5 with SMTP id x5mr100683696pdg.13.1426949749866; Sat, 21 Mar 2015 07:55:49 -0700 (PDT) Received: from [10.151.136.187] ([216.4.56.154]) by mx.google.com with ESMTPSA id ae7sm11865558pac.19.2015.03.21.07.55.47 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 21 Mar 2015 07:55:49 -0700 (PDT) References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> X-Mailer: iPhone Mail (12D508) From: maksim yevmenkin Subject: Re: register HID with SDP error Date: Sat, 21 Mar 2015 07:55:45 -0700 To: Waitman Gobble Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 14:55:50 -0000 Hello! > Yes, thank you Max, that helps alot. >=20 > One question, where is "Class" set? I believe this is causing me trouble You can set device class via hcicontrol. There is a command to do it. You ca= n also use configuration option that is going to be set when device attaches= . Please take a look at /etc/rc.d/Bluetooth and how it starts things. You ca= n create per-device configuration file that will set class, name etc.=20 Thanks Max From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 15:20:02 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 11A4092A for ; Sat, 21 Mar 2015 15:20:02 +0000 (UTC) Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [IPv6:2a00:1450:400c:c00::235]) (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 801EE162 for ; Sat, 21 Mar 2015 15:20:01 +0000 (UTC) Received: by wgra20 with SMTP id a20so112070046wgr.3 for ; Sat, 21 Mar 2015 08:19:59 -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 :cc:content-type:content-transfer-encoding; bh=wyxhrXwssarmCWMULx7UbjKC98ZjE2NfwADbaQ4L1dE=; b=xwusJJtGowtHqkbRP8DUc2Y1v2dVHS1uPs+gcy7fxgSbJs9M36tHXGD7XIj36MwjrO ifOQ3TJ7MsESt7LJFF91WTotJck7fcEmxltv7Qd2iMUCn9yr3n9s9nWtC5HBKhjONuPt 6za0qsRIgdGdNxvp/J2SSyHGqettHLH9Bxexpl4qoZbhimL4JnjEjyA+Ledf6tcIb5aB 7KULr9zpy7hiE2jGx3NRpJDWI6Oc3u+jG0Di57KeKz12dx9/tFSoD/3g/b0CD7xL+PpQ BF/DUZVrrFH+blhtGWoCtR9Z43tEGrbDAVflmDIEAyk18caCjLYl5FG40SMlbQ8HvDAF uyUQ== MIME-Version: 1.0 X-Received: by 10.180.23.106 with SMTP id l10mr5174335wif.54.1426951199934; Sat, 21 Mar 2015 08:19:59 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sat, 21 Mar 2015 08:19:59 -0700 (PDT) In-Reply-To: <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> Date: Sat, 21 Mar 2015 08:19:59 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: maksim yevmenkin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 15:20:02 -0000 On Sat, Mar 21, 2015 at 7:55 AM, maksim yevmenkin wrote: > > Hello! > >> Yes, thank you Max, that helps alot. >> >> One question, where is "Class" set? I believe this is causing me trouble > > You can set device class via hcicontrol. There is a command to do it. You= can also use configuration option that is going to be set when device atta= ches. Please take a look at /etc/rc.d/Bluetooth and how it starts things. Y= ou can create per-device configuration file that will set class, name etc. > > Thanks > Max > Hey, that works! Thank you. hccontrol Write_Class_Of_Device 02:50:40 so now I have to figure out how to send the PIN that the connecting device demands to receive. I suppose it's sending 0000. But it appears there has to be a human action in this case. < HCI Command: Accept Connection Request(0x01|0x0009) plen 7 > HCI Event: Command Status(0x0f) plen 4 > HCI Event: Role Change(0x12) plen 8 > HCI Event: PIN Code Request(0x16) plen 6 < HCI Command: PIN Code Request Reply(0x01|0x000d) plen 23 > HCI Event: Command Complete(0x0e) plen 10 > HCI Event: Connect Complete(0x03) plen 11 --=20 Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 18:02:31 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 CE826455 for ; Sat, 21 Mar 2015 18:02:31 +0000 (UTC) Received: from mail-ig0-x229.google.com (mail-ig0-x229.google.com [IPv6:2607:f8b0:4001:c05::229]) (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 7E78E5E4 for ; Sat, 21 Mar 2015 18:02:31 +0000 (UTC) Received: by igbud6 with SMTP id ud6so12555863igb.1 for ; Sat, 21 Mar 2015 11:02:31 -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 :cc:content-type; bh=hKYGx/SDn1FDxukMlINfb9ahYhB6/5DqP6+fKtawKAA=; b=e10mvc1KLEdiXdK4wW91Y/77WsyJ9hT4RQQV1O88/tun1gaIqvElHQwz62ILuUpvRv Pb8L69E1xlFY1iVF1U1xSQHrlAYVy9BarvbuY7scSgj2PdknvFvGIsdCMbKmBingrBKV bjXFeZ8gkWZweZdQcul1YJZKI13aKWAC2UJyI6Hwwjfq459hZFqTCaN3MxUmLpRmdQzs rLX8yVLVR9ANt9FAQ/NEFUP4C7YZYVaUFacIhAwNdJbWs8CmPLURv9iPLNprGycxmbaR EtafJwFKqJHsdGJKBI1MyUAVwnrfaLiL2SnxQXzbuIfG9K1BUplYYTe+dBsxcgTFgzb6 DF6Q== MIME-Version: 1.0 X-Received: by 10.107.12.70 with SMTP id w67mr118795360ioi.10.1426960951039; Sat, 21 Mar 2015 11:02:31 -0700 (PDT) Received: by 10.36.66.74 with HTTP; Sat, 21 Mar 2015 11:02:30 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> Date: Sat, 21 Mar 2015 11:02:30 -0700 Message-ID: Subject: Re: register HID with SDP error From: Maksim Yevmenkin To: Waitman Gobble Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 18:02:32 -0000 [...] > Hey, that works! Thank you. > > hccontrol Write_Class_Of_Device 02:50:40 great! as i said, you can also automate it. please read bluetooth.device.conf(5). in your case you will need to create /etc/bluetooth/ubt0.conf and add class="02:50:40" this way class will be applied every time you start ubt0 device. > so now I have to figure out how to send the PIN that the connecting > device demands to receive. I suppose it's sending 0000. But it appears > there has to be a human action in this case. you have a couple of options here: (1) use hcsecd(8). since you want to pair with any host (because your code implements device) you can use default entry. please read hcsecd.conf(5) for more details. device { bdaddr 00:00:00:00:00:00; name "Default entry"; key nokey; pin "0000"; } something like this might work; (2) write your own code. basically, you want to open raw HCI socket and listen for PIN code and link key requests and events. hcsecd(8) source code can be used as reference; thanks, max From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 18:16:05 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 D0EEB886 for ; Sat, 21 Mar 2015 18:16:05 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (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 4E27E77D for ; Sat, 21 Mar 2015 18:16:05 +0000 (UTC) Received: by wibgn9 with SMTP id gn9so18670387wib.1 for ; Sat, 21 Mar 2015 11:16:03 -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 :cc:content-type; bh=ixMh1NHpl0IMRdSwhshjZTzuvNwTNkpo5SzsDXHuVws=; b=XvdijyOSw43B4FwC+SWP3I8pad5jkiEdJ2PBKwq5RRzFr/Tw6KSuAEDsns+bAbdP+y SjzZsLHEqcXSiPPM2cn1ZK8jM/Nj0iSM8lQ9anfq711kXBkK/mQdEeq3DDBA3tNRsFrP juPeNfZarGIgehGpM4muEb2JGf5bodwlSOTsYgcXjS11UGMlnyKyZMZAgQ7dszo+Nhr2 Vpt0E/M9+iMKBPw3g54uGcJJ55MQK7hyYNgEEA1KSPW2tkqFbFbnU5b/DZRnrh02CLkd 63yI+Ce0hc+WB0iLMzw1OLqdMRu8Ram0uqrMsuq33DTIvD6HFuppwbEfKqbUKIxrSW89 SjFQ== MIME-Version: 1.0 X-Received: by 10.194.237.34 with SMTP id uz2mr167735525wjc.157.1426961763650; Sat, 21 Mar 2015 11:16:03 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sat, 21 Mar 2015 11:16:03 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> Date: Sat, 21 Mar 2015 11:16:03 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 18:16:05 -0000 On Sat, Mar 21, 2015 at 11:02 AM, Maksim Yevmenkin wrote: > [...] > >> Hey, that works! Thank you. >> >> hccontrol Write_Class_Of_Device 02:50:40 > > great! as i said, you can also automate it. please read > bluetooth.device.conf(5). in your case you will need to create > /etc/bluetooth/ubt0.conf and add > > class="02:50:40" > > this way class will be applied every time you start ubt0 device. > >> so now I have to figure out how to send the PIN that the connecting >> device demands to receive. I suppose it's sending 0000. But it appears >> there has to be a human action in this case. > > you have a couple of options here: > > (1) use hcsecd(8). since you want to pair with any host (because your > code implements device) you can use default entry. please read > hcsecd.conf(5) for more details. > > device { > bdaddr 00:00:00:00:00:00; > name "Default entry"; > key nokey; > pin "0000"; > } > > something like this might work; > > (2) write your own code. basically, you want to open raw HCI socket > and listen for PIN code and link key requests and events. hcsecd(8) > source code can be used as reference; > > thanks, > max Max, I modified hcsecd a little. if you set the pin to "PROMPT" in hcsecd it blocks on reading a FIFO at /tmp/pinprompt https://github.com/waitman/hcsecd echo "835753" > /tmp/pinprompt it adds "enter key" 0x0D at the end so that device will continue. Otherwise it sits there until the end of time, I think? I obviously didn't wait until the end of time, but my android phone went way past the timeout without the 'enter key' appended to the pin string. if you want PIN reply on some devices and PROMPT on others, that can be an issue. looks like it works,but only tested like 10 times. #define FIFO_NAME "/tmp/pinprompt" ... char newpin[16]; ... strncpy(newpin,pin,strlen(pin)); if (strcmp("PROMPT",pin)==0) { char sfifo[300]; int numfifo, fdfifo; mknod(FIFO_NAME, S_IFIFO | 0666, 0); fdfifo = open(FIFO_NAME, O_RDONLY); do { if ((numfifo = read(fdfifo, sfifo, 300)) == -1) { /* oh no */ } else { //syslog(LOG_DEBUG,"%s pincode entered",sfifo); } } while (numfifo>0); sfifo[strlen(sfifo)-1] = 0x0D; /* enter key */ sfifo[strlen(sfifo)-1] = '\0'; strncpy(newpin,sfifo,strlen(sfifo)); } ng_hci_pin_code_rep_cp *cp = NULL; cmd->opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL, NG_HCI_OCF_PIN_CODE_REP)); cmd->length = sizeof(*cp); cp = (ng_hci_pin_code_rep_cp *)(cmd + 1); memcpy(&cp->bdaddr, bdaddr, sizeof(cp->bdaddr)); strncpy(cp->pin, newpin, strlen(newpin)); cp->pin_size = strlen((char const *) cp->pin); syslog(LOG_DEBUG, "Sending PIN_Code_Reply to '%s' " \ "for remote bdaddr %s", addr->hci_node, bt_ntoa(bdaddr, NULL)); -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 19:00:53 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AECE24C for ; Sat, 21 Mar 2015 19:00:53 +0000 (UTC) Received: from mail-we0-x22f.google.com (mail-we0-x22f.google.com [IPv6:2a00:1450:400c:c03::22f]) (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 769C2BF3 for ; Sat, 21 Mar 2015 19:00:52 +0000 (UTC) Received: by wetk59 with SMTP id k59so106276557wet.3 for ; Sat, 21 Mar 2015 12:00:50 -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 :cc:content-type; bh=z/+MGy994CrV03YzntzUVI6yGKbfCtQ+/tmX8DiYbNM=; b=yF6Crx8rXP9d6lW7i9VEl/QoqrOfNxFLWx7L5NSHP6zinnkcdH+VAkx5NSN0VozkSZ YFf+yjNuuBwR0eVfsqe7bmjyWyBxGidsTP0lCG7zW9X5+SrkFCxc/k/6HoldRhkhi4ac +cGGAbBaMOgBbApriSlcbJoFUs6uBAUpOCs23hkmIrrq9GIirJ3XSE7SPeyS4Hj6g+6A QoZDo4qWeEaleAmT5pqizktOmyLciSSTxQo0vKVxTkenB6AtNWXFHdx3JkpujZOpKuRQ N0kNXQiAwgaEUCRQuBZTSSM2WPLdRIK5UcDKvEFCqv/5VNcBDJ6Qb/ubT5xqA/HOQRLF v4zw== MIME-Version: 1.0 X-Received: by 10.180.218.71 with SMTP id pe7mr6353573wic.70.1426964450788; Sat, 21 Mar 2015 12:00:50 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sat, 21 Mar 2015 12:00:50 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> Date: Sat, 21 Mar 2015 12:00:50 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 19:00:53 -0000 On Sat, Mar 21, 2015 at 11:16 AM, Waitman Gobble wrote: > On Sat, Mar 21, 2015 at 11:02 AM, Maksim Yevmenkin > wrote: >> [...] >> >>> Hey, that works! Thank you. >>> >>> hccontrol Write_Class_Of_Device 02:50:40 >> >> great! as i said, you can also automate it. please read >> bluetooth.device.conf(5). in your case you will need to create >> /etc/bluetooth/ubt0.conf and add >> >> class="02:50:40" >> >> this way class will be applied every time you start ubt0 device. >> >>> so now I have to figure out how to send the PIN that the connecting >>> device demands to receive. I suppose it's sending 0000. But it appears >>> there has to be a human action in this case. >> >> you have a couple of options here: >> >> (1) use hcsecd(8). since you want to pair with any host (because your >> code implements device) you can use default entry. please read >> hcsecd.conf(5) for more details. >> >> device { >> bdaddr 00:00:00:00:00:00; >> name "Default entry"; >> key nokey; >> pin "0000"; >> } >> >> something like this might work; >> >> (2) write your own code. basically, you want to open raw HCI socket >> and listen for PIN code and link key requests and events. hcsecd(8) >> source code can be used as reference; >> >> thanks, >> max > > Max, > > I modified hcsecd a little. if you set the pin to "PROMPT" in hcsecd > it blocks on reading a FIFO at /tmp/pinprompt > > https://github.com/waitman/hcsecd > > > echo "835753" > /tmp/pinprompt > > it adds "enter key" 0x0D at the end so that device will continue. > Otherwise it sits there until the end of time, I think? I obviously > didn't wait until the end of time, but my android phone went way past > the timeout without the 'enter key' appended to the pin string. > > if you want PIN reply on some devices and PROMPT on others, that can > be an issue. > > looks like it works,but only tested like 10 times. > > > #define FIFO_NAME "/tmp/pinprompt" > ... > char newpin[16]; > ... > > strncpy(newpin,pin,strlen(pin)); > if (strcmp("PROMPT",pin)==0) > { > char sfifo[300]; > int numfifo, fdfifo; > mknod(FIFO_NAME, S_IFIFO | 0666, 0); > fdfifo = open(FIFO_NAME, O_RDONLY); > do { > if ((numfifo = read(fdfifo, sfifo, 300)) == -1) > { > /* oh no */ > } else { > //syslog(LOG_DEBUG,"%s pincode entered",sfifo); > } > } while (numfifo>0); > > sfifo[strlen(sfifo)-1] = 0x0D; /* enter key */ > sfifo[strlen(sfifo)-1] = '\0'; > strncpy(newpin,sfifo,strlen(sfifo)); > } > ng_hci_pin_code_rep_cp *cp = NULL; > > cmd->opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL, > NG_HCI_OCF_PIN_CODE_REP)); > cmd->length = sizeof(*cp); > > cp = (ng_hci_pin_code_rep_cp *)(cmd + 1); > memcpy(&cp->bdaddr, bdaddr, sizeof(cp->bdaddr)); > strncpy(cp->pin, newpin, strlen(newpin)); > cp->pin_size = strlen((char const *) cp->pin); > syslog(LOG_DEBUG, "Sending PIN_Code_Reply to '%s' " \ > "for remote bdaddr %s", > addr->hci_node, bt_ntoa(bdaddr, NULL)); > > > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 correction, should be newpin[32], or maybe more.. MS windows asks for a longer pincode. -- Waitman Gobble Los Altos California USA 510-830-7975 From owner-freebsd-bluetooth@FreeBSD.ORG Sat Mar 21 19:35:32 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 D583F66D for ; Sat, 21 Mar 2015 19:35:32 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (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 5171AF13 for ; Sat, 21 Mar 2015 19:35:32 +0000 (UTC) Received: by wibg7 with SMTP id g7so14707513wib.1 for ; Sat, 21 Mar 2015 12:35:30 -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 :cc:content-type; bh=nSHJMCwQZEqKokQMOHrd6gvBGoc0k9HKX54G9+BBQaM=; b=KBTSSbOfcb6dnNARqJDffVjTA4YotOjjZ5sJI+UesFtOQl3dW8BrBSbjoo9CJDtZBP BNWdmUw7BO4e8DOXBZopKm7K5EdlFsmgCRMMbjJ2SGHqLhuyKVUMv5RM4vOdVC9O+iGy HpiRT3KvSsPyBaYirjJS+y4ombqApPMHeU4P3Ebkhw1dAjaZgWkqQ5jDB+ua78kBPpRT LXGj/8NOq3dGRQdm0MZtO+ZkRTAZEdvNqgYGC4VOUNSLeEM78xexyWpJ4PZKf4x2RrwN nO3/nwMPUKcuZpfpn2SjM/HsCYMq+yN+zZZFa7lGYq3swPI7VpEqGU5+XFre4U+kJ/iS BnqA== MIME-Version: 1.0 X-Received: by 10.194.75.168 with SMTP id d8mr174204879wjw.87.1426966530745; Sat, 21 Mar 2015 12:35:30 -0700 (PDT) Received: by 10.27.214.136 with HTTP; Sat, 21 Mar 2015 12:35:30 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <77352B43-637C-4E0D-B4CC-B42D977551F6@gmail.com> Date: Sat, 21 Mar 2015 12:35:30 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert 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: Sat, 21 Mar 2015 19:35:32 -0000 On Sat, Mar 21, 2015 at 12:00 PM, Waitman Gobble wrote: > On Sat, Mar 21, 2015 at 11:16 AM, Waitman Gobble wrote: >> On Sat, Mar 21, 2015 at 11:02 AM, Maksim Yevmenkin >> wrote: >>> [...] >>> >>>> Hey, that works! Thank you. >>>> >>>> hccontrol Write_Class_Of_Device 02:50:40 >>> >>> great! as i said, you can also automate it. please read >>> bluetooth.device.conf(5). in your case you will need to create >>> /etc/bluetooth/ubt0.conf and add >>> >>> class="02:50:40" >>> >>> this way class will be applied every time you start ubt0 device. >>> >>>> so now I have to figure out how to send the PIN that the connecting >>>> device demands to receive. I suppose it's sending 0000. But it appears >>>> there has to be a human action in this case. >>> >>> you have a couple of options here: >>> >>> (1) use hcsecd(8). since you want to pair with any host (because your >>> code implements device) you can use default entry. please read >>> hcsecd.conf(5) for more details. >>> >>> device { >>> bdaddr 00:00:00:00:00:00; >>> name "Default entry"; >>> key nokey; >>> pin "0000"; >>> } >>> >>> something like this might work; >>> >>> (2) write your own code. basically, you want to open raw HCI socket >>> and listen for PIN code and link key requests and events. hcsecd(8) >>> source code can be used as reference; >>> >>> thanks, >>> max >> >> Max, >> >> I modified hcsecd a little. if you set the pin to "PROMPT" in hcsecd >> it blocks on reading a FIFO at /tmp/pinprompt >> >> https://github.com/waitman/hcsecd >> >> >> echo "835753" > /tmp/pinprompt >> >> it adds "enter key" 0x0D at the end so that device will continue. >> Otherwise it sits there until the end of time, I think? I obviously >> didn't wait until the end of time, but my android phone went way past >> the timeout without the 'enter key' appended to the pin string. >> >> if you want PIN reply on some devices and PROMPT on others, that can >> be an issue. >> >> looks like it works,but only tested like 10 times. >> >> >> #define FIFO_NAME "/tmp/pinprompt" >> ... >> char newpin[16]; >> ... >> >> strncpy(newpin,pin,strlen(pin)); >> if (strcmp("PROMPT",pin)==0) >> { >> char sfifo[300]; >> int numfifo, fdfifo; >> mknod(FIFO_NAME, S_IFIFO | 0666, 0); >> fdfifo = open(FIFO_NAME, O_RDONLY); >> do { >> if ((numfifo = read(fdfifo, sfifo, 300)) == -1) >> { >> /* oh no */ >> } else { >> //syslog(LOG_DEBUG,"%s pincode entered",sfifo); >> } >> } while (numfifo>0); >> >> sfifo[strlen(sfifo)-1] = 0x0D; /* enter key */ >> sfifo[strlen(sfifo)-1] = '\0'; >> strncpy(newpin,sfifo,strlen(sfifo)); >> } >> ng_hci_pin_code_rep_cp *cp = NULL; >> >> cmd->opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL, >> NG_HCI_OCF_PIN_CODE_REP)); >> cmd->length = sizeof(*cp); >> >> cp = (ng_hci_pin_code_rep_cp *)(cmd + 1); >> memcpy(&cp->bdaddr, bdaddr, sizeof(cp->bdaddr)); >> strncpy(cp->pin, newpin, strlen(newpin)); >> cp->pin_size = strlen((char const *) cp->pin); >> syslog(LOG_DEBUG, "Sending PIN_Code_Reply to '%s' " \ >> "for remote bdaddr %s", >> addr->hci_node, bt_ntoa(bdaddr, NULL)); >> >> >> >> -- >> Waitman Gobble >> Los Altos California USA >> 510-830-7975 > > > correction, should be newpin[32], or maybe more.. MS windows asks for > a longer pincode. > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 ok this is now tested to work on Android phone, bluedevil/KDE on a GNU/Linux machine, an MS Windows 8.1 machine and an Apple OS X machine. I don't have an Iphone but I suppose it should work. The problem was when pairing a bluetooth keyboard on Android, it demands to have the pin code entered 'manually' on the keyboard. Other systems it looks like this is an option. For example, on Apple OS X, pairing with the bt device on the FreeBSD machine, there is a prompt displayed to "enter a pin code that is displayed on the screen". "6450 3430" so on the FreeBSD machine, # echo "64503430" > /tmp/pinprompt Then the Apple machine pairs to the FreeBSD device. Maybe it's not so useful to have in FreeBSD source, but might be helpful to some people browsing the mailing list archives. -- Waitman Gobble Los Altos California USA 510-830-7975