You are not logged in.

#1 2016-12-20 19:11:32

sie
Member
From: Latvia
Registered: 2010-06-30
Posts: 33

[SOLVED] Remapping keys of a *keyboard*

Well, not keyboard per se but my *wireless presentation remote* that has four buttons that emmit PgUp, PgDown, Esc and… "b"(I wonder why?).
I'd like to *remap* them as needed, but I wouldn't(couldn't?) want to just remap "b" in all of X.

I can `cat` it, parse it and issue `xdotool key something` as I see fit, but it will still send it to X too, so perhaps I can just disable it(I guess blacklist through Xorg.conf).

1. Any other ways of approaching it?
2. I'm curious why it even sends it to X? How does that work roughly?

Last edited by sie (2017-01-08 18:07:49)


a &

Offline

#2 2016-12-20 22:55:31

sie
Member
From: Latvia
Registered: 2010-06-30
Posts: 33

Re: [SOLVED] Remapping keys of a *keyboard*

Forgot to mention, I can parse its output from /dev/input/'s device. Its output is exactly like that of a /dev/tty when the same keys are pressed.


a &

Offline

#3 2016-12-20 23:07:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: [SOLVED] Remapping keys of a *keyboard*

Are you sure this can't be toggled on the device?  I have a Targus presentation remote which emits those exact same symbols in one mode, but it has a switch for another mode which changes the keysyms to something I can't recall, but I found much more usefull.

Those key symbols sound like the remote is in a "presentation mode".


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2016-12-20 23:13:55

sie
Member
From: Latvia
Registered: 2010-06-30
Posts: 33

Re: [SOLVED] Remapping keys of a *keyboard*

It's a cheap and dumb device with five buttons(one for pointing a laser).

Example of catting the input device: https://asciinema.org/a/cjqya6hexwfv7cswq25e1bn02


a &

Offline

#5 2017-01-05 00:26:01

flurick
Member
Registered: 2013-08-20
Posts: 2

Re: [SOLVED] Remapping keys of a *keyboard*

Last time I tried remapping a wireless keypad I ended up
writing down all keycodes with xev,
disabling the normal key functions,

xinput disable "keyboard:<id>"

connecting the device to an actkbd conf,

actkbd -s --device /dev/input/by-id/<id> --config ~/keys.conf

and running xdotool from that conf.

82:key::xdotool       key BackSpace
82:rep::xdotool       key BackSpace
82+96:key::xdotool    key Ctrl+BackSpace
82+96:rep::xdotool    key Ctrl+BackSpace
...

(this is probably not the best way of doing it, but it worked okay)

Offline

#6 2017-01-05 01:47:49

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [SOLVED] Remapping keys of a *keyboard*

You might be able to create a custom keymap and set it using setxkbmap to the specific keyboard id.


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2017-01-05 01:57:19

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,355

Re: [SOLVED] Remapping keys of a *keyboard*

sie wrote:

Well, not keyboard per se but my *wireless presentation remote* that has four buttons that emmit PgUp, PgDown, Esc and… "b"(I wonder why?).?

The 'b' will blank presentation in powerpoint and libreoffice impress.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#8 2017-01-08 18:05:49

sie
Member
From: Latvia
Registered: 2010-06-30
Posts: 33

Re: [SOLVED] Remapping keys of a *keyboard*

progandy wrote:

You might be able to create a custom keymap and set it using setxkbmap to the specific keyboard id.


Yeah, I did this and it sorta worked. I had already made a custom xkbmap, so I had a head start with this.

1.1. To detect the id of your device, one may use:

diff <(xinput) <(sleep 3; xinput) # plug the receiver while sleep is waiting

1.2. So below you can see my xkbmap file for this remote. (notice the -i 25) that applies it to that device only.
1.3. Xbindkeys though WON'T read it as XF86AudioLowerVolume, though, so this is useful only for mpv/mplayer/vlc.
2. I guess the other good solution is then flurick's, which I'm about to try, though, from the looks of it, I'm already certain it works.

Because of 1. and 2., marking this as solved.

// Info at /usr/share/X11/xkb/symbols/lv
//
// For the product:
// Name: RF 2 4GHz Wireless Presenter USB Remote Control Presentation Mouse Pointer Black
// Seller: niceol at ebay.
//
// setxkbmap xkbmap-remote -print | xkbcomp -I.. - $DISPLAY -i 25
// NOTE: This file should be within a directory called "symbols" and
//       -I.. points to the .. relative to symbols directory.

partial alphanumeric_keys modifier_keys
xkb_symbols "media_common" {
    // top row
    key <PGUP> {[XF86AudioLowerVolume]};
    key <PGDN> {[XF86AudioRaiseVolume]};

    // bottom row with the left btn alternating between ESC and F5
    key <ESC> {[asciitilde]};
    key <FK05> {[asciitilde]};

    key <AB05> {[space]};
};

REMARK about the remote itself: clicking one of the buttons makes the hardware send keyboard events alternating between Escape, F5 and Super_L key. Haha, such great design.

Last edited by sie (2017-01-08 18:11:55)


a &

Offline

Board footer

Powered by FluxBB