Bluetooth; Can't access GPS receiver (as an ordinary user)

I am trying to set-up a bluetooth gps receiver to supply navigational data for two applications; OziExplorer (running under Wine) and BT747D. I am running openSUSE 12.3 with KDE 4.10.2 and using an external usb bluetooth dongle.

The receiver connects corrrectly and establishes the proper device (/dev/rfcomm0). However neither application can access the device.

I can manually access the device as root, and read the output from the receiver. But I cannot access the device as an ordinary user.

As root there is a continuous stream of data:

grb@frodo:~> sudo cat /dev/rfcomm0


As an ordinary user: >:(

grb@frodo:~> cat /dev/rfcomm0
cat: /dev/rfcomm0: Device or resource busy

This doesn’t appear to be a permissions issue. I belong to the ‘dialout’ group and the device has read/write permissions for that group.

grb@frodo:~> group
users uucp dialout video lock vboxusers

grb@frodo:~> ls -la /dev/rfcomm0
crw-rw---- 1 root dialout 216, 0 May  3 11:57 /dev/rfcomm0

Possibly, the problem is due to another application using the device.

grb@frodo:~> sudo fuser /dev/rfcomm0 
/dev/rfcomm0:         1575

grb@frodo:~> ps -p 1575
  PID TTY          TIME CMD
 1575 ?        00:00:00 bluetoothd

Shows the device has been claimed by the bluetoothd daemon. Is this normal and does it prevent access by others?

So I am wondering if anybody else has run into this problem or have any ideas how to allow an ordinary user to access/read the device. I certainly don’t want to be forced to run the applications with elevated privileges.

Many thanks

I’ve just read this Ubuntu thread which suggests setting up another rfcomm device by setting up a config in /etc/bluetooth/rfcomm.conf like this

rfcomm2 {
        bind yes;
        device < GPS MAC ADDRESS>;
        channel 1;
        comment "Serial Port";

*You’ll need to get your GPS MAC address via

hcitool scan

Connect with

rfcomm connect 2

Can you then access it?

Many thanks for your reply and the linked reference.

I already had a bluetooth connection in place - the problem was that after the /dev/rfcommX device was established I couldn’t connect to it as an ordinary user.

But sifting through the thread made me realize I hadn’t understood the difference between the rfcomm connect and the rfcomm bind commands.

I was using rfcomm connect which establishes /dev/rfcommX and immediately opens a channel to the bluetooth device. So /dev/rfcommX is no longer available to other applications and the “Device or resource busy” exception is raised if any further attempt is made (as an ordinary user anyway) to connect to it. It appears both the blueman and bluedevil GUI managers also use this style of connection.

In contrast, rfcomm bind only establishes the /dev/rfcommX device; it doesn’t open a channel. It is only when the first application connects to the device that ownership is established and a channel is opened.

So once I used rfcomm bind in place of rfcomm connect I could connect to the device as an ordinary user and read the GPS data:

grb@frodo:~> rfcomm bind 9

grb@frodo:~> cat /dev/rfcomm9 

And OziExplorer now works fine as well.

I can now go ahead and install openSUSE on my little Acer Aspire One netbook which I use for travel, getting rid of my last remaining copy of Windows.

Many thanks

Glad to be of assistance. Good result, and thanks for sharing your discoveries during this learning curve. It will be helpful to others who come searching. :slight_smile: