Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Per-device USB keyboard remapping/ xmodmap - can it be done?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
tiktak
n00b
n00b


Joined: 07 Sep 2002
Posts: 50
Location: varies.

PostPosted: Tue Mar 27, 2007 3:02 am    Post subject: Per-device USB keyboard remapping/ xmodmap - can it be done? Reply with quote

Hey all, does anyone of you know whether (and if so, how) it is possible to either:

  • remap scancodes to other scancodes of a keyboard on a per-device basis (i.e. when a USB keyboard is attached, run some program to that effect (I learned of none so far)), or

  • "at least" run an Xmodmap keycode map on only a specific device (parallel to configurations of other attached keyboards; is it even possible to have per-device scancode->keycode mappings in Xorg simultaneously ??)

What I basically need (for my USB-attachable num-pad keyboard) is either additional scancodes (not colliding with the primary keyboard) I can freely map to keysyms, or at least a separate mapping of the scancodes for just the numpad to a keymap unrelated to the xmodmap of the primary keyboard.

Any hints (even if you know for sure it's currently impossible ^_^) would be very much appreciated. THX1e6 in advance!

EDIT: Another alternative: if you know of a program / usb/kernel/something / Xorg driver that can capture all input from a USB keyboard on a per-device basis and not send it to the normal input layers, but instead to a userspace program / daemon, that might help too.. I will keep looking too...
_________________
get_user("tiktak")->post_counter++;
Back to top
View user's profile Send private message
dtor
Guru
Guru


Joined: 19 Jan 2004
Posts: 461
Location: Indiana, USA

PostPosted: Fri Apr 06, 2007 7:57 pm    Post subject: Re: Per-device USB keyboard remapping/ xmodmap - can it be d Reply with quote

tiktak wrote:
Hey all, does anyone of you know whether (and if so, how) it is possible to either:

  • remap scancodes to other scancodes of a keyboard on a per-device basis (i.e. when a USB keyboard is attached, run some program to that effect (I learned of none so far)), or

  • "at least" run an Xmodmap keycode map on only a specific device (parallel to configurations of other attached keyboards; is it even possible to have per-device scancode->keycode mappings in Xorg simultaneously ??)

What I basically need (for my USB-attachable num-pad keyboard) is either additional scancodes (not colliding with the primary keyboard) I can freely map to keysyms, or at least a separate mapping of the scancodes for just the numpad to a keymap unrelated to the xmodmap of the primary keyboard.

Any hints (even if you know for sure it's currently impossible ^_^) would be very much appreciated. THX1e6 in advance!


To alter keymap of a particular keyboard you need to issue EVIOCSKEYCODE ioctl on corresponding /dev/input/eventX node. This currently works for PS/2 keyboards and some others. The ability to do that for USB keyboards is coming in 2.6.22.

Quote:

EDIT: Another alternative: if you know of a program / usb/kernel/something / Xorg driver that can capture all input from a USB keyboard on a per-device basis and not send it to the normal input layers, but instead to a userspace program / daemon, that might help too.. I will keep looking too...

To achieve this your application should open corresponding /dev/input/eventX device and issue EVIOCGRAB ioctl. This will make sure that your application is the only consumer of input evenst from that particular device.

Hope this helps.
_________________
Dmitry
Back to top
View user's profile Send private message
tiktak
n00b
n00b


Joined: 07 Sep 2002
Posts: 50
Location: varies.

PostPosted: Mon May 28, 2007 6:29 pm    Post subject: Reply with quote

I usually do not zombiefy my older topics, but i must say "Thank you very much!" for your answer. You gave a solution not only for 1 of the possibilities, but both! :-)
_________________
get_user("tiktak")->post_counter++;
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum