Results 1 to 4 of 4

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

  1. #1

    Default 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:
    Code:
    grb@frodo:~> sudo cat /dev/rfcomm0
    
    $GPGGA,025729.000,2647.1527,S,15308.1948,E,1,8,1.01,12.7,M,39.2,M,,*73
    $GPGSA,A,3,25,05,12,29,15,26,18,21,,,,,2.57,1.01,2.36*05
    $GPGSV,3,1,10,29,67,174,25,50,57,342,,25,43,338,28,21,35,250,22*77
    $GPGSV,3,2,10,05,29,139,18,15,29,047,30,18,27,322,25,26,22,093,29*77
    $GPGSV,3,3,10,12,20,007,24,02,02,108,17*77
    $GPRMC,025729.000,A,2647.1527,S,15308.1948,E,0.02,259.76,030513,,,A*7C
    ........
    As an ordinary user:
    Code:
    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.
    Code:
    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.
    Code:
    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

  2. #2
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,280
    Blog Entries
    1

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

    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

    Code:
    rfcomm2 {
            bind yes;
            device < GPS MAC ADDRESS>;
            channel 1;
            comment "Serial Port";
            }
    *You'll need to get your GPS MAC address via
    Code:
    hcitool scan
    Connect with
    Code:
    rfcomm connect 2
    Can you then access it?

  3. #3

    Thumbs up Re: Bluetooth; Can't access GPS receiver (as an ordinary user)

    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:
    Code:
    grb@frodo:~> rfcomm bind 9
    
    grb@frodo:~> cat /dev/rfcomm9 
    $GPGGA,043018.371,,,,,0,0,,,M,,M,,*43
    $GPGSA,A,1,,,,,,,,,,,,,,,*1E
    $GPGSV,3,1,10,18,63,272,,29,59,040,,21,55,190,,15,45,103,*7E
    $GPGSV,3,2,10,22,32,296,,16,16,238,,26,15,135,,06,11,220,*7D
    $GPGSV,3,3,10,25,05,000,,14,01,344,*7D
    ................

    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

  4. #4
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,280
    Blog Entries
    1

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

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •