Wednesday, September 2, 2009

Connect Bluetooth Keyboard in Android Dev Phone

I have an Apple Wireless Keyboard and how do I connect it with G1 or any Android phones? I am using Android Dev Phone for my example, so I already have its root permission. If you are using other Android phone, not ADP, you have to get root permission first!! BTW, my working machine is Ubuntu 9.04!

Download related bluetooth utilities here or build it yourself!

$ wget http://androidobex.googlecode.com/files/hciconfig
$ wget http://androidobex.googlecode.com/files/hcitool
$ wget http://androidobex.googlecode.com/files/hidd


Change mount and folder permission in Android Dev Phone

$ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# chmod 777 /system/xbin


Upload related bluetooth utilities to Android Dev phone

$ adb push hidd /system/xbin
$ adb push hcitool /system/xbin
$ adb push hciconfig /system/xbin


Turn Bluetooth ON from Setting UI and click 'Scan for devices'



Press 'Apple Wireless Keyboard' and it would appear Pair request



Type '0000' or '1111' as pin code and it would appear 'Paired but not connected'




Let's type some bluez utilities commands to make it work!

# hciconfig
hci0: Type: UART
BD Address: 00:22:A5:B8:AD:65 ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:8672 acl:98 sco:0 events:285 errors:0
TX bytes:3336 acl:102 sco:0 commands:89 errors:0

# hcitool dev
Devices:
hci0 00:22:A5:B8:AD:65

# hcitool scan
Scanning ...
00:1D:4F:A7:9A:49 Apple Wireless Keyboard
00:22:43:C6:5B:B9 daydreamer-0
00:18:C5:42:18:78 Erin-Nokia N73

# hidd --connect 00:1D:4F:A7:9A:49

# hcitool con
Connections:
< ACL 00:1D:4F:A7:9A:49 handle 1 state 1 lm MASTER



DONE! I can connect to Bluetooth Keyboard in Android. It's more convenient when I type email, message, or chat with friends now!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.