Skip to content

Instantly share code, notes, and snippets.

@Enzime
Created August 7, 2015 13:19
Show Gist options
  • Save Enzime/f0550de6d8920a58eaac to your computer and use it in GitHub Desktop.
Save Enzime/f0550de6d8920a58eaac to your computer and use it in GitHub Desktop.
Disable internal laptop keyboard when external keyboard plugged in
SUBSYSTEM=="input", ENV{ID_BUS}=="usb", ENV{ID_INPUT_LEOPARD}=="?*", ACTION=="add", SYMLINK+="kbd%n", RUN+="/usr/local/bin/kbdctl m"
SUBSYSTEM=="input", ENV{ID_BUS}=="usb", ENV{ID_INPUT_LEOPARD}=="?*", ACTION=="remove", RUN+="/usr/local/bin/kbdctl a"
#!/bin/bash
file="/sys/devices/platform/i8042/serio0/bind_mode"
if [ -n "$1" ]; then
mode=$1
else
mode=$(< $file)
if [ "$mode" == "manual" ]; then
mode="auto"
else
mode="manual"
fi
fi
if [ "$mode" == "m" -o "$mode" == "manual" ]; then
echo -n manual > $file
echo -n psmouse > /sys/devices/platform/i8042/serio0/drvctl
elif [ "$mode" == "a" -o "$mode" == "auto" ]; then
echo -n auto > $file
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment