1

I am having trouble connecting to my phone via serial bluetooth on an embedded linux system. Here are the steps that I have taken to attempt a connection. (Note that I am able to pair and connect just fine using bluetoothctl)

OS: Linux nitrogen6x 4.1.15-2.0.0-ga+yocto+g651db0b #1 SMP PREEMPT Thu Feb 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

Here is where I get stuck. I have no idea why the connection is being refused when I can connect without problems using bluetoothctl (confirmed on my phone). It took me awhile to get here so I am not exactly sure what is the difference between bluetoothctl and rfcomm. From poking around I just see that you need to use rfcomm to get a serial connection. All I want to do is to grab my phone contacts from my phone using command line. I guess I am also asking if it is achievable to get my phone contacts without using rfcomm but using a connection through bluetoothctl.

P.S. If anyone knows how to grab files from my phone via command line without using OBEX I would appreciate it as well!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.