# bluetooth "Can't connect RFCOMM socket: Connection refused"

## szczerb

I'm not sure if it's the right forum for that - if not please move it.

I have lots of guides on connecting bluetooth devices. I need to use my phone as a gprs modem and bluetooth is the only avaialable connection (since I don't have a cable for it).

This is what I get:

```
nomad szczerb # rfcomm 

rfcomm0: 00:12:37:AC:32:68 channel 1 clean 

nomad szczerb # rfcomm connect 0

Can't connect RFCOMM socket: Connection refused

nomad szczerb # rfcomm 

rfcomm0: 00:12:37:AC:32:68 channel 1 clean 
```

l2ping works just fine.

hcid.conf

```
#

# HCI daemon configuration file.

#

# HCId options

options {

   # Automatically initialize new devices

   autoinit yes;

   # Security Manager mode

   #   none - Security manager disabled

   #   auto - Use local PIN for incoming connections

   #   user - Always ask user for a PIN

   #

   security auto;

   # Pairing mode

   #   none  - Pairing disabled

   #   multi - Allow pairing with already paired devices

   #   once  - Pair once and deny successive attempts

   pairing multi;

   # Default PIN code for incoming connections

   passkey "131186";

}

# Default settings for HCI devices

laptop device {

   # Local device name

   #   %d - device id

   #   %h - host name

   name "%h (%d)";

   # Local device class

   class 0x3e010c;

   # Default packet type

   #pkt_type DH1,DM1,HV1;

   # Inquiry and Page scan

   iscan enable; pscan enable;

   # Default link mode

   #   none   - no specific policy 

   #   accept - always accept incoming connections

   #   master - become master on incoming connections,

   #            deny role switch on outgoing connections

   lm accept;

   # Default link policy

   #   none    - no specific policy

   #   rswitch - allow role switch

   #   hold    - allow hold mode

   #   sniff   - allow sniff mode

   #   park    - allow park mode

   lp rswitch,hold,sniff,park;

}
```

input.conf

```
# Configuration file for the input service

# This section contains options which are not specific to any

# particular interface

[General]

# Set idle timeout (in minutes) before the connection will

# be disconnect (defaults to 0 for no timeout)

#IdleTimeout=30
```

rfcomm.conf

```
#

# RFCOMM configuration file.

#

rfcomm0 {

   # Automatically bind the device at startup

   bind yes;

   # Bluetooth address of the device

   device 00:12:37:AC:32:68;

   # RFCOMM channel for the connection

   channel   1;

   # Description of the connection

   comment "Sagem myX6-2";

}
```

```
nomad szczerb # ls -l /dev/rfcomm0 

crw-rw-rw- 1 root uucp 216, 0 IX 16 14:45 /dev/rfcomm0
```

Pairing works just fine so I don't post my /etc/bluetooth/pin

If some guide mentions this problem, it is always resolved by unpairing and pairing again. I have tried it many times with restarts etc.

Anyone has some ideas?

----------

## kernelhacker

Hi,

 *szczerb wrote:*   

> I'm not sure if it's the right forum for that - if not please move it.
> 
> I have lots of guides on connecting bluetooth devices. I need to use my phone as a gprs modem and bluetooth is the only avaialable connection (since I don't have a cable for it).
> 
> [SNIP]
> ...

 

Sounds like you have got the same problem as me and your bluetooth services get stopped when a new device is connected and your /dev/rfcomm0 gets accessed. I "fixed" it like this:

in /etc/udev/rules.d/70-bluetooth.rules i changed:

```
SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*" , RUN+="bluetooth.sh" 
```

to

```
SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*" 
```

So the bluetooth.sh script does not get called by udev anymore and /etc/init.d/bluetooth does not get stopped anymore. 

Please try that and tell me if that worked for you!

hth and greetings,

Stefan

----------

## szczerb

I've read that topic and I tried that. Just forgot to mention it - sorry.

That's how it looks:

```
szczerb@nomad ~ $ cat /etc/udev/rules.d/70-bluetooth.rules 

# Start/Stop bluetooth service on device insertion. Gentoo specific.

SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*"

#, RUN+="bluetooth.sh"

# So that normal users can dial out.

SUBSYSTEM=="tty", SUBSYSTEMS=="bluetooth", GROUP="uucp"
```

Anything else guys?  :Smile: 

----------

## kernelhacker

 *szczerb wrote:*   

> I've read that topic and I tried that. Just forgot to mention it - sorry.
> 
> That's how it looks:
> 
> ```
> ...

 

Hm, try to increase the udev log level using 

```
 udevcontrol log_priority=X 
```

I cannot test which number for X gives reasonable results, you just have to try that. Maybe we can see what happens and if it is udev related!

----------

## szczerb

I don't have udevcontrol utility. In what package is that?

----------

## kernelhacker

 *szczerb wrote:*   

> I don't have udevcontrol utility. In what package is that?

 

Sorry - udevcontrol seems to be old style. You have to use udevadm, which is part of the udev ebuild, which is already installed.

```

udevadm control --log-priority=X

```

hth,

Stefan

----------

