Skip to content

Commit

Permalink
Merge pull request #2 from CYL96/main
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
mehmetumit authored Feb 13, 2023
2 parents 304595f + 54be75a commit 5ddb97d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions k380-swap-keys
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ EOF

case "$1" in
-r) [ "$(id -u)" -eq 0 ] && ( echo "$RULE" > "$DEST"; printf "Rule created successfully...\n"; sh -c 'k380-swap-keys -s' ) || echo "You need to run as root!";;
-s) hid=$(grep -FH "$DEV" /sys/class/hidraw/hidraw*/device/uevent | grep -o "hidraw[[:digit:]]") && [ ! -z "$hid" ] && printf "\x10\xff\x0b\x1e\x00\x00\x00" > "/dev/$hid" || echo "Device $DEV not found!";;
-s) hid=$(grep -FH "$DEV" /sys/class/hidraw/hidraw*/device/uevent | grep -o "hidraw[0-9][0-9]*") && [ ! -z "$hid" ] && printf "\x10\xff\x0b\x1e\x00\x00\x00" > "/dev/$hid" || echo "Device $DEV not found!";;
-R) [ "$(id -u)" -eq 0 ] && ( [ -f "$DEST" ] && ( rm -f "$DEST" && printf "Rule removed!\n"; sh -c 'k380-swap-keys -S' ) || echo "Rule not found!" ) || echo "You need to run as root!";;
-S) hid=$(grep -FH "$DEV" /sys/class/hidraw/hidraw*/device/uevent | grep -o "hidraw[[:digit:]]") && [ ! -z "$hid" ] && printf "\x10\xff\x0b\x1e\x01\x00\x00" > "/dev/$hid" || echo "Device $DEV not found!";;
-S) hid=$(grep -FH "$DEV" /sys/class/hidraw/hidraw*/device/uevent | grep -o "hidraw[0-9][0-9]*") && [ ! -z "$hid" ] && printf "\x10\xff\x0b\x1e\x01\x00\x00" > "/dev/$hid" || echo "Device $DEV not found!";;
-h|*) help && exit;;
esac

0 comments on commit 5ddb97d

Please sign in to comment.