zoukankan      html  css  js  c++  java
  • 转发Android手机连接蓝牙键盘

    Android手机Nexus One连接Apple Bluetooth Keyboard
    Posted on August 20, 2010 by henry
    首先所有带蓝牙的android手机理论上都是可以连接蓝牙键盘鼠标的(Human Interface Device),不幸地是官方蓝牙profile中默认不包括HID profile。所以只有采用第三方的ROM如Cyanogen(CM6版本以上)或在官方的rom上搭配bluez utility来实现蓝牙键鼠的连接。
    这里我们仅讨论第二种在官方ROM上添加工具的方案。手机必须取得root权限,或者是ADP (Android Dev Phone),并且需要安装busybox。
    1. 先下载需要的工具。
    $ wget http://androidobex.googlecode.com/files/hciconfig
    $ wget http://androidobex.googlecode.com/files/hcitool
    $ wget http://androidobex.googlecode.com/files/hidd
    2. 提升到root权限,并且将/system挂载成可读写,默认为read-only
    $ su
    # mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    # chmod 777 /system/xbin
    3. 从本地复制第一步下载的文件到手机
    $ adb push hidd /system/xbin
    $ adb push hcitool /system/xbin
    $ adb push hciconfig /system/xbin
    4. 如果你的手机不是ADP的话,可能无法直接从本地电脑复制文件到手机。这样你可以先用usb线连接手机,把以上三个文件复制到sdcard根目录上,然后执行。
    # cp /sdcard/hidd /system/xbin/
    # cp /sdcard/hcitool /system/xbin/
    # cp /sdcard/hciconfig /system/xbin/
    5. 打开手机蓝牙,在Settings -> Wireless & network settings -> Bluetooth settings中找到键盘并且配对。pin code可以填写0000,配对成功后会发现该设备显示为’paried but not connected’,这是因为缺少HID profile。
    6. 现在要用到之前拷入手机的三个文件。实际情况中设备的Mac地址会与下面的例子有所不同,根据实际情况输入。
    # 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
    # hidd –connect 00:1D:4F:A7:9A:49
    # hcitool con
    Connections:
    < ACL 00:1D:4F:A7:9A:49 handle 1 state 1 lm MASTER
    9. 至此,Apple Bluetooth Keyboard连接成功。打开任意程序蓝牙键盘敲击的键将出现在输入栏。经过测试,谷歌中文法也可以正常使用并且可以用数字键选择候选字。
    10. 剩下的问题就是苹果的键盘的多功能键(调节音量,屏幕亮度)暂时还不能在手机里使用,有待进一步研究如何修改这几个键位。

    转载:http://hi.baidu.com/fanrifei/blog/item/5a79607a0bf25fe22e73b3dc.html

  • 相关阅读:
    JSP基础语法:注释、Scriptlet、编译指令
    JDBC的LIKE书写规范
    AWT回顾篇
    1.五子棋预备知识
    对象的生命周期回顾篇
    学习activemq(2)写个简单的程序
    activemq in action(3)剖析JMS消息(转)
    activemq in action(1)
    学习activemq(3)
    hadhoop安装
  • 原文地址:https://www.cnblogs.com/sunzhenxing19860608/p/Android.html
Copyright © 2011-2022 走看看