HOWTO: Bluetooth Keyboard/Mouse working with "Master" on ADP1

998 views
Skip to first unread message

Howard M. Harte

unread,
Jan 18, 2009, 6:43:05 PM1/18/09
to android-platform
I've been wanting to be able to use a Bluetooth Keyboard and Mouse
with my Android Phone for a while now. I was able to get it to work
for an ADP1 phone, using the master branch. The RC29 kernel does not
have proper support compiled in for this to work, so you'll have to
follow the instructions for installing "Master" on your ADP1. Note
the warnings in the following link, and note that "Master" has some
bugs, so this is only for experimentation, and I wouldn't recommend it
if you use your G1 as your primary phone.

You may also need to do some tricks to get BT running on Master:

1. preserve the BT firmware (brf6300.bin) from your G1:

2. while the phone is booting, "adb shell" and issue the following:
# echo 1 > /sys/class/rfkill/rfkill0/state

How to get HID Keyboard/Mouse working with G1/ADP1 and Master Branch

0. get and build the latest Master version of Android for your ADP1:
http://groups.google.com/group/android-platform/browse_thread/thread/d71fdb6e896a128c
http://andblogs.net/2009/01/cupcake-on-g1adp1/

1. Create Android.mk in <droid>/external/bluez/hidd:

LOCAL_PATH:= $(call my-dir)

#
# hidd
#

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
main.c \
sdp.c \
fakehid.c

LOCAL_CFLAGS:= \
-DVERSION=\"3.36\" \
-DSTORAGEDIR=\"/tmp\" \
-DNEED_PPOLL

LOCAL_C_INCLUDES:= \
$(call include-path-for, bluez-libs) \
$(call include-path-for, bluez-utils)/common

LOCAL_SHARED_LIBRARIES := \
libbluetooth

LOCAL_STATIC_LIBRARIES := \
libbluez-utils-common-static

LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE:=hidd

include $(BUILD_EXECUTABLE)

2. Then, make, and download to your ADP1:
$ make
$ fastboot -w -p dream flashall

Note: to get back to RC29, you need an RC29 update.zip on a MicroSD
card, and you need to fastboot -w (to wipe all local data) before
using the recovery mode to re-flash update.zip. If you don't wipe the
local data, Android will get stuck at the robot screen.

Boot up the phone, and ADB shell into it.
==================================================
$ adb shell
# hcitool scan
Scanning ...
00:23:6C:C2:AA:BB Mighty Mouse
00:1B:63:FA:CC:DD Apple keyboard

Now, in the Settings->Wireless Controls->Bluetooth Menu, pair with
your keyboard and mouse. Then,

# hidd --connect 00:23:6C:C2:AA:BB
# hidd --connect 00:1B:63:FA:CC:DD
# hcitool con
Connections:
< ACL 00:1B:63:FA:CC:DD handle 2 state 1 lm MASTER
< ACL 00:23:6C:C2:AA:BB handle 1 state 1 lm MASTER

# cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="h2w headset"
P: Phys=
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=event0
B: EV=3
B: KEY=4 0 0 0 0 0 0 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="synaptics-rmi-touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=event1
B: EV=b
B: KEY=400 0 4 0 0 0 0 0 0 0 0
B: ABS=11030003

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="trout-nav"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=event2 keyreset
B: EV=7
B: KEY=10000 0 0 0 0 0 0 0 0
B: REL=3

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="trout-keypad-v3"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=event3 keyreset
B: EV=23
B: KEY=80 980000 0 40000800 800c0850 0 b5ff47f d3ff4ffc
B: SW=1

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="compass"
P: Phys=
S: Sysfs=/devices/virtual/input/input4
U: Uniq=
H: Handlers=event4
B: EV=9
B: ABS=307ff

I: Bus=0005 Vendor=0000 Product=0000 Version=0000
N: Name="Bluetooth HID Boot Protocol Device"
P: Phys=
S: Sysfs=/devices/virtual/bluetooth/hci0/hci0:1/input5
U: Uniq=
H: Handlers=event5 keyreset
B: EV=7
B: KEY=1f0000 0 0 0 0 0 0 0 0
B: REL=103

I: Bus=0005 Vendor=0000 Product=0000 Version=0000
N: Name="Bluetooth HID Boot Protocol Device"
P: Phys=
S: Sysfs=/devices/virtual/bluetooth/hci0/hci0:2/input6
U: Uniq=
H: Handlers=event6 keyreset
B: EV=120003
B: KEY=7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
B: LED=1f

Note the two new input devices on event5 and event6! The keyboard and
mouse should now work.

TODO: create keyboard map for the keyboard, so all the keys work as
expected.
TODO: Mouse pointer. It would be really nice if Android supported a
mouse pointer, to emulate a touchscreen, sort of like the emulator
does.

-Howard

Nick Pelly

unread,
Jan 18, 2009, 6:56:26 PM1/18/09
to android-...@googlegroups.com
Nice writeup!

You can also get HID working using the 'input' plugin to the existing
hcid daemon. This has the advantage of avoiding running another
daemon. See
external/bluez/utils/input/Android.mk

We would probably go this path to get HID integrated into the platform.

Nick

Howard M. Harte

unread,
Jan 18, 2009, 7:30:15 PM1/18/09
to android-platform


On Jan 18, 3:56 pm, Nick Pelly <npe...@google.com> wrote:
> Nice writeup!
>
> You can also get HID working using the 'input' plugin to the existing
> hcid daemon. This has the advantage of avoiding running another
> daemon. See
> external/bluez/utils/input/Android.mk
>
> We would probably go this path to get HID integrated into the platform.
>
> Nick
>

It would be really nice to have the support integrated into the
platform using the input plugin for the Cupcake release. It opens up
a world of possibilities when trying to write long emails of posts
from a phone.

(Typed on my ADP1 using an Apple wireless keyboard)

Howard-
> On Sun, Jan 18, 2009 at 3:43 PM, Howard M. Harte <hhar...@gmail.com> wrote:
>
>
>
>
>
> > I've been wanting to be able to use a Bluetooth Keyboard and Mouse
> > with my Android Phone for a while now.  I was able to get it to work
> > for an ADP1 phone, using the master branch.  The RC29 kernel does not
> > have proper support compiled in for this to work, so you'll have to
> > follow the instructions for installing "Master" on your ADP1.  Note
> > the warnings in the following link, and note that "Master" has some
> > bugs, so this is only for experimentation, and I wouldn't recommend it
> > if you use your G1 as your primary phone.
>
> > You may also need to do some tricks to get BT running on Master:
>
> > 1. preserve the BT firmware (brf6300.bin) from your G1:
>
> > 2. while the phone is booting, "adb shell" and issue the following:
> > # echo 1 > /sys/class/rfkill/rfkill0/state
>
> > How to get HID Keyboard/Mouse working with G1/ADP1 and Master Branch
>
> > 0. get and build the latest Master version of Android for your ADP1:
> >http://groups.google.com/group/android-platform/browse_thread/thread/...
Reply all
Reply to author
Forward
0 new messages