Skip to content

Instantly share code, notes, and snippets.

@jeremija
Last active April 6, 2023 09:26
Show Gist options
  • Save jeremija/630ac6ef687fcbf0aade to your computer and use it in GitHub Desktop.
Save jeremija/630ac6ef687fcbf0aade to your computer and use it in GitHub Desktop.
Attempt to persistent bluetooth pairing (Thinkpad Bluetooth Keyboard with Trackpoint)
# udev rules to be placed in /etc/udev/rules.d
# this is from https://github.com/lentinj/tp-compact-keyboard
SUBSYSTEM=="input", \
ATTRS{name}=="ThinkPad Compact Bluetooth Keyboard with TrackPoint", \
RUN+="/etc/udev/scripts/tp-compact-keyboard --fn-lock-enable"
# this is my script
SUBSYSTEM=="input", \
ATTRS{name}=="ThinkPad Compact Bluetooth Keyboard with TrackPoint", \
ENV{DISPLAY}=":0", \
ENV{XAUTHORITY}="/home/my-user/.Xauthority", \
RUN+="/usr/local/bin/wheeltweak.sh"
## this is not actual shell script but a list of commands you need to do
sudo -s
export ADDRESS="devices mac address here"
# disconnect the device if connected
hidd --unplug $ADDRESS
# authenticate (before this open another terminal and type: sudo hcidump -at | grep -i passkey A1
# here you will see the passkey needed to pair
bluez-simple-agent hci0 $ADDRESS
# you should see something like:
# Release
# New device (/org/bluez/614/hci0/...)
# make the device trusted
bluez-test-device trusted $ADDRESS yes
#
bluez-test-input connect "90:7F:61:11:3C:C8"
## reboot ##
# I found the above data here: http://devasive.blogspot.nl/2012/11/ubuntu-1204-persistent-bluetooth-pairing.html
# To remove persistent FnLock see here: https://github.com/lentinj/tp-compact-keyboard
#!/bin/bash
# add scroll wheel functionality to the right button, instead of the middle one to prevent accidental pastes while scrolling
xinput set-prop "ThinkPad Compact Bluetooth Keyboard with TrackPoint" "Evdev Wheel Emulation Button" 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment