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