I've recently purchased the Utechsmart Venus mouse: http://www.utechsmart.com/product/show/id/477/US-D16400-GM

I've been unable to bind those side buttons (and the "rapid fire button near the left mouse button) to different keys without changing the keys the side and rapidfire buttons point to.

The reason for this is that I've been unable to actually get xev to recognize the side and rapid fire buttons as their own event. Instead, when I press a side button or rapid fire button, the xev event tester immediately reports the binding that the button is mapped to.

I.e. I press side button "1", event mapper reports:

 KeyPress event, serial 74, . . .
 KeyRelease event, serial 74 . . .

When I press the left mouse button the mapper reports:

 ButtonPress event, serial 37, . . .
 Button Release event, serial 37, . . . 

Obviously I can't map the button from the mouse if its not telling me what the button "address" is as in these two related posts:

How to configure extra buttons in Logitech Mouse

Mouse shortcuts get confused with keyboard keys in Kubuntu

Does anyone have any advice to further try and find out what these buttons are on the mouse?

Obviously the mouse is working, its just not mapped to buttons in a way that I would prefer. Therefore it seems to me that there must to be a solution to this, and I'd be more than happy to dive quite deeply to solve this problem. I've been looking at the documentation for Xorg and evdev drivers, but I'm not even certain if that's the correct direction.

Not necessarily looking for someone to solve this problem directly for me. But helping me to brainstorm for some ideas about how to go about solving this problem would be greatly appreciated.

Thanks for your patience!


So I've found a post on archlinux forums about the razer naga which is a very similar mouse. It seems hopeful: https://bbs.archlinux.org/viewtopic.php?id=145502. That lead me to a similar problem with infrared remote controls here: https://www.mythtv.org/wik147+853!#@#+!i/Generic_HID_%22MCE%22_Remotes#XKB_Remapping. There is a wealth of information there that goes into decent depth about the issue. It would be nice if they explained better how they figure out what the "keys" are in the scripts, but after reading a lot of the suplementary material it seems that the <AE[01/12]> is coming from convention (and since the buttons on the mouse correspond to those key mappings it only makes further sense. . .

However, I'm still having a bit of an issue. I haven't created a shebang yet, instead I've just tried to run the command by hand.

First I created the symbols file /usr/share/X11/xkb/symbols/custom (I'm not quite sure why they're using the tmp directory) and included the following:

