# bluetooth problem - cannot open /dev/rfcomm0: Connec

## mtombs

I'm trying to connect to my SonyEricsson T610 to use if for dial-up. I can scan it :

```
localhost bluetooth # hcitool scan

Scanning ...

        00:0A:D9:E4:02:08       Mark

```

I can ping it:

```

localhost bluetooth # l2ping 00:0A:D9:E4:02:08

Ping: 00:0A:D9:E4:02:08 from 00:10:C6:4B:DF:34 (data size 44) ...

0 bytes from 00:0A:D9:E4:02:08 id 0 time 42.92ms

0 bytes from 00:0A:D9:E4:02:08 id 1 time 34.64ms

0 bytes from 00:0A:D9:E4:02:08 id 2 time 41.83ms

3 sent, 3 received, 0% loss
```

I can bind it :

```

localhost bluetooth # 2fcomm bind 0 00:0A:D9:E4:02:08 1

localhost bluetooth # rfcomm show

rfcomm0: 00:0A:D9:E4:02:08 channel 1 closed 
```

But when I try and connect I get  

```
cannot open /dev/rfcomm0: Connection refused
```

If I delete the laptop from my devices on my mobile, when I try and connect I am asked to enter my pin, which I do, but I still get connection refused. My pin is correct.

Please help as I've been banging my head on the desk all day.

----------

## neonknight

What are the permissions of /dev/rfcomm0?

Try 

```
ls -l /dev/rfcomm0
```

----------

## mtombs

it was:

```
crw-rw----  1 root dialout 216, 0 Sep  8 16:09 /dev/rfcomm0
```

I am running this as root so it should be ok... changed it to 

```
crwxrwxrwx  1 root dialout 216, 0 Sep  8 16:09 /dev/rfcomm0

```

And I still get the same thing.

----------

## jamapii

Same problem here.

I'm using Linux 2.6, it has been reported to work on 2.4, examples

http://kotinetti.suomi.net/mcfrisk/linux_gprs.html

https://forums.gentoo.org/viewtopic-t-253260-highlight-gprs+bluetooth.html

After "pppd call gprs", the phone reports an incoming connection, and I need to click OK on the phone to accept it. This is immediately disconnected. Then the error message appears "Failed to open /dev/rfcomm0: Connection refused"

I suspect bluepin to be the problem, but I tried "xhost +" and various security settings, no change...

I have seen this in /usr/bin/bluepin and in a bug. 

```

# Set X display before initializing GTK

set_display()

import gtk

# Some versions of fontconfig will segfault if HOME isn't set.

os.environ['HOME'] = ""

```

How can this work? This requires an X server. This probably requires that the ppp connection is started as user, or "xhost +" is typed, and bluepin is run as user. So what conditions must be met to get a bluetooth connection? If possible, I don't want to enter PINs in X11 windows, and no more than once on the phone. MS Windows requires a lot of PIN and other voodoo and beeping on the phone before it establishes a connection. I'm hoping to automate this.

I have /dev/rfcomm0, that was needed at some time, is this still correct? or do I need /dev/*/rfcomm/0 or something?

----------

## sirlark

Just in case you haven't found the solution already...

First check /etc/bluetooth/hcid.conf and look for

```
pin_helper /usr/bin/bluepin;
```

replace with

```
pin_hleper /etc/bluetooth/pin-helper
```

Reasons...

bluepin doesn't seem to work, even when X is running, and obviously won't when X is not running. So we tell hcid to use a tiny script supplied by the gentoo guys (thanks be) called pin helper, which literally prints out PIN:XXXX where XXXX is the contents of /etc/bluetooth/pin, which you should edit to contain the pin with which hcid will respond if a PIN is requested by a bluetooth device. hcid will also send this PIN when requesting authentication. Obviously this method locks you down to only one PIN, but hey it gets things working

Good Luck

----------

