[PLUG] Connect BT keyboard to headless Raspberry Pi?

Bill Barry bill at billbarry.org
Wed Jan 19 16:51:41 UTC 2022


On Wed, Jan 19, 2022 at 12:04 AM Eric House <eehouse at eehouse.org> wrote:

> Looking to build a portable linux environment that'll run on
> airplane's USB power I'm playing with a Raspberry Pi, an iPad and a
> bluetooth keyboard. I run a Bluetooth PAN network on the Pi, ssh into
> it from the iPad using a terminal app, and connect the keyboard to the
> iPad so I can actually type.
>
> It works pretty well until I fire up emacs. A number of critical key
> combinations turn out to be captured by iOS. For example, some genius
> imagined that ctrl-spacebar ought to pop up an emoji picker no matter
> what app is in use.
>
> So I'm wondering: could I connect the keyboard to the Pi instead of
> the iPad? I could start screen in my ssh session from the iPad, then
> (after some keyboard magic) run 'screen -x' in the keyboard's session
> so that my typing would then go into the same screen the iPad was
> displaying. I'm quickly realizing I don't understand Linux very well
> at this level: don't even know how to frame the question!
>
> Does this sound possible? What are the parts I'd need to configure? It
> kinda works if the pi has a monitor connected and virtual consoles are
> available. I haven't had any luck if it's headless, but then I don't know
> quite where to look.
>
> (Yeah, I could get a new laptop that'd have a chance of lasting a
> flight or charge off USB. I'm shopping -- but there aren't many
> small/light 32G laptops with decent battery life and no
> touchscreen. Meanwhile, this is fun.)
>
> Thanks,
>
> --Eric
>

Your idea should work. I  sort of tested it with the equipment at hand. I
first configured the Pi to boot to console using raspi-config. I added a
line to the .profile on the Pi to start screen
screen -S raScreen

then in the .screenrc I have
multiuser on

With the keyboard connected to the Pi boot and blindly type your username
and password. Then screen should run automatically

On the ipad ssh to the Pi without invoking the .profile so
ssh -t  user at raspberrypi "bash --noprofile"
then check to see if the screen is already running maybe using ps fax
then connect to the screen
screen -x raScreen

Now when you type something on the Pi keyboard it shows up on the ipad.
Note I don't have an ipad to test this, but was using just a linux desktop,
but that part should not matter.

Bill



More information about the PLUG mailing list