xkb_symbols "venus" {
  2     key <AE01> { [          y,          Y  ]
  3     key <AE02> { [          i,          I  ]
  4     key <AE03> { [bracketleft,  braceleft  ]
  5     key <AE04> { [bracketright, braceright ]
  6     key <AE05> { [      slash,   question  ]
  7     key <AE06> { [          j,          J  ]
  8     key <AE07> { [          k,          K  ]
  9     key <AE08> { [          l,          L  ]
 10     key <AE09> { [  semicolon,      colon  ]
 11     key <AE10> { [      comma,       less  ]
 12     key <AE11> { [      minus, underscore  ]
 13     key <AE12> { [      equal,       plus  ]
 14 };

Then I ran xinput list which yeilded:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ USB Laser Game Mouse                      id=9    [slave  pointer  (2)]
⎜   ↳ USB Laser Game Mouse                      id=11   [slave  pointer  (2)]
⎜   ↳ EST Gaming keyboard                       id=13   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ Sleep Button                              id=8    [slave  keyboard (3)]
    ↳ USB Laser Game Mouse                      id=10   [slave  keyboard (3)]
    ↳ EST Gaming keyboard                       id=12   [slave  keyboard (3)]
    ↳ EST Gaming keyboard                       id=14   [slave  keyboard (3)]
    ↳ C-Media Electronics Inc. USB Audio Device id=15   [slave  keyboard (3)]
    ↳ USB Laser Game Mouse                      id=16   [slave  keyboard (3)]
    ↳ EST Gaming keyboard                       id=17   [slave  keyboard (3)]

After analyzing the script written in the two links above, I deduced that my $remote_id variable would be 16 so I ran the following:

setxkbmap -device 16 -print | sed's/\(xkb_symbols.*\)"/\1+custom(venus)"/' | xkbcomp -I /usr/share/X11/xkb -i 16 -synch $DISPLAY

I did not pipe my output into /dev/null because I wanted to see what the output would be (obviously when I make the script, then I will do this, but I'm trying to understand what I'm doing at the moment). My output was the following:

Warning:          Too many file names on command line
                  Compiling /usr/share/X11/xkb, writing to -, ignoring :0
syntax error: line 1 of /usr/share/X11/xkb
last scanned symbol is: 
Errors encountered in /usr/share/X11/xkb; not compiled.

I'm not really sure where to go from here. . .

2 Answers 2



I've finally been able to get this to work. I gave up on this problem quite some time ago and just went about things. Since then I've learned much more about programming and the unix environment in general including understanding how to use sed which was used in this script. To give some perspective, I didn't even know about man pages back when I made this question. . . Needless to say its easy to see what some of my errors were back when I made this post.

However, fixing those errors weren't enough to solve the issue. For whatever reason (that I still can't figure out), piping the key mapping into xkbcomp will not end up compiling the changes I want to make in the symbols file made above.

However, if I simply run:

setxkbmap -device $venus_keyboard -print | sed 's/\(xkb_symbols.*\)"/\1+venus"/' > keymap
xkbcomp keymap -i $venus_keyboard -synch $DISPLAY

The keys compile just fine. Honestly, I'm still confused as to why I can't just pipe the output of sed into xkbcomp, but this does map the keys on my mouse, while leaving the keys on my keyboard completely unaffected.

Hopefully this will be help to someone who is having a similar issue as I am.

Below is the entire shell script that I've written (aside from the symbols file, which has been explained in the posts from the links I provided).

If anyone has an explanation why piping the output of sed into xkbcomp isn't working (or is interested in trying to help me figure it out) shoot me a response on here. That still bugs me a little bit.


venus_keyboard=$(xinput list | sed -n 's/.*USB Laser Game Mouse[[:space:]]*id=\([0-9]*\).*keyboard.*/\1/p')
[ "$venus_keyboard" ] || exit

setxkbmap -device $venus_keyboard -print | sed 's/\(xkb_symbols.*\)"/\1+venus"/' > ~/xkb/keymap
xkbcomp ~/xkb/keymap -i $venus_keyboard -synch $DISPLAY 2>/dev/null

My wife has a very similar mouse. I did a couple of tweaks to your solution. The file /usr/share/X11/xkb/symbols/venus has following contents:

xkb_symbols "venus" {
    key <AE01> { [ KP_1          , KP_1            ] };
    key <AE02> { [ KP_2          , KP_2            ] };
    key <AE03> { [ KP_3          , KP_3            ] };
    key <AE04> { [ KP_4          , KP_4            ] };
    key <AE05> { [ KP_5          , KP_5            ] };
    key <AE06> { [ KP_6          , KP_6            ] };
    key <AE07> { [ KP_7          , KP_7            ] };
    key <AE08> { [ KP_8          , KP_8            ] };
    key <AE09> { [ KP_9          , KP_9            ] };
    key <AE10> { [ F2            , F2              ] };
    key <KPAD> { [ XF86Calculator, XF86Calculator  ] };
    key <KPSU> { [ period        , period          ] };

And the script ~/bin/mouse_config.sh which I added to MATE Desktop Environment startup has following conent:


venus_keyboard=$(xinput list | sed -n 's/.*USB Gaming Mouse[[:space:]]*id=\([0-9]*\).*keyboard.*/\1/p')
[ "$venus_keyboard" ] || exit

setxkbmap -device $venus_keyboard -print | sed 's/\(xkb_symbols.*\)"/\1+venus"/' > ~/.venus_keymap
xkbcomp ~/.venus_keymap -i $venus_keyboard -synch $DISPLAY

you will notice that I needed to tweak a little the name USB Gaming Mouse, apart from that, it all works perfect.

She is using this for blender.

Ah, but maybe someone knows how to turn off these led lights on this mouse?

  • For the RGB, you could check out OpenRGB. I'm not sure what distribution you're using, but if you happen to be using an Arch based distro it does appear to be available in the AUR: aur.archlinux.org/packages/linux-openrgb If you're using Ubuntu it seems there is a ppa available: launchpad.net/openrgb (I'm not sure if that's enough info for adding a ppa, I don't use Ubuntu). Unfortunately if you're using a distribution not based in Arch or Ubuntu, then it looks like you might have to compile it from source. Just hoping to give you an idea.
    – Nicholas R
    Oct 12, 2020 at 17:01
  • Thanks, I will check out linux-openrgb, recompiling is not a problem on devuan :-) Oct 12, 2020 at 17:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .