Add os/arch/apple-keyboard-bt

This commit is contained in:
Henrik Lissner 2016-10-20 22:47:15 +02:00
parent 2f93e4d44e
commit fdd36d3a2e
4 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# Apple Keyboard auto connecting service
The btkbd service auto-connects the wireless Apple Keyboard to Arch Linux.
The keyboard must be paired and trusted before the btkbd service will work:
```
$ bluetoothctl -a
[bluetooth]# power on
[bluetooth]# agent KeyboardOnly
[bluetooth]# default-agent
[bluetooth]# pairable on
[bluetooth]# scan on
[bluetooth]# pair <MAC ADDRESS OF KBD>
[bluetooth]# trust <MAC ADDRESS OF KBD>
[bluetooth]# connect <MAC ADDRESS OF KBD>
[bluetooth]# quit
```
Then run `./install` to set up the service.

View file

@ -0,0 +1,3 @@
# Config file for btkbd.service
BTKBDMAC = ''00:25:BC:FA:22:C0''
HCIDEVICE = 'hci0'

View file

@ -0,0 +1,19 @@
[Unit]
Description=systemd Unit to automatically start a Bluetooth keyboard
Documentation=https://wiki.archlinux.org/index.php/Bluetooth_Keyboard
Requires=dbus-org.bluez.service
After=dbus-bluez.org.service
ConditionPathExists=/etc/btkbd.conf
ConditionPathExists=/usr/bin/hcitool
ConditionPathExists=/usr/bin/hciconfig
[Service]
Type=oneshot
EnvironmentFile=/etc/btkbd.conf
ExecStart=
ExecStart=/usr/bin/hciconfig ${HCIDEVICE} up
# ignore errors on connect, spurious problems with bt? so start next command with -
ExecStart=-/usr/bin/hcitool cc ${BTKBDMAC}
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Bluetooth
sudo ln -s $PWD/services/btkbd.conf /etc/
sudo ln -s $PWD/services/btkbd.service /etc/systemd/system/
# Install service
sudo systemctl enable btkbd.service
sudo systemctl start btkbd.service
# Turn off FN mode
bash -c 'echo 2 > /sys/module/hid_apple/parameters/fnmode'