Skip to content

Instantly share code, notes, and snippets.

@martonmiklos
Created August 13, 2021 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martonmiklos/92f8f5f1a7c8d28c1ae885ce342ca181 to your computer and use it in GitHub Desktop.
Save martonmiklos/92f8f5f1a7c8d28c1ae885ce342ca181 to your computer and use it in GitHub Desktop.
Force us layout for athe Chinayoko E1005 barcode reader module
ACTION=="bind" SUBSYSTEMS=="usb", ATTRS{idVendor}=="6778", ATTRS{idProduct}=="0112", ENV{DISPLAY}=":0.0", ENV{XAUTHORITY}="/home/mm/.Xauthority", RUN+="/etc/udev/rules.d/fix_barcode_layout.sh"
#!/bin/bash
usbkbd=`xinput -list | grep -c "HID Keyboard Device HID Keyboard Device"`
if [[ "$usbkbd" -gt 0 ]]
then
usbkbd_ids=`xinput -list | grep "HID Keyboard Device HID Keyboard Device" | awk -F'=' '{print $2}' | cut -c 1-2`
usbkbd_layout="us"
for ID in $usbkbd_ids
do
setxkbmap -device "${ID}" -layout "${usbkbd_layout}"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment