Android Labs is an internal R&D activity within the HSC Connected Devices CoE where our amazing engineers implement proof of concept solutions showcasing our depth in the Android and Linux software stacks.
In this edition of "Android Labs", we bring you an innovative implementation of Android HID device specification for Bluetooth that allows your Android phone to be used as a standard BT mouse. We also added keyboard control and voice control to boot.
Remember to take a look at our demo video below! HSC may release the changes as part of its Open Source initiative in the near future. Please keep a tab on our Open Source page.
There are many applications (like RemoteDroid and others) that have allowed a phone to act as a mouse for a few years. These solutions are typically implemented over WiFi (you need both PC and phone to be connected over WiFi) and comprise of a 'server' process installed on the PC and a client on the smartphone. In other words, this is a client-server model that needs special software on the PC. By implementing the BT HID device profile, your phone actually shows up as a standard BT mouse and requires no additional functionality.
The purpose of this activity is to enable an android device to be used as a bluetooth peripheral device such as mouse, keyboard, remote control, gamepad etc. The android device can be then used to control devices like phones, computer, TV, PS3 etc. over bluetooth. To act as a bluetooth HID device, the android bluetooth stack needs to support HID device role of bluetooth HID profile. The current implementation of HID in bluedroid supports HID host role only. This activity implements HID device role in bludroid.
HID device role has been implemented in bluedroid using classic bluetooth. The current usecase allows the android device to act as a mouse and keyboard combo device. To support other use cases like remote control and gamepad, the changes will be required in HID report descriptor. The support of HID device role is being controlled through a compile time flag as of now. Some minor changes have been done in android framework and bluetooth system app to send input reports(mouse positions, key presses etc.) from a third party application. This implementation has been tested on a Nexus5 device connecting with windows as well as linux machines and a few smart phones supporting HID host role. A test application has been developed which provides a touch panel to send mouse cursor positions and two buttons to send left click and right click. For keyboard layout, the soft keyboard has been used which is available to all the android applications. The HID keyboard implementation has also been used to implement voice control of PC from Android device. For this purpose, the speech recognition feature of Android has been used which uses Google engine's voice search functionality. Offline speech recognition is also available however it is not that accurate when compared to online voice recognition. Some of the popular commands are available from voice control for Windows such as lock, unlock, reboot, shutdown, sleep etc. Apart from this, the individual key combinations can also be sent by speaking the actual keys such as “control alt delete” will send CTRL+ALT+DELETE key combination.
HID device implementation should be modified in such as way that the HID profile role in bluedroid can be switched at run time based on a configuration. An application containing a master keyboard layout like keyboards for PC(containing CTRL, ALT, ESC and function keys) needs to be developed to provide full control. Mouse implementation can be extended as well to include scroll wheel using some touch gesture. The support for other HID devices can also be included such as gamepad, remote control, touchpad etc. Support for receiving output reports and feature reports needs to be implemented in the bluetooth stack for completeness of HID device role. The implementation can also be extended to support boot protocol mode of HID profile. Moreover, this work can also become the basis for implementing device role in HOGP (HID over GATT) profile over BLE.
(Note: This video has text annotation overlays which may not show up on a mobile device)
(Do you find this article interesting? You may want to check out our Embedded Android pages to read more about what we do in this space.)
These cookies are necessary for the website to function and cannot be switched off.
These cookies allow us to monitor traffic to our website so we can improve the performance and content of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited or how you navigated around our website.
These cookies enable the website to provide enhanced functionality and content. They may be set by the website or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising.
Do you have an upcoming project and wantus
to help speed up your time to market?