2
0
mirror of https://github.com/pikvm/pikvm synced 2024-11-10 13:10:37 +00:00
pikvm/docs/bluetooth_hid.md

80 lines
2.8 KiB
Markdown
Raw Normal View History

2020-11-07 22:56:23 +00:00
# Bluetooth HID
2021-10-12 18:45:00 +00:00
2021-09-26 08:47:33 +00:00
PiKVM is able to emulate a Bluetooth keyboard & mouse.
This is not the main case of using PiKVM since you still need it to pair with a remote host, but can be used for something like mobile KVM.
2020-11-07 22:56:23 +00:00
2021-10-12 18:45:00 +00:00
!!! warning
Using Bluetooth HID requires additional configuration of the operating system. For v2+, this means losing the UART port, since it will be used by Bluetooth. Also, Bluetooth operation was tested only on RPi4 and v2+ platform. Other boards may require different system service settings. Making the required changes for BT to work will also disable normal KB/MOUSE functionality therefor this will need to be disabled before normal operation can occur.
2021-10-12 18:45:00 +00:00
!!! note
Bluetooth mouse can work only in [relative mode](mouse.md). The reason is that many Bluetooth host drivers do not correctly implement HID descriptors. Horizontal scrolling is not supported for the same reason.
2020-11-07 22:56:23 +00:00
2021-10-12 18:45:00 +00:00
## Configuring the OS
2020-11-07 22:56:23 +00:00
1. Switch filesystem to RW-mode, perform update and install some packages:
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
```
# rw
# pacman -Syu bluez bluez-utils raspberrypi-bluetooth
2020-11-07 22:56:23 +00:00
```
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
2. Edit `/boot/config.txt` and comment these lines:
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
```
#enable_uart=1
#dtoverlay=disable-bt
```
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
3. Create an empty directory `/var/lib/bluetooth` and add mountpoint to `/etc/fstab`:
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
```
# mkdir /var/lib/bluetooth
# echo 'tmpfs /var/lib/bluetooth tmpfs nodev,nosuid,mode=0755 0 0' >> /etc/fstab
```
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
4. Override and enable the services:
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
```
# mkdir /etc/systemd/system/bluetooth.service.d
# cat << EOF > /etc/systemd/system/bluetooth.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=*
EOF
# systemctl enable bluetooth
# systemctl enable raspberrypi-btuart
```
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
5. Override `kvmd` service:
2021-10-12 18:45:00 +00:00
2020-11-07 22:56:23 +00:00
```
# mkdir /etc/systemd/system/kvmd.service.d
2020-11-07 22:57:24 +00:00
# cat << EOF > /etc/systemd/system/kvmd.service.d/override.conf
2020-11-07 22:56:23 +00:00
[Service]
AmbientCapabilities=CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_ADMIN CAP_SETUID CAP_SETGID CAP_CHOWN
CapabilityBoundingSet=CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SYS_ADMIN CAP_SETUID CAP_SETGID CAP_CHOWN
EOF
```
2021-10-12 18:45:00 +00:00
2020-11-07 23:02:00 +00:00
6. Add following lines to `/etc/kvmd/override.yaml`:
2021-10-12 18:45:00 +00:00
2020-11-07 23:02:00 +00:00
```yaml
kvmd:
hid:
type: bt
```
2021-10-12 18:45:00 +00:00
7. Perform `reboot`.
8. To reverse, uncomment lines from Step 2 and remove lines in Step 6, and `reboot`.
## Using Bluetooth HID
2021-09-26 08:47:33 +00:00
* After a reboot, the PiKVM will be ready for detection and pairing with no auth. You will see the `PiKVM HID` device.
2021-10-12 18:45:00 +00:00
2021-09-26 08:47:33 +00:00
* Once the server is connected, PiKVM will no longer be discoverable and pairable to other clients until you unpair the server.
2021-10-12 18:45:00 +00:00
2021-09-26 08:47:33 +00:00
* If something went wrong, use the web menu `System -> Reset keyboard & mouse`. This will cause unpair the device and switch the PiKVM to public mode before the first client is connected.