LEAP 15.1 and UART over Bluetooth. Can it be done?

I have been look for a solution to this for years! None of the post (here or elsewhere) have got me anywhere near a solution.

Use case
I have Bluetooth LE devices hanging of my projects. See HM -11 Data Sheet (5th down, LH side)
I can send/receive serial information to/from Android devices (there are many Apps out there - this is just one):

https://susepaste.org/images/86171711.png

I would like to do the same thing using my LEAP 15.1 workstation. Seems simple, but …
Any help would be greatly appreciated. A GUI would be lovely but I think I could cope at the command line?

Regards, Martin

Try looking at the Spice protocol.
It can be used for implementing serial over networking in general.

TSU

I’d also be curious what problems you have with whatever you’ve tried to set up.
Bluetooth is fundamentally a serial protocol, so in general when any device places data on a BT connection,
Then it should be accepted and read without any problem by a device on the other end of the BT connection.
The main obstacle generally is just getting the devices to make that BT connection which would require both ends using a common BT profile (ie configuration type), but once the connection is made, things should “just work” if on the receiving side you configure your terminal to point to the BT connection.

There is probably nothing too special about the BT Terminal app installed on your Android…
It’s likely an ordinary terminal that defaults to the BT serial port which saves you a little bit of manual effort.
And, prettied up… :slight_smile:

TSU

Okay. Here goes…

By analogy with a usb serial device I need to create a device:
The usb serial will be somthing like** /dev/ttyACM0** or /dev/ttyUSB0 but the bluetooth device will be /dev/rfcomm0
Then using a Linux terminal program such as Minicom or CuteComm open the device. Job done? But no…

  1. Create a device:
rfcomm bind /dev/rfcomm0 34:03:DE:37:B6:32 1
ls /dev/rfc*
/dev/rfcomm0

Now run CuteCom and select /dev/rfcomm0 from the device drop-down (it will not show if it does not exist)

Five second later, this happens…

You didn’t describe what you’ve done to establi8sh your bluetooth connection in TW (May depend on what Desktop you’re running).,

But since you describe at least using the rfcom protocol and CuteCom,
Have you seen the following article which describes everythin he set up prior to attaching CuteCom?

http://pi19404.github.io/pyVision/2015/04/03/22/

Note that modern Desktops might have their own and possibly better BT support than what is described in the article but AFAIK setup should still be similar.

TSU

Sorry. I’ll do that below - not easy! Also, I am using Leap 15.1 and not TW (Tumbleweed)

Have you seen the following article which describes everythin he set up prior to attaching CuteCom?

Yes, I have. In fact it was one of my primary sources, as it claimed to be using the “official bluetooth stack” - Bluez and it is not that old (2015).
And as far as I can tell, Bluez is the default in KDE (I’m using Plasma 5.12.8). So If I follow the “walk-through” that you mentioned, can you suggest why it is not working for me?

Step 1. The author tells us to install the required packages…

mprowe@gzunder:~> rpm -qa | grep bluez*
pulseaudio-module-bluetooth-11.1-lp151.5.3.x86_64
bluedevil5-5.12.8-lp151.1.2.x86_64
bluez-devel-5.48-lp151.8.3.1.x86_64
bluez-firmware-1.2-lp151.2.1.x86_64
libbluetooth3-5.48-lp151.8.3.1.x86_64
bluez-5.48-lp151.8.3.1.x86_64
bluez-auto-enable-devices-5.48-lp151.8.3.1.noarch
bluez-test-5.48-lp151.8.3.1.x86_64
bluez-qt-udev-5.55.0-lp151.1.1.x86_64
bluez-qt-imports-5.55.0-lp151.1.1.x86_64
bluez-tools-0.1.38+git20161212-lp151.2.2.x86_64
bluedevil5-lang-5.12.8-lp151.1.2.noarch
mprowe@gzunder:~>

Step 2. Report BT adaptor details…

mprowe@gzunder:~> hciconfig
hci0:   Type: Primary  Bus: USB
        BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN 
        RX bytes:11886 acl:84 sco:0 events:325 errors:0
        TX bytes:8878 acl:88 sco:0 commands:87 errors:0

mprowe@gzunder:~> 

Step 3. Find the address of the target…

mprowe@gzunder:~> hcitool scan
Scanning ...
        80:58:F8:57:1D:14       Moto G (5)
mprowe@gzunder:~> 

For this setup, I am using a bog-standard Android phone to avoid any possibility that I am generating a problem with my HM-11’s and HM-13’s.
I can also say that this phone is connecting with my workstation in all other respects (file transfer, Dolphin integration etc)

Up to this point (step 3)… So far, so good! Now it falls off the rails! The Author now ask that we pair the two devices using the bluez-simple-agent!
This utility was phased out at Bluez4 (I am using bluez-5.48-lp151.8.3.1.x86_64). I understand that the replacement is bluetoothctl.
I have not been able to find a walk-through using bluetoothctl. Maybe it does not matter - I can use the KDE GUI BlueDevel5 (or can I?)

Using BlueDevel5…

… I think I can successfully pair my workstation to this Device (both the Moto5(G) and the HM-11). If this is so, I was hoping that the next stage would be …

a) Run rfcomm to create the /dev/rfcomm0
b) Connect to it with CuteCom.

However, as reported earlier, this does not work.

~Martin~

Here is the ArchWiki describing how to connect using bluetoothctl.
Note that it links to the Bluetooth ArchWiki which describes what is needed to set up to where you can use bluetoothctl… Although KDE should have taken care of all that you might still verify all is correct

https://wiki.archlinux.org/index.php/Bluetooth

TSU

Hi “TSU”,

Thank you for that link. However…:frowning:

Working from the top down (maybe not the best route?), all seemed fine. Following the “Example Session” given, I get this output (my input in bold):

gzunder:~ # **bluetoothctl**                       
[NEW] Controller 00:1A:7D:DA:71:13 gzunder [default]
[NEW] Device 34:03:DE:37:B6:32 HM-11
Agent registered
[bluetooth]# **agent KeyboardOnly**
Agent is already registered
[bluetooth]# **default-agent**
Default agent request successful
[bluetooth]# **power on**
Changing power on succeeded
[bluetooth]# **scan on**
Discovery started
[CHG] Controller 00:1A:7D:DA:71:13 Discovering: yes
[CHG] Device 34:03:DE:37:B6:32 RSSI: -47
[CHG] Device 34:03:DE:37:B6:32 TxPower: 0
[CHG] Device 34:03:DE:37:B6:32 ManufacturerData Key: 0x4d48
[CHG] Device 34:03:DE:37:B6:32 ManufacturerData Value:  34 03 de 37 b6 32  4..7.2          
[CHG] Device 34:03:DE:37:B6:32 ServiceData Key: 0000b000-0000-1000-8000-00805f9b34fb
[CHG] Device 34:03:DE:37:B6:32 ServiceData Value:  00 00 00 00                                      ....            
[CHG] Device 34:03:DE:37:B6:32 RSSI: -55
[bluetooth]# **pair 34:03:DE:37:B6:32** 
Attempting to pair with 34:03:DE:37:B6:32
[CHG] Device 34:03:DE:37:B6:32 Connected: yes
Request passkey
[HM-11m[agent] Enter passkey (number in 0-999999): [NEW] Primary Service
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service000c
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[agent] Enter passkey (number in 0-999999): [NEW] Characteristic
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service000c/char000d
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[agent] Enter passkey (number in 0-999999): [NEW] Descriptor
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service000c/char000d/desc000f
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[agent] Enter passkey (number in 0-999999): [NEW] Primary Service
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service0010
        0000ffe0-0000-1000-8000-00805f9b34fb
        Unknown
[agent] Enter passkey (number in 0-999999): [NEW] Characteristic
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service0010/char0011
        0000ffe1-0000-1000-8000-00805f9b34fb
        Unknown
[agent] Enter passkey (number in 0-999999): [NEW] Descriptor
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service0010/char0011/desc0013
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[agent] Enter passkey (number in 0-999999): [NEW] Descriptor
        /org/bluez/hci0/dev_34_03_DE_37_B6_32/service0010/char0011/desc0014
        00002901-0000-1000-8000-00805f9b34fb
        Characteristic User Description
[agent] Enter passkey (number in 0-999999): [CHG] Device 34:03:DE:37:B6:32 ServicesResolved: yes
[agent] Enter passkey (number in 0-999999): **123456**
[CHG] Device 34:03:DE:37:B6:32 Paired: yes
Pairing successful
[HM-11]# **connect 34:03:DE:37:B6:32 **
Attempting to connect to 34:03:DE:37:B6:32
Connection successful
[HM-11]# 

Not verbatim, but close enough, I think?

Next I switch to the rfcomm utility:

gzunder:~ # **ls /dev/rf***
/dev/rfkill   //No rfcomm0
gzunder:~ # **cat /etc/bluetooth/rfcomm.conf**   //My reading of the rfcomm, suggest it is not needed, but everyone seems to include it?
rfcomm0 {
         bind no;
         device 34:03:DE:37:B6:32;
         channel 1;
         comment "HM-11";
}
gzunder:~ # **rfcomm bind /dev/rfcomm0 34:03:DE:37:B6:32 1**
gzunder:~ # l**s /dev/rf***
/dev/rfcomm0  /dev/rfkill   //I now have an rfcomm0
gzunder:~ # 

Now that I have (following the ArchWiki) again got a /dev/rfcomm0, I fire-up CuteComm (or MiniCom or PicoCom or …) ****** And *****
… I get the same error message that I showed you at the head of this thread!

Having failed again, I read down to the Troubleshooting section, and just above that is a section on Bluetooth Serial!!! I knew I should read from the bottom up?
Anyway, that section advises that I need to install two other packages (bluez-rfcomm & bluez-hcitool). Nether of which appear in my Yast2 - Software Management GUI.
Any pointers on how (or should) I get these “unofficial”? packages?

Regards, ~M~

I didn’t mention it, but yes you found that section at the bottom that describes setting up bluez… but note that it’s there only because it’s legacy and is superceded by bluetoothctl. Still… If you’re having problems getting bluetoothctl to work and you can install bluez, then why not? So, the section is there.

Looks like bluez-rfcomm was a special Arch utility no one else used and has even been deprecated by Arch today. I see hints that not only is it not necessary, bluez-serial should provide the necessary functionality.

Strange that you should be successful to the last step and then fail.
Have you tried using a console terminal instead of a graphical terminal?

BTW - Came across this very simple step by step setup, although probably not useful since you seem to be connecting… Just not successfully Tx/Rx

TSU

Thanks for the help TSU,

I’m going quiet on this thread for a while. I want to try a different tack…

As I can do what I want from my android phones/tablets to my HM-11’s, I will try running Android in a VM ( did this years back - but I guess all has changed now) and see were that gets me?
Failing that, I think I will have more luck porting the Android Serial Terminal App (see head of this thread) in to my SuSE workstation.

However, if anyone comes across this thread and knows where I am going wrong, pleas chip in.

Many thanks, ~M~

OK,
If you install the Android NDK, that generally sets up with your choice of Android emulator.
Or, it’s probably easier to run an x86 version of Android in a common VM rather than trying to run an ARM Android image in QEMU.

TSU