You are not logged in.
Hi All!
I'm using a Logitech K380 on my HP Laptop, but this keyboard has a different layout that my Laptop.
When the keyboard is connected I must setup it with
setxkbmap -device 16 es
How can I make a udev rules for this job?
Thanks!
Last edited by nachopro (2017-03-28 20:17:42)
Offline
As I understand it, Xorg uses hotplugging through udev for input devices.
But I don't think a udev rule is necessary (not sure). You should need only another conf file for the keyboard; put it for example in
/etc/X11/xorg.conf.d/40-Logitech-K380.conf with a content like this:
Section "InputClass"
Identifier "Keyboard Logitech K380"
Driver "libinput"
MatchIsKeyboard "yes"
MatchProduct "matchproduct"
MatchVendor "matchvendor"
MatchPnPID "matchpnp"
MatchUSBID "matchusb"
Option "XkbLayout" "es"
EndSection
Select the Match lines to identify the keyboard (maybe only one is enough). See 'man xorg.conf' 'INPUTCLASS SECTION' for details.
Test this by restarting the Xorg server without the Spanish keyboard, and then hotplug the keyboard and see if it is recognized and uses the Spanish layout.
Last edited by berbae (2017-03-16 09:19:56)
Offline
Thanks for your response.
Can you helpme to select the proper identifieres? I'm traying without success.
# udevadm info /sys/bus/hid/devices/0005:046D:B342.0005
P: /devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1.6/3-1.6:1.0/bluetooth/hci0/hci0:5/0005:046D:B342.0005
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb3/3-1/3-1.6/3-1.6:1.0/bluetooth/hci0/hci0:5/0005:046D:B342.0005
E: DRIVER=hid-generic
E: HID_ID=0005:0000046D:0000B342
E: HID_NAME=Keyboard K380
E: HID_PHYS=68:14:01:8c:1b:1a
E: HID_UNIQ=34:88:5d:49:c6:63
E: MODALIAS=hid:b0005g0001v0000046Dp0000B342
E: SUBSYSTEM=hid
Thanks
Offline
ask "xinput" but it's likely "Keyboard K380" for "MatchProduct" (which should suffice)
Offline
Thanks! It's working
Offline
Hi, I created a new thread but I have no response. Is related to this configuration on a New computer:
https://bbs.archlinux.org/viewtopic.php?pid=1721008 Thanks in advance!
Offline
I have used the solution provided by berbae above. I had to both write the layout off my laptop keyboard as well as my USB keyboard in the configuration file for the USB keyboard to make it work:
Configuration file for USB keyboard /etc/X11/xorg.conf.d/40-topre_realforce_87_us.conf
Section "InputClass"
Identifier "Topre REALFORCE 87 US"
Driver "libinput"
MatchIsKeyboard "on"
MatchProduct "Topre REALFORCE 87 US"
Option "XkbLayout" "us,dk"
Option "XkbVariant" "altgr-intl,"
EndSection
Configuration file for laptop keyboard /etc/X11/xorg.conf.d/00-keyboard.conf
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "dk"
EndSection
The layout now changes automatically when I start typing on the USB keyboard and it switches back when I start typing on my laptop keyboard.
Last edited by Nilas (2021-06-19 16:30:20)
Offline