From 517df68cc7eea7fd0d41ae785c85f13834c67ae6 Mon Sep 17 00:00:00 2001 From: jergus Date: Fri, 28 Dec 2018 12:52:51 +0100 Subject: [PATCH] Update Readme.md --- README.md | 35 +++++++++++++++++++++++++++++++++-- build.sh | 2 +- fn_on.sh | 3 ++- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4d52995..ec3ef2c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,38 @@ # k380-function-keys-conf -Make function keys on Logitech k380 bluetooth keyboard default +Make function keys default on Logitech k380 bluetooth keyboard. -based on +## Instructions + +1) First install `gcc`. On Ubuntu run: +``` +sudo apt install gcc +``` +2) Download installation files. + +3) Connect your K380 keyboard via bluetooth to your computer. + +4) Run `build.sh` + +``` +./build.sh +``` + +5) To switch keyboard's upper keys to F-keys run: + +``` +sudo ./k380_conf -d /dev/hidrawX -f on +``` +Where X is number of your keyboard hidraw interface. Possibly `0, 1, 2, 3`. + +### Switch keys to F-keys automatically + +Follow instructions your received when you built `k380_conf`: +``` +sudo cp /your-build-path/80-k380.rules /etc/udev/rules.d/ && sudo udevadm control --reload +``` +Now, when you reconnect your keyboard it will be automatically switched to F-keys mode. + +## Based on diff --git a/build.sh b/build.sh index ca59bf3..ae76be8 100755 --- a/build.sh +++ b/build.sh @@ -10,5 +10,5 @@ UDEV_RULES="$BUILD_PATH/80-k380.rules" echo "ACTION==\"add\", KERNEL==\"hidraw[0-9]*\", RUN+=\"$FN_ON /dev/%k\"" > $UDEV_RULES echo "To automatically turn on fn using udev rules, run the following command" -echo " sudo cp $UDEV_RULES /etc/udev/rules.d/ && sudo udevadm control -R" +echo " sudo cp $UDEV_RULES /etc/udev/rules.d/ && sudo udevadm control --reload" diff --git a/fn_on.sh b/fn_on.sh index ed34f79..fe2faa5 100755 --- a/fn_on.sh +++ b/fn_on.sh @@ -2,9 +2,10 @@ TOOL="$(dirname $0)/k380_conf" +# Check if device is our keyboard: 046D:B342 DEV="$(ls /sys/class/hidraw/ -l | grep 046D:B342 | grep -o 'hidraw[0-9]*$')" - +# Run if parameter $1 is nothing or it is k380 keyboard if test -n "$DEV" && (test -z "$1" || test "/dev/$DEV" = "$1") then echo "Found K380 at $DEV"