[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Configuring hotplugged input devices



On Mon, Nov 25, 2019 at 03:01:03PM +0100, Nicolas George wrote:
> Hi.
> 
> What is the standard for a user to automatically configure hotplugged
> input devices under X11, to set the keyboard layout, repeat speed,
> pointer acceleration, etc.?
> 
> I know how to do it manually using xinput and xkbcomp.
> 
> I would like a generic solution, whatever desktop environment may
> propose its own solution, I do not use it.
> 
> I want a solution for simple users, without root permissions to edit
> xorg.conf.
> 
> If there is no standard solution, would you like one? I have a small
> program that can serve as the basis for one, I can publish it if that
> would be useful.
> 
> Extra question:
> 
> Is there a standard way to bind a key on a specific keyboard? Basically
> an XInput-aware version of xbindkeys?
> 


That's what udev is for
create a file like
/etc/udev/rules.d/99-usb-keyboard.rules

with contents like:
ACTION=="add", ATTRS{name}=="USB Keyboard", RUN="<path to your script>"


The ATTRS{} part is a selector. If you know the idVendor and idProduct
you can be very selective.
example:
ACTION=="add", ATTR{idVendor}=="1234", ATTR{idProduct}=="5678", RUN="your_script for this keyboard"


After that you have to reload the udev stack

udevadm control --reload-rules;

A reboot would work too.


HTH
-H




-- 
Henning Follmann           | hfollmann@itcfollmann.com


Reply to: