UP  |  HOME

Logitech K380 Bluetooth Keyboard

Change function keys to default to act like a normal keyboard (use fn for special functions). We use this utility k380-function-key-conf, a shell script, and some udev config to automate the change on device connection.

I put the utility and script in /usr/local/bin, and the udev rules in the appropriate /etc directory.

Listing 1: /etc/udev/rules.d/80-k380.rules
ACTION=="add", KERNEL=="hidraw[0-9]*", RUN+="/usr/local/bin/fn_on.sh /dev/%k"
Listing 2: /usr/local/bin/fn_on.sh
#!/bin/sh


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"
    $TOOL -d "/dev/$DEV" -f on
fi

Reload udev to activate the new rule.

sudo udevadm control -R