Jump to content

rfcomm don't connect


shineworld

Recommended Posts

Hi all.

I've got an issue trying to use Bluetooth and RFCOMM.

 

My system is:

Cubieboard2 running latest img and updated with apt-get update/upgrade:

  ____      _     _      _                         _   ____  
 / ___|   _| |__ (_) ___| |__   ___   __ _ _ __ __| | |___ \ 
| |  | | | | '_ \| |/ _ \ '_ \ / _ \ / _` | '__/ _` |   __) |
| |__| |_| | |_) | |  __/ |_) | (_) | (_| | | | (_| |  / __/ 
 \____\__,_|_.__/|_|\___|_.__/ \___/ \__,_|_|  \__,_| |_____|
                                                             

Welcome to ARMBIAN 5.25 stable Debian GNU/Linux 8 (jessie) 4.9.12-sunxi   
System load:   0.07            	Up time:       30 min		
Memory usage:  7 % of 1001Mb 	IP:            192.168.1.108
CPU temp:      33°C           	
Usage of /:    34% of 7.2G   	

Last login: Sun Mar 12 15:08:57 2017 from 192.168.1.103

root@cubieboard2:~# uname -a
Linux cubieboard2 4.9.12-sunxi #4 SMP Thu Feb 23 19:46:51 CET 2017 armv7l GNU/Linux

 

When I plug the Bluetooth USB dongle I get following dmesg:

root@cubieboard2:~# dmesg -c
[  102.456773] usb 4-1: new full-speed USB device number 2 using ohci-platform
[  102.726860] usb 4-1: New USB device found, idVendor=1131, idProduct=1004
[  102.726883] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  102.726893] usb 4-1: Product: ISSCEDRBTA
[  102.726903] usb 4-1: Manufacturer: ISSC
[  102.809982] Bluetooth: Core ver 2.22
[  102.810123] NET: Registered protocol family 31
[  102.810130] Bluetooth: HCI device and connection manager initialized
[  102.810158] Bluetooth: HCI socket layer initialized
[  102.810175] Bluetooth: L2CAP socket layer initialized
[  102.810269] Bluetooth: SCO socket layer initialized
[  102.852031] usbcore: registered new interface driver btusb
[  103.285771] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  103.285785] Bluetooth: BNEP filters: protocol multicast
[  103.285806] Bluetooth: BNEP socket layer initialized

root@cubieboard2:~# lsmod
Module                  Size  Used by
bnep                    8221  2 
btusb                  21996  0 
btrtl                   3731  1 btusb
btbcm                   4867  1 btusb
btintel                 5439  1 btusb
bluetooth             247916  24 btrtl,btintel,bnep,btbcm,btusb
cfg80211              337391  0 
rfkill                  8383  3 bluetooth,cfg80211
sun4i_codec            10104  3 
evdev                   9412  1 
snd_soc_core           97876  1 sun4i_codec
snd_pcm_dmaengine       2770  1 snd_soc_core
snd_pcm                57757  2 snd_pcm_dmaengine,snd_soc_core
nvmem_sunxi_sid         1967  0 
ir_lirc_codec           4088  0 
snd_timer              14809  1 snd_pcm
nvmem_core              7158  1 nvmem_sunxi_sid
lirc_dev                6245  1 ir_lirc_codec
snd                    35783  3 snd_timer,snd_soc_core,snd_pcm
soundcore                858  1 snd
sun4i_ts                3414  0 
sunxi_cir               3159  0 
sun4i_ss               13213  0 
cpufreq_dt              2920  0 
uio_pdrv_genirq         2780  0 
uio                     6272  1 uio_pdrv_genirq
bonding                82855  0 
fuse                   62841  1 

root@cubieboard2:~# hciconfig -a
hci0:	Type: BR/EDR  Bus: USB
	BD Address: 00:15:83:E3:4B:90  ACL MTU: 510:8  SCO MTU: 48:10
	UP RUNNING 
	RX bytes:541 acl:0 sco:0 events:28 errors:0
	TX bytes:1333 acl:0 sco:0 commands:28 errors:0
	Features: 0xff 0xfe 0xff 0xfe 0x98 0x3f 0x79 0x83
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: RSWITCH HOLD SNIFF 
	Link mode: SLAVE ACCEPT 
	Name: 'cubieboard2'
	Class: 0x000000
	Service Classes: Unspecified
	Device Class: Miscellaneous, 
	HCI Version: 2.1 (0x4)  Revision: 0x90e
	LMP Version: 2.1 (0x4)  Subversion: 0x316
	Manufacturer: Integrated System Solution Corp. (57)

PS: how you can see with lsmod result the RFCOMM module isn't yet loaded.

 

So BT dongle is working and I can find the desired a near powered HC - 05 Bluetooth Serial Module:

root@cubieboard2:~# hcitool scan
Scanning ...
	30:14:12:26:06:04	IQ021-0006

root@cubieboard2:~# hcitool info 30:14:12:26:06:04
Requesting information ...
	BD Address:  30:14:12:26:06:04
	Device Name: IQ021-0006
	LMP Version: 2.1 (0x4) LMP Subversion: 0x1735
	Manufacturer: Cambridge Silicon Radio (10)
	Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83
		<3-slot packets> <5-slot packets> <encryption> <slot offset> 
		<timing accuracy> <role switch> <hold mode> <sniff mode> 
		<park state> <RSSI> <channel quality> <SCO link> <HV2 packets> 
		<HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme> 
		<power control> <transparent SCO> <broadcast encrypt> 
		<EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan> 
		<interlaced iscan> <interlaced pscan> <inquiry with RSSI> 
		<extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave> 
		<AFH class. slave> <3-slot EDR ACL> <5-slot EDR ACL> 
		<sniff subrating> <pause encryption> <AFH cap. master> 
		<AFH class. master> <EDR eSCO 2 Mbps> <EDR eSCO 3 Mbps> 
		<3-slot EDR eSCO> <extended inquiry> <simple pairing> 
		<encapsulated PDU> <non-flush flag> <LSTO> <inquiry TX power> 
		<extended features> 

 

HC-05 has a default PIN number of 1234 for authentication so I've added right info in pincodes file

root@cubieboard2:/# echo "30:14:12:26:06:04 1234" >> /var/lib/bluetooth/00\:15\:83\:E3\:4B\:90/pincodes

 

At this point I try to bind and connect HC-05 with RFCOMM module to get /dev/rfcomm0:

root@cubieboard2:/# rfcomm -a

root@cubieboard2:/# ls -p /dev/rfc*
ls: cannot access /dev/rfc*: No such file or directory

root@cubieboard2:/# rfcomm bind rfcomm0 30:14:12:26:06:04 1

root@cubieboard2:/# rfcomm -a
rfcomm0: 30:14:12:26:06:04 channel 1 clean 

root@cubieboard2:/# ls -p /dev/rfc*
/dev/rfcomm0

root@cubieboard2:/# lsmod
Module                  Size  Used by
rfcomm                 25714  1 
bnep                    8221  2 
btusb                  21996  0 
btrtl                   3731  1 btusb
btbcm                   4867  1 btusb
btintel                 5439  1 btusb
bluetooth             247916  27 btrtl,btintel,bnep,btbcm,rfcomm,btusb
cfg80211              337391  0 
rfkill                  8383  3 bluetooth,cfg80211
sun4i_codec            10104  3 
evdev                   9412  1 
snd_soc_core           97876  1 sun4i_codec
snd_pcm_dmaengine       2770  1 snd_soc_core
snd_pcm                57757  2 snd_pcm_dmaengine,snd_soc_core
nvmem_sunxi_sid         1967  0 
ir_lirc_codec           4088  0 
snd_timer              14809  1 snd_pcm
nvmem_core              7158  1 nvmem_sunxi_sid
lirc_dev                6245  1 ir_lirc_codec
snd                    35783  3 snd_timer,snd_soc_core,snd_pcm
soundcore                858  1 snd
sun4i_ts                3414  0 
sunxi_cir               3159  0 
sun4i_ss               13213  0 
cpufreq_dt              2920  0 
uio_pdrv_genirq         2780  0 
uio                     6272  1 uio_pdrv_genirq
bonding                82855  0 
fuse                   62841  1 

root@cubieboard2:/# dmesg -c
[ 1088.424557] Bluetooth: RFCOMM TTY layer initialized
[ 1088.424601] Bluetooth: RFCOMM socket layer initialized
[ 1088.424637] Bluetooth: RFCOMM ver 1.11

/dev/rfcomm0 now exist and RFCOMM module is loaded by bluetooth module.

 

At this point I try to send some chars to HC-05 using screen with #screen /dev/rfcomm0 but 

screen exit just after one second killing screen program.

 

Same thing if I use picocom:

root@cubieboard2:/# picocom -b 9600 /dev/rfcomm0
picocom v1.7

port is        : /dev/rfcomm0
flowcontrol    : none
baudrate is    : 9600
parity is      : none
databits are   : 8
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,

Terminal ready

FATAL: term closed

 

Some ideas ?

Thank you very much in advance !!!

Silverio Diquigiovanni

 

 

 

Link to comment
Share on other sites

I've tried same thing on PC and after bind to rfcomm0 the GUI present a request for PIN code...
Seems that /var/lib/bluetooth/xx:xx:xx:xx:xx/pairing file method don't works so in a CLI system PIN code can't be entered :(

 

I've tried with bluetoothhctl agent to pair the USB dongle:

root@cubieboard2:/# bluetoothctl 
[NEW] Controller 00:15:83:E3:4B:90 cubieboard2 [default]
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:15:83:E3:4B:90 Discovering: yes
[NEW] Device 30:14:12:26:06:04 IQ021-0006
[bluetooth]# agent on
Agent registered
[bluetooth]# pair 30:14:12:26:06:04
Attempting to pair with 30:14:12:26:06:04
[CHG] Device 30:14:12:26:06:04 Connected: yes
Request PIN code
[agent] Enter PIN code: 1234
[CHG] Device 30:14:12:26:06:04 UUIDs:
	00001101-0000-1000-8000-00805f9b34fb
[CHG] Device 30:14:12:26:06:04 Paired: yes
Pairing successful
[CHG] Device 30:14:12:26:06:04 Connected: no
[bluetooth]# quit
Agent unregistered
[DEL] Controller 00:15:83:E3:4B:90 cubieboard2 [default]
root@cubieboard2:/# rfcomm -a
root@cubieboard2:/# rfcomm bind rfcomm0 30:14:12:26:06:04 1
root@cubieboard2:/# rfcomm -a
rfcomm0: 30:14:12:26:06:04 channel 1 clean 
root@cubieboard2:/# picocom -b 9600 /dev/rfcomm0
picocom v1.7

port is        : /dev/rfcomm0
flowcontrol    : none
baudrate is    : 9600
parity is      : none
databits are   : 8
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv
imap is        : 
omap is        : 
emap is        : crcrlf,delbs,

Terminal ready

Now system connect fine to /dev/rfcomm0

 

If someone know a NON interactive way to insert pairing PIN code I will be very happy.
Mine is a system without any user interface where a user attach its USB dongle and must get access to rfcommxx

just after plug.

 

Thank you very much for suggestions !!!

Silverio Diquigiovanni

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines