Subject: [Bluez-devel] HIDclient: Using a Bluez PC as virtual Bluetooth keyboard and mouse

Hello list,

with this posting I publish a software that mimicks a Bluetooth HID
(keyboard and mouse combo device) on a Linux PC. Thus you can
remote-control other Bluez-equipped PCs, Widcomm-stack equipped windows
boxes, and basically any machine that knows how to talk to Bluetooth
keyboards in non-boot-protocol mode.

Source code is GNU GPLd, and can be found on
http://www.hoffmeister-online.de/bluez/hidclient-20060725.tar.bz2

Short instructions (for root users):
Download the file and unpack it
# wget -q
http://www.hoffmeister-online.de/bluez/hidclient-20060725.tar.bz2
# tar -xjvf hidclient-20060725.tar.bz2

Run make and copy the hid-sdp-record.bin into /etc/bluetooth/

Make sure bluez is installed (else the "make" will most probably fail
anyway) and the SDP daemon is running (which it should by default).

Change to a Linux textmode console (e.g. Ctrl+Alt+F1) and run
./hidclient
from there. Then, startup the other machine and discover the "HID"
service available on your virtual-HID box. Connect to it.

Move the mouse, touch the keyboard, enjoy.

Hint: The bluetooth connection can be interrupted by pressing "Pause",
the program can be aborted altogether with LeftCtrl+LeftAlt+Pause

Beware, all keyboard and mouse input will simultaneously be read by your
virtual-HID computer as well! That's why running hidclient from a
textmode console is a good idea.

Code history: Developped as a practical work during the "Networks"
course at Rheinische Friedrich-Wilhelms-Universit=E4t, Bonn, Germany in
2004/2005 for the Nokia-supported, GPLd, Affix Bluetooth stack.
Ported in July/2006 to bluez, several code cleanups and improvements.

Questions welcome.

Regards
Anselm

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


Subject: Re: [Bluez-devel] HIDclient: Using a Bluez PC as virtual Bluetooth keyboard and mouse

Am Mittwoch, den 26.07.2006, 18:48 +0200 schrieb Collin R. Mulliner:
> Cool, but do I read right - it only supports REPORT mode?
>
> My HID keyboard (http://www.mulliner.org/bluetooth/xkbdbthid.php) so far
> only supports BOOT mode... I allways wanted to implement report mode.

It is a matter of choice. The boot mode is not at all BAD, and in
reality, iirc, the "report mode" report can look exactly like the "boot
mode" reports. The difficulty with boot mode though is that a given
device can only be keyboard OR mouse, so for mimicking both from the
same computer, you would need two connections. This again will hinder
you from using the standard "ports" for the HID protocol (namely the
0x11/0x13 pair) for both those devices, and most probably one of the two
will not work with the more braindead implementations out there. Let us
name the Widcomm stack which sometimes behaves oddly, for my
understanding.

That is the reason why I chose the "report mode" - it gives me the
opportunity to deliver both mouse and keyboard data over the same data
channel.

Looking at the code you will find that I use two different reports
though, with ID "1" for mouse reports and ID "2" for keyboard reports.
Moving the mouse, you generate a "1" record, which only contains mouse
information, and vice versa, and those two reports are iirc fairly
similar to the boot protocol reports. You will find more detailed
information in the Bluetooth HID spec, and, most probably also in the
USB HID spec. If you intend to make my hidclient code boot-mode
compatible, you could drop either keyboard or mouse functions, set the
appropriate flags in the SDP information (is_bootmode_device or
similar), and change the details of the report that are not exactly boot
mode. That is why I hand out a hex mode report descriptor - so that it
can be adapted to the developer's needs.

Let's say you wish to add joystick support. Yes, that would be possible:
Go into the input event handling subroutine, implement some code that
reads the Linux joystick events and generates a "joystick report" -
which would be defined in the HID descriptor as well. Not too much magic
needed ;-) You might to implement a logic to recognize switching between
the two modes - I cannot tell you out of my head. A boot-mode-only thing
would of course live without that logic.

If you want to implement report mode for your Xkbdbt, you will need a
proper report descriptor, the rest is mostly straightforward. If you
want me to have a look over your code, feel free to write PM or ask
questions on the list.

Regards
Anselm

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-07-26 16:48:29

by Collin R. Mulliner

[permalink] [raw]
Subject: Re: [Bluez-devel] HIDclient: Using a Bluez PC as virtual Bluetooth keyboard and mouse

Cool, but do I read right - it only supports REPORT mode? =


My HID keyboard (http://www.mulliner.org/bluetooth/xkbdbthid.php) so far
only supports BOOT mode... I allways wanted to implement report mode.


Collin

On Tue, 2006-07-25 at 21:51 +0200, Anselm Martin Hoffmeister wrote:
> Hello list,
> =

> with this posting I publish a software that mimicks a Bluetooth HID
> (keyboard and mouse combo device) on a Linux PC. Thus you can
> remote-control other Bluez-equipped PCs, Widcomm-stack equipped windows
> boxes, and basically any machine that knows how to talk to Bluetooth
> keyboards in non-boot-protocol mode.
> =

> Source code is GNU GPLd, and can be found on
> http://www.hoffmeister-online.de/bluez/hidclient-20060725.tar.bz2
> =

> Short instructions (for root users):
> Download the file and unpack it
> # wget -q
> http://www.hoffmeister-online.de/bluez/hidclient-20060725.tar.bz2
> # tar -xjvf hidclient-20060725.tar.bz2
> =

> Run make and copy the hid-sdp-record.bin into /etc/bluetooth/
> =

> Make sure bluez is installed (else the "make" will most probably fail
> anyway) and the SDP daemon is running (which it should by default).
> =

> Change to a Linux textmode console (e.g. Ctrl+Alt+F1) and run
> ./hidclient
> from there. Then, startup the other machine and discover the "HID"
> service available on your virtual-HID box. Connect to it.
> =

> Move the mouse, touch the keyboard, enjoy.
> =

> Hint: The bluetooth connection can be interrupted by pressing "Pause",
> the program can be aborted altogether with LeftCtrl+LeftAlt+Pause
> =

> Beware, all keyboard and mouse input will simultaneously be read by your
> virtual-HID computer as well! That's why running hidclient from a
> textmode console is a good idea.
> =

> Code history: Developped as a practical work during the "Networks"
> course at Rheinische Friedrich-Wilhelms-Universit=E4t, Bonn, Germany in
> 2004/2005 for the Nokia-supported, GPLd, Affix Bluetooth stack.
> Ported in July/2006 to bluez, several code cleanups and improvements.
> =

> Questions welcome.
> =

> Regards
> Anselm
> =

> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share y=
our
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D=
DEVDEV
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
--
Collin R. Mulliner <[email protected]>
BETAVERSiON Systems [http://www.betaversion.net]
info/pgp: finger [email protected]
Help Microsoft fight software piracy: Give Linux to a friend today!


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel