Debian: console redirection via bluetooth

Some time ago, I had a new single-board computer running Debian, which would eventually become the "heart" of a project in school.

Now I get access to the built-in distribution using a wired network and ssh. This is fine as long as the thing is on my desktop, but not when it is built into the robot where it is intended. I managed to establish a Bluetooth connection using a cheap USB-BT adapter, but now I am stuck with an rfcomm device and do not know how to proceed.

I would like the virtual serial port provided by the Bluetooth connection to behave the same as a real serial port. So that I can log in using minicom (or something similar) and get full access to everything on the board.

When searching the Internet, all I could find was a guide on setting up a dial-up network with mobile phones and similar topics, but nothing about the bluetooth console. Maybe I just tried the wrong keywords.

I would really appreciate how to do this.

Thanks Philipp

+6
source share
2 answers

I believe I have found a suitable solution. The invalid keyword was "getty" and some glue logic in the shell script:

#!/bin/sh # Make sure to have rfcomm loaded modprobe rfcomm # Turn on and reset bluetooth dongle hciconfig hci0 up hciconfig hci0 reset # Accept incoming connections (in background) rfcomm watch 0 1 & # Loop forever while true do # Wait for our socket to pop in while [ ! -c /dev/rfcomm0 ] do sleep 5 done # Present a login shell getty -n -l /bin/bash 115200 /dev/rfcomm0 vt102 done 

I am not very sure about this, since it does not seem very stable (sometimes it is impossible to connect after loading ...), but it works quickly and is relatively simple. Therefore, I am satisfied with this :)

Regards, Philipp

+9
source

I have a bluetooth serial connection between my computer and my robot (beaglebone black). I am very happy because I do not need anything other than a cheap Bluetooth-USB dongle on the side of the robot to get a remote terminal. My PC also has its own Bluetooth.

The following steps helped me:

First, you need to connect the devices. Pairing is relatively easy. I will call the client (who starts talking - the robot) and the server (who answers)

You need to configure the server to: Server side (with root privileges):

 sdptool add --channel=3 SP mknod -m 666 /dev/rfcomm0 c 216 0 rfcomm watch /dev/rfcomm0 3 /sbin/agetty rfcomm0 115200 linux 

Client side (with root privileges):

 sdptool add --channel=3 SP rfcomm connect /dev/rfcomm0 [SERVER_ADDR] 3 

Now, to open the serial terminal on the client:

 screen /dev/rfcomm0 115200 

Comments:

When you invoke the last rfcomm connect ... command in the client, the device / dev / rfcomm 0 will be created and connected to the server / dev / recomm 0. This is a serial connection between both

The last server command: rfcomm watch .... will "listen" for incoming connections. If the connection is lost, the command will restart the new "listen" state.

+2
source

Source: https://habr.com/ru/post/912188/


All Articles