6.4. Using Keyboard, Mouse or Other HID Equipments

Originally Human Interface Device (HID) defined a subclass for USB. It specifies different devices for user input. For example mouse, keyboard and other pointers. Bluetooth's HID profile was specified to get rid of the cable the different USB HID devices has. It allows wireless communication for USB HID devices as RFCOMM profile does for serial devices.

Starting from version 3.2.0 Affix supports HID profile. Affix has been tested with the following devices:

Table 6-1. HID device compatibility list

DeviceManufacturer
diNovo Media Desktop (keyboard, mouse, numerical pad)Logitech
Optical Mouse MX 900Logitech
Cordless presenterLogitech
Wireless optical KeyboardMicrosoft
Wireless Optical MouseMicrosoft

Using HID devices with Affix is fairly easy. The management is done completely with bthidctl utility. (This utility is covered in etail later in this documentation.) In the kernel affix_hidp module implements the HID support. This module is normally loaded into kernel automatically and you do not do anything to load it.

Note

This is not true in Affix 3.2.0. affix_hidp module have to be loaded manually. Give command "modprobe affix_hidp" as root user.

When you are attaching a device first time to your computer you should let Affix first discover the devices for you. To do this press the connect button in your HID device or devices and give the following command as a root user:

bthidctl connect all

This command first search for Bluetooth devices around you and then checks if those are HID devices. If they are Affix tries to connect them. After successfully connecting you will see a message on the screen and you are able to use your device. Found device is also added to a HID device database which Affix maintains. Also ordinary users has access to this database and thus the HID device installation in the future is even simpler (e.g. After reboot).

Note, that Affix discovers only those HID devices which connect button was pressed. So if you neighbour happens to use such device it will not be discovered. Also if you use your HID device with two computers you have to always connect to the device like it was the first time after you change the computer. This is because HID devices remember the computer they were connected previously and wants to be connected with it.

To prepare all the devices stored in HID device database for usage give the following command (no need to be root).

bthidctl listen all

This prepares kernel for the devices. Now when a device tries to contact your computer the connection is established and the message is delivered to the kernel. This is when you move a HID mouse or press a button on a HID keyboard. Also, it might be good idea to put above command to some boot script so that your HID keyboard would work also after rebooting you computer.

All above commands had a parameter "all". You can replace it with your device's Bluetooth address. Then only the specified device is connected or prepared. "all" refers to all the Bluetooth devices in your computer's radio range. To see the status of connected devices type command:

bthidctl status

This gives you a list of all HID devices in the database. List contains device address, status (whether it is connected or not) and device's type. Also /proc contains list of connected devices. To read this list give command:

cat /proc/net/affix/hid

To disconnect a HID device or all of them from your computer give command:

bthidctl disconnect all

Again, replace "all" with a specific device's address if you want to disconnect only one device. After disconnecting a device it is not usable until you set kernel to listen it again. Of course you can also use connect method, but you probably do not want to do it as the device is already in the HID device database.