Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: creitzel on October 08, 2022, 12:04:10 AM

Title: pi zero W, piCore 13, bluetooth terminal
Post by: creitzel on October 08, 2022, 12:04:10 AM
Hi everyone.   :)

I'm trying to get a bluetooth serial terminal set up on my pi zero w, running piCore 13.1.  Paul gave me a hand in another thread (http://forum.tinycorelinux.net/index.php/topic,24427.0.html), getting bluetooth up and running, but I'm not quite sure how to go about having the pi listen for a serial connection, and provide a login/tty to the serial port.

In the other thread, patrikg posted a link that is supposed to show steps to accomplish this, but after trying that method, it has become clear to me that a few of the commands that they want you to use aren't available on piCore.  For instance, it is trying to use a program/script called "Bluetooth-agent", which I can't find anywhere on my system.  It also references "agetty", which isn't present either.  I think I can replace agetty with getty, but I'm not sure what to do with bluetooth-agent.

Can anyone provide a set of steps for getting the pi setup to provide a serial port, listen on that port, and start a login/tty when someone connects to it?

Any help you all could give me would be greatly appreciated.

Thanks,

Chris
Title: Re: pi zero W, piCore 13, bluetooth terminal
Post by: Rich on October 08, 2022, 12:28:18 AM
Hi creitzel
See if this helps:
https://askubuntu.com/questions/763939/bluetoothctl-what-is-a-bluetooth-agent

It mentions  bt-agent  which can be found here:
http://tinycorelinux.net/13.x/armv6/tcz/bluez-tools.tcz.list
Title: Re: pi zero W, piCore 13, bluetooth terminal
Post by: creitzel on October 09, 2022, 02:55:15 PM
Thanks Rich.  bt-agent does appear to work like the "bluetooth-agent" mentioned in that other post.

That said, I've not had much success using it.  That post that I was trying makes it sound simple:
Code: [Select]

Now append the following to /etc/inittab (using nano - and substituting for your own):

#Bluetooth Channel 22
PA22:23:respawn:/usr/bin/bluetooth-agent <passkey>
BS22:23:once:/usr/bin/sdptool add --channel=22 SP
BT22:23:once:/usr/bin/rfcomm -r watch 0 22 /sbin/agetty -L rfcomm0 115200

Now reboot. Your other device should be able to discover and pair for a serial device. Connect to that serial at 115200, and you will have a login shell!

I've tried to emulate this on picore by adding the following to bootlocal.sh:
Code: [Select]
bt-agent --compatibility=NoInputNoOutput -d # start the agent with no passcode, as a daemon.
sdptool add --channel=22 SP
rfcomm -r watch 0 22 /sbin/getty -L rfcomm0 115200

That appears to mostly work, in that it brings the pi up and I can connect/pair with it, but I can't seem to get a serial port/login prompt on it.  I think the problem may be in the command I'm handing to rfcomm.  I'm not sure if I should be using rfcomm0 as the port for the getty command, but I also don't know what if anything to replace it with.

Do you happen to know how I can see which port is being mapped via bluetooth?
Title: Re: pi zero W, piCore 13, bluetooth terminal
Post by: patrikg on October 09, 2022, 04:45:36 PM
I searched at the web and found this links and what i can see this is the newest:

https://blog.habets.se/2022/01/Raspberry-Pi-Bluetooth-console.html
https://blog.habets.se/2022/01/SSH-over-Bluetooth.html
https://blog.habets.se/2022/02/SSH-over-Bluetooth-cleanly.html

And here some more. But the links above seems very promising.
https://github.com/ii/iikeyboard/wiki/login-over-bluetooth-serial-port-protocol
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004449
https://code.google.com/archive/p/kobo-hacks/wikis/BluetoothConsole.wiki
Title: Re: pi zero W, piCore 13, bluetooth terminal
Post by: creitzel on October 10, 2022, 07:29:43 PM
I searched at the web and found...

Thanks for the links, patrikg.  Unfortunately, they don't really cover anything that I didn't already find out.  I still can't get it working.  I guess I'll just have to stick with what I've already got working, wifi, and hdmi/keyboard when I need to maintain it etc.
Title: Re: pi zero W, piCore 13, bluetooth terminal
Post by: patrikg on October 11, 2022, 10:06:55 AM
Have you tried to use the original newest os like Raspberry Pi OS Lite (previously called Raspbian).
To see if you can get it to work there ?
And then transfer your knowledge to the no bloated os like PiCore.
Like how we solved the problem with alsa and hdmi sound in picore.

64bit (https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64-lite.img.xz)

32bit (https://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2022-09-26/2022-09-22-raspios-bullseye-armhf-lite.img.xz)