Bluetoothシリアルポートを介して携帯電話に接続する方法

Bluetoothシリアルポートを介して携帯電話に接続する方法

組み込みLinuxシステムでは、シリアルBluetooth経由で携帯電話に接続する際に問題があります。以下は、接続を確立するためにとったステップです。 (bluetoothctlを使用してペアリングして接続できます。)

OS: Linux nut6x 4.1.15-2.0.0-ga+yocto+g651db0b #1 SMPプリエンプション Thu 2月16日 15:53:27 PST 2017 armv7l armv7l armv7l GNU/Linux

root@embeddedsystem:~# echo 0 > /sys/class/rfkill/rfkill0/state
root@embeddedsystem:~# echo 1 > /sys/class/rfkill/rfkill0/state 
root@embeddedsystem:~# hciattach -t 30 -s 115200 /dev/ttymxc2 texas 3000000 flow
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/ti-connectivity/TIInit_7.6.15.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Bluetooth: HCI UART driver ver 2.3
Bluetooth: HCI UART protocol H4 registered
Bluetooth: HCI UART protocol LL registered
Device setup complete
root@embeddedsystem:~# hciconfig hci0 up
root@embeddedsystem:~# hciconfig hci0 sspmode 1 //simple pairing

//Enable controller
root@embeddedsystem:~# bluetoothctl
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# default-agent
[bluetooth]# quit

root@embeddedsystem:~# rfcomm bind /dev/rfcomm0 AA:AA:AA:AA:AA:AA 22
root@embeddedsystem:~# sdptool add --channel=22 SP //Serial port on channel 22
root@embeddedsystem:~# rfcomm //check to see if channel is ok
rfcomm0: AA:AA:AA:AA:AA:AA channel 22 clean
root@embeddedsystem:~# rfcomm connect /dev/rfcomm0 AA:AA:AA:AA:AA:AA 22
Can't connect RFCOMM socket: Connection refused

これが私が付いているところです。 bluetoothctlを使用して問題なく接続できますが、なぜ接続が拒否されるのかわかりません(携帯電話で確認済み)。ここまで来るのに少し時間がかかったので、bluetoothctlとrfcommの違いは何なのかわかりません。あちこちで遊んでシリアル接続を得るにはrfcommを使う必要があることがわかりました。私が望むのは、コマンドラインを使用して電話からモバイル連絡先をインポートすることです。 rfcommを使用せずにbluetoothctlを介して接続せずに電話連絡先を取得できるかどうかを尋ねているようです。

PS OBEXを使わずにコマンドラインで自分の携帯電話からファイルをインポートする方法を知っている人がいる場合は、教えてください。

ベストアンサー1

おすすめ記事