Bluetooth serial port openSUSE 13.1

Hello,

In the latest version of openSUSE I can not use RFCOMM, everything else works.

In previous openSUSE with other computers, simply use:

> sdptool add SP
Serial Port service registered
> rfcomm listen /dev/rfcomm0

But now the “sdptool add SP” ends in silence.

I do not see the DUN service:

> sdptool browse
Inquiring ...
Browsing D0:57:85:21:51:94 ...
Service RecHandle: 0x10000
Service Class ID List:
  "PnP Information" (0x1200)
Profile Descriptor List:
  "PnP Information" (0x1200)
    Version: 0x0102

Browsing D0:57:85:21:51:94 ...
Service Search failed: Invalid argument
Service Name: Audio SourceService RecHandle: 0x10001
Service Class ID List:
  "Audio Source" (0x110a)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 25
  "AVDTP" (0x0019)
    uint16: 0x102
Profile Descriptor List:
  "Advanced Audio" (0x110d)
    Version: 0x0102

Service Name: AVRCP TGService RecHandle: 0x10002
Service Class ID List:
  "AV Remote Target" (0x110c)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x103
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0103

Service Name: Voice GatewayService RecHandle: 0x10003
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 11
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0102

Service Name: OBEX Object PushService RecHandle: 0x10004
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 12
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0102

Browsing D0:57:85:21:51:94 ...
Service Search failed: Invalid argument
Service Name: Voice GatewayService RecHandle: 0x10005
Service Class ID List:
  "Handsfree Audio Gateway" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0106

Service Name: OBEX Phonebook Access ServerService RecHandle: 0x10006
Service Class ID List:
  "Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 19
  "OBEX" (0x0008)
Profile Descriptor List:
  "Phonebook Access" (0x1130)
    Version: 0x0100

Service Name: Network serviceService Description: Network serviceService RecHandle: 0x10007
Service Class ID List:
  "Network Access Point" (0x1116)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 15
  "BNEP" (0x000f)
    Version: 0x0100
    SEQ16: 800 806
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Network Access Point" (0x1116)
    Version: 0x0100

Service Name: OBEX File TransferService RecHandle: 0x10008
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 20
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0102

Browsing D0:57:85:21:51:94 ...
Service Search failed: Invalid argument

Nor do I see the directory or file: “/etc/bluetooth/rfcomm.conf” Although I did not really use :slight_smile:

Any help is greatly appreciated, thanks.

I don’t use bluetooth much so can only really offer general advice here. To get the serial bluetooth device node /dev/rfcomm* created, rfcomm first needs to be called to set up the serial subsystem. (Maybe udev was configured to automate this in the past.)

Here is a tutorial which may be of help to you:

http://www.mycrofters.com/content/bluetooth-and-serial-ports

You can ignore the wine advice towards the end, but it illustrates how to use a udev rule and simple script to get /dev/rfcomm0 created. You’ll also need to create /etc/bluetooth/rfcomm.conf with the relevant configuration entries.

You should also read ‘man rfcomm’ for more info.

BTW, a quick search online also turned up this

http://unix.stackexchange.com/questions/92255/how-do-i-connect-and-send-data-to-a-bluetooth-serial-port-on-linux

Thanks for your indications.

I had already checked that everything was loaded.
When I connect my USB Bluetooth adapter the last lines on RFCOMM are present:

> dmesg | grep Bluetooth
   20.517729] Bluetooth: Core ver 2.16
   20.517756] Bluetooth: HCI device and connection manager initialized
   20.517767] Bluetooth: HCI socket layer initialized
   20.517771] Bluetooth: L2CAP socket layer initialized
   20.517778] Bluetooth: SCO socket layer initialized
   20.762418] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
   20.762422] Bluetooth: BNEP filters: protocol multicast
   20.762433] Bluetooth: BNEP socket layer initialized
[11670.377176] Bluetooth: RFCOMM TTY layer initialized
[11670.377193] Bluetooth: RFCOMM socket layer initialized
[11670.377195] Bluetooth: RFCOMM ver 1.11

I’m using the same adapter for three different computers and the only one that does not work is the one installed openSUSE 13.1

The problem seems to be with the services, I have noticed some differences:
On openSUSE 13.1 there are some lines that say: “Service Search failed: Invalid argument” (You can see in my previous post).

The “sdptool browse local” command returns: “Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory”

Well, (https://01.org/jira/browse/BZ-2)it is a bug that has not yet been solved for almosta year! I’ll see if there is any alternative.

The problem supposedly solved withthe argument “-- compat” in “Bluetoothd”, but it did not work.

Process: 1263 ExecStart=/usr/lib/bluetooth/bluetoothd **--compact (code=exited, status=1/FAILURE)**

Do not know if I modified the wrong file: “/usr/lib/systemd/system/bluetooth.service”

sdpd is no longer used (is now integrated in blutoothd) and the sdp server is running, so that’s not the problem.

It’s not clear to me what the problem is , and the bug report you linked to refers to bluez. (I don’t have that installed anyway. Maybe you don’t either.)

If I do

hcitool dev

I get the my bluetooth device reported

Devices:
        hci0    00:1E:37:B5:D4:B7

With that hardware address, I can create /dev/rfcomm0 with

sudo rfcomm bind 00:1E:37:B5:D4:B7 /dev/rfcomm0

Confirmed that the RFCOMM device node exists with

ls -l /dev/rfcomm0
crw-rw---- 1 root dialout 216, 0 Apr 19 16:40 /dev/rfcomm0

Where’s the problem?

That’s another way, first creating the rfcomm0 file, but when I try to connect does not work.
After that command I try to connect using the computer too with my phone, result:

rfcomm connect 0 D0:57:85:21:51:94 #(0=hci0, D0:57:85:21:51:94=Phone)
**Can't connect RFCOMM socket: Connection refused**

The “sdptool add SP” command is now working, the correct parameter to pass bluetoothd is “–compat” or “-C”

I must add that everything is working, even KDE Networkmanager has added the phone as an “PANU” red.
I want to transmit data, such as a serial port.

When I try to make the connection with the previous command or from my phone, the icon indicates a links and blutooth led flashes fast then disconnects.

The connection I want to make is known as Bluetooth DUN - Bluetooth Dial-Up

You can install on your phone a Terminal program to see if it is actually working as a serial port.

Yes, but without being familiar with your hardware, that could be due to a number of factors. For example, it might be that you need to send a PIN code first.

The connection I want to make is known as Bluetooth DUN - Bluetooth Dial-Up

You can install on your phone a Terminal program to see if it is actually working as a serial port.[/QUOTE]

I’m interested in your progress, though I’ve never had need to do this and so not at all familiar with the process. :slight_smile:

You might try using ‘bluetoothctl’ to establish a connection:

http://delx.net.au/blog/2014/03/bluetooth-dun-tethering-with-linux-and-a-nokia-symbian-phone/

The “sdptool add SP” command is now working, the correct parameter to pass bluetoothd is “–compat” or “-C”

I must add that everything is working, even KDE Networkmanager has added the phone as an “PANU” red.
I want to transmit data, such as a serial port.

When I try to make the connection with the previous command or from my phone, the icon indicates a links and blutooth led flashes fast then disconnects.

The connection I want to make is known as Bluetooth DUN - Bluetooth Dial-Up

You can install on your phone a Terminal program to see if it is actually working as a serial port.

I’m sure you’ll get this working, and when you do, I think it will be worthwhile writing up a ‘how to’. :slight_smile:

The device is already paired, so do not have to enter any PIN.

What I try to do is something simple, I have years doing it, but now does not work in openSUSE 13.1

> sdptool add SP
Serial Port service registered
> rfcomm listen /dev/rfcomm0

Oh, and yes, I have bluez installed (There are the files needed to use Bluetooth).

The bluez-test package I have also installed.

 **rctest** is used to test RFCOMM communications on the Bluetooth stack.

rctest fails (waits a connection that never happens).

Finally I found the solution on Freenode talking with a developer.

All commands must be executed as root.

sudo sdptool add SP
sudo rfcomm listen /dev/rfcomm0

Do not forget add “-C” or “–compat” in “/usr/lib/systemd/system/bluetooth.service” for backward compatibility.

As annotations I’ll leave the following information:

[15:30] <jhe> I think the permissions thing is just a difference between BlueZ 4.x and 5.x
[15:31] <jhe> 5.x defaults to root-only
[15:32] <luisdigital> Someday KDE will integrate the service into your GUI.
[15:32] <jhe> it should then use the Profile D-Bus interface
[15:32] <luisdigital>  For years the request was made.
[15:32] <jhe> that's basically what is considered to supersede sdptool add
[15:33] <luisdigital> Where I can find information to connect the serial port over Bluetooth using the modern way?
[15:35] <jhe>  luisdigital: the D-Bus interface is documented in doc/profile-api.txt,  and test/test-profile shows how to implement it in python
[15:35] <jhe>  luisdigital: however this all depends on how you intend to use it. if  you really need a TTY and a direct fd/socket is not acceptable then  you'd still need to stick to the rfcomm tool.
[15:36] <jhe>  luisdigital: reason being that you get the RFCOMM socket through a  NewConnection() D-Bus call with the Profile interface. i.e. there is not  associated TTY device node.

Well, every site I’ve visited seems to vary in the method used to establish a connection. I can do so (with my iPhone) using the KDE Bluetooth widget, or by ‘bluetoothctl’

bluetoothctl
[NEW] Controller 00:1E:37:B5:D4:B7 linux-bbgi.site [default]
[NEW] Device 50:EA:D6:67:38:93 Dean’s iPhone
# connect 50:EA:D6:67:38:93 
Attempting to connect to 50:EA:D6:67:38:93
Connection successful
# info 50:EA:D6:67:38:93
Device 50:EA:D6:67:38:93
        Name: Dean’s iPhone
        Alias: Dean’s iPhone
        Class: 0x7a020c
        Icon: phone
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: yes
        UUID: Vendor specific           (00000000-deca-fade-deca-deafdecacafe)
        UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: NAP                       (00001116-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
        UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
        UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v05ACp1297d0710

Unfortunately, DUN is not one of the services offered, so obviously I can not test this aspect.

I recall that you mentioned the DUN service is not reported via ‘sdptool’ so that is the essence of the problem. I have no idea what might have changed. Do you use it to gain dialup networking via your mobile? Or some other reason that I’m not aware of? (Many only ever tether for mobile broadband connectivity these days.)

The problem was identified in a previous post: Now is need to have root privileges to run the commands in this version of BlueZ

The serial port service appears after running: “sudo sdptool add SP”

I have not used iPhone for a long time and I do not know if it is true that only serve to connect audio devices.

I use these connections to communicate wirelessly with microcontrollers.

Thank you for your help.

Hmmm…given that /dev/rfcomm* is assigned to the ‘dialout’ group, have you made sure that your user account is a member of that group?

Yes, it is necessary to use the device.
Now it is also necessary to have root privileges to execute commands and functioning correctly.

I can’t test that, but maybe you should submit a bug report. Anyway, thanks to your opening this thread, I did test PAN connectivity with my iPhone (via bluetooth), and that works flawlessly (user controlled), so that’s a bonus. (I think I did read somewhere that NM will gain support for DUN with the bluez5 stack.)

Bug 306632 - kde bluetooth wizard should bind rfcomm serial devices

That’s a long-awaited solution. In Windows users simply have COMx port available and should not configure anything.

I agree, but I suspect the demand for it is low. (I’m not aware of any recent posts on the subject.) Most use wifi or usb tethering when needed I guess.

Well, one possible workaround is to modify rfcomm to become ‘suid root’ like this

sudo chmod u+s /usr/bin/rfcomm

Now when it is executed by a regular user, it will run with root privileges (since it is root owned to begin with), but it has security implications. (The same trick is done with ‘wvdial’ by some people.)

Yes. Thank you.