SSブログ

BlueputDroid でスマホの BTキーボード化にチャレンジ(2) [Raspberry Pi]

前回、Windows への接続にあえなく失敗してしまった BlueputDroid ですが、今回は Raspberry Pi への接続にチャレンジしてみます。


0_raspberrypi.JPG


Raspberry Pi で Bluetooth を有効にしなければなりませんので、必要なソフトウェアをインストールします。下記のサイトを参考にしました。

Raspberry PiでBluetoothキーボードとマウスを使う
https://sites.google.com/site/kaimunantai/home/softwares/raspberrypi-bluetooth



(1) Bluetooth 関連のソフトウェアをインストール
二つのコマンドで打ち込むだけです。簡単ですね。

$ sudo apt-get  update
$ sudo apt-get  install bluetooth bluez-utils blueman


少し時間がかかりましたが無事インストールできました。


(2) Bluetooth USBアダプタを確認する
次にBluetooth USBアダプタが見つかるか確認します。

$ lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 0411:01a2 BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM Wireless LAN Adapter [Ralink RT8070]
Bus 001 Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)


無事見つかりました!BUFFALO の Bluetooth USBアダプタを使っていますが、中身はBUFFALOではないみたいですね。


(3) BlueputDroid on Xperia IS12S を探す
Xperia IS12S のBlueputDroid を立ち上げ、"START"ボタンを押して接続を待機します。

2_BlueDroid_Screen.png


hcitool scan でBTアドレスを確認します。

$ hcitool scan
Scanning ...
        xx:xx:xx:xx:xx:xx    Xperia acro HD IS12S


無事、見つかりました。


(4) BlueputDroid on Xperia IS12S と接続する
BlueputDroid と接続を試みてみます。うまく行くかな?

$ sudo bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx
Creating device failed: org.bluez.Error.AuthenticationRejected: Authentication Rejected


残念ながら失敗したみたいです。やはり簡単にはいかないか。。。

Google 先生に対処法を聞いてみたら答えが見つかりました。


RaspberryPiでBTキーボード
http://d.hatena.ne.jp/yunoya/20140330/1396114048


/usr/bin/bluez-simple-agent はスクリプトコマンドで中の記述を変更すれば問題が解消されるようです。viなどでbluez-simple-agent を開いて、92行目をコメントアウト、93行目を追加しました。

 #    capability = "KeyboardDisplay"
    capability = "DisplayYesNo"



もう一度試してみます。

$ sudo bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx
RequestConfirmation (/org/bluez/2197/hci0/dev_xx_xx_xx_xx_xx_xx, 804450)
Confirm passkey (yes/no): 


この間に、Xperia IS12S 側にペアリングのリクエストが来るので承諾します。

1_BlueputDroid_Paring.png

その後、コンソール側に”yes” を入力すれば接続が完了します。

$ sudo bluez-simple-agent hci0 xx:xx:xx:xx:xx:xx
RequestConfirmation (/org/bluez/2197/hci0/dev_xx_xx_xx_xx_xx_xx, 804450)
Confirm passkey (yes/no): yes
Release
New device (/org/bluez/2197/hci0/dev_xx_xx_xx_xx_xx_xx)


うまく行ったようです!


(5) 自動接続するように設定する
次のコマンドを打って自動接続するように設定します。

$ sudo bluez-test-device trusted xx:xx:xx:xx:xx:xx
$ sudo bluez-test-input connect xx:xx:xx:xx:xx:xx
Traceback (most recent call last):
  File "/usr/bin/bluez-test-input", line 40, in 
    input.Connect()
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__ return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__ **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.Failed: File descriptor in bad state


なんかエラーが出てしまいましたが、とにかく使ってみましょう。


(5) BlueputDroid を使ってみる
BlueputDroid 上に "raspberrypi-0" が追加されています。

2_BlueputDroid_ScreenCapture.png


クリックすると、キーボードが現れてきました。これは使えそうです!

3_BlueputDroid_Keyboard_for_RaspberryPi.png


で早速使ってみました。動画でどうぞ。




ばっちり動きました。再起動後も自動接続できました。自動接続設定時にエラーが出ましたが問題なかったようです。ここまで出来ると音声入力が欲しくなってきますね。
(^_^)/~


関連記事
BlueputDroid でスマホの BTキーボード化にチャレンジ(1)
http://makers-with-myson.blog.so-net.ne.jp/2015-07-05






Raspberry Pi 2 Model B (1)

Raspberry Pi 2 Model B (1)

  • 出版社/メーカー: Raspberry Pi
  • メディア: エレクトロニクス










nice!(39)  コメント(0) 
共通テーマ:趣味・カルチャー

nice! 39

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。