View previous topic :: View next topic |
Author |
Message |
dspahn Guru
Joined: 22 Jun 2006 Posts: 392
|
Posted: Sun Oct 14, 2018 2:00 pm Post subject: Bluetooth keyboard on boot? |
|
|
Just finished a fresh Gentoo system, running systemd, gnome 3 is coming soon. I have a Logitech k480 that I need available for typing my password at a command shell. It is a Bluetooth keyboard. I can connect it and pair it manually using Bluetoothctl. Does anyone know how to make it pair automatically at boot so i can use it to log in to a shell?
Thanks! |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2056 Location: United Kingdom
|
Posted: Mon Oct 15, 2018 6:48 am Post subject: |
|
|
I don't have a Bluetooth keyboard to try this out, but I wonder if you could create a unit file (I'll call it /etc/systemd/system/pairkbd.service) that would run a Bash script containing the bluetoothctl commands you are currently entering manually.
Code: | [Unit]
Description=Pair Bluetooth keyboard at startup
After=multi-user.target bluetooth.service
[Service]
Type=idle
ExecStart=/usr/bin/pairkbd.sh
[Install]
WantedBy=multi-user.target |
Code: | # systemctl enable pairkbd.service |
The Bash script /usr/bin/pairkbd.sh would contain the bluetooothctl commands to pair the keyboard.
Would that do it? _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
|
dspahn Guru
Joined: 22 Jun 2006 Posts: 392
|
Posted: Mon Oct 15, 2018 12:36 pm Post subject: It would, but... |
|
|
I found a second problem... If I go into bluetoothctl and run
Quote: | power on
connect \t
quit |
I get a line item showing the device is connected. I press a key and it says it is disconnected and then I press another key and it says it is connected again, and o on and so forth. The only way to avoid those messages is to put the keyboard in pairing mode, and go through the process of pairing... sort of tough to do before logging in! Obviously, the script will not work until this problem is resolved. By the way, I did find out some information about scripting these commands- you probably already know how, but for the edification of anyone else who may read this thread in the future, here is how to pass the commands from Bash to bluetoothctl:
Note the \n for newline:
Code: | echo -e 'power on\nconnect \t \nquit' | bluetoothctl |
Any idea what I need to do to keep the pairing from boot to boot? It is a Logitech K480.
Thanks! |
|
Back to top |
|
|
|