Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 11:23:42 -0700
From:      Waitman Gobble <gobble.wa@gmail.com>
To:        Maksim Yevmenkin <maksim.yevmenkin@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:  <CAFuo_fw_iYPb6uMARb0V-FWX3WJPTLB8KL6wznXt5_2RDeV00g@mail.gmail.com>
In-Reply-To: <CAFuo_fyEKnbXx_OAtu7-fACwS0R=QdgVMv4oxdZxXfrtMeqEwQ@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> <CAFPOs6oBd4OagKixg6NH-uWzWCc4g%2B7U-uO1VdQY-UzzcZQBPA@mail.gmail.com> <CAFuo_fwoQLpsKCi7BnkUos31CH4LFqqtf0dCP7a5VREeDUi2uw@mail.gmail.com> <CAFuo_fyEKnbXx_OAtu7-fACwS0R=QdgVMv4oxdZxXfrtMeqEwQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>
> Max,
>
> I solved the problem, I got rid of the 'release key' structure and
> change vkeyb->key[0] to  0, then send that as a key release. Its
> working now.
>
> I believe I just need to handle client disconnects, and re-connects,
> and I think it will be all good.
>
> Thanks for your help.
>
> --
> Waitman Gobble
> Los Altos California USA
> 510-830-7975


Here's an updated version in case someone needs this sort of thing.
daemonized process, uses SIGHUP to disconnect clients and added
upper/lower characters and some special characters. Optionally set key
stroke delay.

https://github.com/waitman/hid_sppd

This version only allows a single client connection and single FIFO at
one time. Maybe in the future, handle multiple FIFO buffers and
clients. But at the moment I don't believe I have a need for that
functionality. I needed a way to add BT HID functionality to my
inexpensive long-range RFID reader/writer device, because apparently
people want to have RFID EPC codes auto-type (into their software
applications?).


You may specify PID File, FIFO buffer file and keystroke delay (or use
the defaults).
Keystroke delay is specified in milliseconds.

# hid_sppd -P /var/run/boo.pid -F /tmp/fifotmp -d 50


Some examples of sending characters to client:

# echo "222223333344444A" >> /tmp/fifotmp

or if you need special characters like "\n" and "\t"

# printf "22;222\t33 33\t44.444AabcdE\nEEeeeX " >> /tmp/fifotmp

(Note that if you use 'printf' then add an extra trailing space.)

so, any program should be able to write to the FIFO buffer.


To disconnect clients:

# pkill -HUP -F /var/run/boo.pid

It's possible bad things may happen if you try to send like a Gigabyte
of data to the FIFO buffer. It's a thought, but I haven't
stress-tested it like that.


I'm fairly new to Bluetooth so I don't yet fully understand how
everything works together but it seems like a good future project (and
possibly GSOC for a student) would be to implement BLE/GATT, and other
protocols in this age of 'wearable devices'?

-- 
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_fw_iYPb6uMARb0V-FWX3WJPTLB8KL6wznXt5_2RDeV00g>