Date: Tue, 17 Mar 2015 07:26:30 -0700 From: Waitman Gobble <gobble.wa@gmail.com> To: Iain Hibbert <plunky@ogmig.net> Cc: "freebsd-bluetooth@freebsd.org" <freebsd-bluetooth@freebsd.org> Subject: Re: register HID with SDP error Message-ID: <CAFuo_fx47uRC-eKD_KtsSsrMCQZauyHyCOgRxGbtp_WEZ49o_Q@mail.gmail.com> In-Reply-To: <alpine.NEB.2.11.1503170658130.4414@galant.ogmig.net> References: <CAFuo_fy9xRU2T3GUPY8116yZCUd8sL9pBQ9ixXnMwO56niJFog@mail.gmail.com> <CAFuo_fzdmB79qdoH8P5EcO_ZZoa=_id6h=eqFBXvP_a%2B3WMkLw@mail.gmail.com> <CAFuo_fzB3A5L3vivH7Z80OEoBtVEHftEYE4LUkhnrkguzL5GDA@mail.gmail.com> <CAFuo_fzrk%2BWLXivZrnTsGQD%2BS7mq%2BUSXB7Mn6%2BJT=y64JakGSw@mail.gmail.com> <CAFPOs6q3iVcNthF=S--UgTm=5wA0HM6coqB7AcmCKb=55OWdTQ@mail.gmail.com> <CAFuo_fxgBVKxmzbJs%2B-XDz%2Bu4tb2_i3eYXSa-oiOoU%2BQD6ApwQ@mail.gmail.com> <CAFPOs6r_D7bcGCMP_bP%2BQtZgKt7Oj5jRJ2v872RODekn%2B6xv1Q@mail.gmail.com> <CAFuo_fwPuaD4bYwfZou0RBswZsTmdtVZA1B2GqUdo3ZJJiWRQg@mail.gmail.com> <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> <CAFuo_fye5RWNtjsutHa%2BbXL0AYHYRpJxW-b=48o0iMwX227wdA@mail.gmail.com> <alpine.NEB.2.11.1503170658130.4414@galant.ogmig.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 17, 2015 at 12:26 AM, Iain Hibbert <plunky@ogmig.net> 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 <Keyboard>
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFuo_fx47uRC-eKD_KtsSsrMCQZauyHyCOgRxGbtp_WEZ49o_Q>
