Skip to main content
Notice removed Draw attention by l0b0
Bounty Ended with L. Levrel's answer chosen by l0b0
deleted 2 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
added 65 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
  • Linux must know which keyboard I'm typing on to support different layouts for multiple keyboards simultaneously.

  • xinput → list.c → list_xi2XIQueryDevice provides device IDs usable by setxkbmap.

  • showkey and xev don't print keyboard IDs.

  • There seems to be a connection between keyboards and /dev/input/event* devices, but it's not trivial (for example, I have a device ID 12, but no /dev/input/event12xinput list-props $ID shows where keyboard events are sent. However, and I haveusing /dev/input/event1 but nocode from another answer it seems this device ID 1)doesn't print anything to identify the keyboard.

  • One almost possible solution is to run xinput --test <ID> & for each keyboard ID and see which one returns something first. The problem with that is figuring out which "keyboards" are actually keyboards:

     $ xinput | grep keyboard ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Sleep Button id=9 [slave keyboard (3)] ↳ WebCam SC-13HDL10931N id=10 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] 
  • Linux must know which keyboard I'm typing on to support different layouts for multiple keyboards simultaneously.

  • xinput → list.c → list_xi2XIQueryDevice provides device IDs usable by setxkbmap.

  • showkey and xev don't print keyboard IDs.

  • There seems to be a connection between keyboards and /dev/input/event* devices, but it's not trivial (for example, I have a device ID 12, but no /dev/input/event12, and I have /dev/input/event1 but no device ID 1).

  • One almost possible solution is to run xinput --test <ID> & for each keyboard ID and see which one returns something first. The problem with that is figuring out which "keyboards" are actually keyboards:

     $ xinput | grep keyboard ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Sleep Button id=9 [slave keyboard (3)] ↳ WebCam SC-13HDL10931N id=10 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] 
  • Linux must know which keyboard I'm typing on to support different layouts for multiple keyboards simultaneously.

  • xinput → list.c → list_xi2XIQueryDevice provides device IDs usable by setxkbmap.

  • showkey and xev don't print keyboard IDs.

  • xinput list-props $ID shows where keyboard events are sent. However, using code from another answer it seems this device doesn't print anything to identify the keyboard.

  • One almost possible solution is to run xinput --test <ID> & for each keyboard ID and see which one returns something first. The problem with that is figuring out which "keyboards" are actually keyboards:

     $ xinput | grep keyboard ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Power Button id=8 [slave keyboard (3)] ↳ Sleep Button id=9 [slave keyboard (3)] ↳ WebCam SC-13HDL10931N id=10 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] 
added 67 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398

Which interface provides this information on Linux? Ideally it should work without X, but that's not a requirement (there doesn't seem to be many tools which support this without X).

Which interface provides this information on Linux? Ideally it should work without X, but that's not a requirement.

Which interface provides this information on Linux? Ideally it should work without X, but that's not a requirement (there doesn't seem to be many tools which support this without X).

Tweeted twitter.com/StackUnix/status/727612738709639173
added 1 character in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
added 951 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
deleted 14 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
Notice added Draw attention by l0b0
Bounty Started worth 100 reputation by l0b0
deleted 14 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
added 425 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
added 99 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
added 101 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
edited tags
Link
Gilles 'SO- stop being evil'
  • 865.9k
  • 205
  • 1.8k
  • 2.3k
Loading
added 38 characters in body; edited body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398
Loading