epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Pi3, serial console over bluetooth?

Fri May 20, 2016 12:37 pm

Currently my Pi3 runs sshd but I'd like to add serial console access via Bluetooth.

I have read some posts about this but I find the information confusing. I am only interested in Pi 3. I don't know the difference between a mini-UART and a PLxxx (and I think I don't care), etc.

Could someone give me a simple recipe as how to setup the bootconfig (and possibly the bluetooth software) and obtain something like /dev/ttyS0 on the Pi?

Thanks in advance.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
Douglas6
Posts: 4860
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Pi3, serial console over bluetooth?

Fri May 20, 2016 3:12 pm

See if this helps to setup a Bluetooth console: viewtopic.php?p=955425#p955425

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Pi3, serial console over bluetooth?

Fri May 20, 2016 3:27 pm

Thanks!
That was one of the threads I started with. Then in got lost in bootcmd.txt and core frequency stuff :)
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
Douglas6
Posts: 4860
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Pi3, serial console over bluetooth?

Fri May 20, 2016 3:41 pm

I ignore (read: don't understand) all that business of swapping UARTs. The linked recipe works on a clean Raspbian install.

epoch1970
Posts: 5132
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Pi3, serial console over bluetooth?

Fri May 20, 2016 7:31 pm

And I confirm it runs fine (from an OS X machine), thanks again.
With your systemd units, all starts automagically at boot, this is great.

To be clear for others who might come around here, this serial-over-bluetooth link does not give access to the boot messages (I suppose it starts too late anyway), it offers a terminal from which you can login. Since it works in case networking has completely failed, that's just fine for me.

I have derived a little bit from the reference thread, in that my rfcomm service runs as:
"ExecStart=/usr/bin/rfcomm watch hci0 1 /sbin/getty rfcomm0 115200 vt100", I've removed "-a pi" which would have auto-logged in as user pi. So instead I arrive at a login: prompt and I have to input login and password to get access.

After login I get an annoying message coming from my login shell:

Code: Select all

-bash: cannot set terminal process group (1245): Inappropriate ioctl for device
-bash: no job control in this shell
(1245 is the /usr/bin/rfcomm process)
After a few man pages and googling a bit I didn't figure out how to fix it. But the session works, by and large.
NB: If you need sudo, you'll need to invoke "sudo -S <command>".

I started fantasizing I could ditch the old and ugly linux netbook I carry around as my admin station and connect to the Pi via an iPhone or an iPad.
I couldn't find an app that would discover the BT serial link and use it. If anyone has a suggestion, I'd like to try that out.

EDIT: D'oh. My netbook doesn't have BT built-in :D I guess I'll look into an android tablet then. Some seem adequately affordable.
Last edited by epoch1970 on Fri May 20, 2016 8:58 pm, edited 1 time in total.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
Douglas6
Posts: 4860
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Pi3, serial console over bluetooth?

Fri May 20, 2016 8:03 pm

Glad to hear it's working for you. I haven't determined what that warning means either.

As far I know iOS doesn't support a Serial Port Profile, so I think you're out of luck there.

owendelong
Posts: 7
Joined: Sun Oct 07, 2012 1:01 am

Re: Pi3, serial console over bluetooth?

Mon Aug 20, 2018 4:39 am

epoch1970 wrote:
Fri May 20, 2016 7:31 pm
After login I get an annoying message coming from my login shell:

Code: Select all

-bash: cannot set terminal process group (1245): Inappropriate ioctl for device
-bash: no job control in this shell
(1245 is the /usr/bin/rfcomm process)
After a few man pages and googling a bit I didn't figure out how to fix it. But the session works, by and large.
Care to share how you did this so I don't have to repeat your searches?
epoch1970 wrote:
Fri May 20, 2016 7:31 pm
I started fantasizing I could ditch the old and ugly linux netbook I carry around as my admin station and connect to the Pi via an iPhone or an iPad.
I couldn't find an app that would discover the BT serial link and use it. If anyone has a suggestion, I'd like to try that out.
I use screen (available on virtually every real operating system). I suspect there's plenty of solutions for Windows, too.

screen /dev/cu.<whatever it got called>

Was all I needed on Macs and Linux systems I tried.

weo1rpi
Posts: 1
Joined: Thu Dec 06, 2018 2:08 am

Re: Pi3, serial console over bluetooth?

Thu Dec 06, 2018 2:31 am

I use the utility "screen". I run it in my bluetooth console window with
no parameters and then job control seems to work fine.
With this addition bluetooth console is very usable.

Bill

owendelong
Posts: 7
Joined: Sun Oct 07, 2012 1:01 am

Re: Pi3, serial console over bluetooth?

Thu Feb 21, 2019 4:35 am

I finally found an answer to the job control problem...

Here's the solution... Add "setsid" to your /etc/systemd/system/rfcomm.service file as follows:

Code: Select all

[Unit]
Description=RFCOMM service
After=bluetooth.service
Requires=bluetooth.service

[Service]
ExecStart=/usr/bin/rfcomm watch hci0 3 setsid /sbin/agetty -L rfcomm0 115200

[Install]
WantedBy=multi-user.target
You can see it there just before /sbin/agetty in the [Service] section. This causes agetty to be launched in a new "session" (aka Linux Process Group) which enables job control and all the other fun things you expect a controlling terminal to be able to do.

Return to “Beginners”