Date: Thu, 19 Mar 2015 13:24:16 -0700 From: Maksim Yevmenkin <maksim.yevmenkin@gmail.com> To: Waitman Gobble <gobble.wa@gmail.com> Cc: "freebsd-bluetooth@freebsd.org" <freebsd-bluetooth@freebsd.org>, Iain Hibbert <plunky@ogmig.net> Subject: Re: register HID with SDP error Message-ID: <CAFPOs6oBd4OagKixg6NH-uWzWCc4g%2B7U-uO1VdQY-UzzcZQBPA@mail.gmail.com> In-Reply-To: <CAFuo_fzMaRu-VgP48GqETT6AfYT20eR6Ry13J=CiC=mibSvCig@mail.gmail.com> 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> <CAFuo_fx47uRC-eKD_KtsSsrMCQZauyHyCOgRxGbtp_WEZ49o_Q@mail.gmail.com> <CAFPOs6rYXOFPk5_nqXivToUvGRjXDMS=XL60RyKbMQm7nP8wFg@mail.gmail.com> <CAFuo_fw5-YtH_sj3Ft52hpfXEP8QCkweptJzT0eUSos9DoBZ%2BA@mail.gmail.com> <CAFuo_fzSMNvwewpkKxcLr9aHyTcwaVgcreLtexSo=FNzNhC6og@mail.gmail.com> <CAFPOs6rJ_SaKjmXrbr%2Bpa9BoVL2HtjkzoyBo015BFK1QB9ZVsQ@mail.gmail.com> <CAFuo_fxGgWYp5x=xWbFogj8F8ZMULFQw_HOWZiJ42=vDO7tXnQ@mail.gmail.com> <CAFPOs6o7jrULqF%2BVSbZ0ckFx3MqAbO-eHyL5FfToTL4xMxSBLQ@mail.gmail.com> <CAFuo_fxocC6KhHqXf2HWpMLFNMFo2tdmv4RMv1MYYBXkC=3FJg@mail.gmail.com> <CAFuo_fwp_Nb2kOk=7qKO6VV5%2Bu_MG5GwaKYkwKFDjUuVo%2BG-aw@mail.gmail.com> <CAFPOs6rNSqS=ZyZKZDWy2T437bkoXpfKEFn_Znpo7X6UgXMNVw@mail.gmail.com> <CAFuo_fzMaRu-VgP48GqETT6AfYT20eR6Ry13J=CiC=mibSvCig@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFPOs6oBd4OagKixg6NH-uWzWCc4g%2B7U-uO1VdQY-UzzcZQBPA>
