Thursday, September 28, 2023
 Popular · Latest · Hot · Upcoming
rated 0 times [  2] [ 0]  / answers: 1 / hits: 751  / 1 Year ago, mon, october 10, 2022, 5:38:41

I have a G7BTS remote controller, which has both keyboard and multimedia buttons. Most of its buttons work well except "OK" button.

The OK button has a keycode 353, which means KEY_SELECT. But my ubuntu 20.04 does not recognize it.

Below are some researches I have done:

  1. sudo evtest


/dev/input/event9:  G7BTS Keyboard
/dev/input/event10: G7BTS Mouse
/dev/input/event11: G7BTS Consumer Control
/dev/input/event12: G7BTS System Control

  1. grep "" /sys/class/input/event11/device/id/*



  1. sudo evtest /dev/input/event11


Testing ... (interrupt to exit)
Event: time 1640250050.701930, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1640250050.701930, type 1 (EV_KEY), code 353 (KEY_SELECT), value 1
Event: time 1640250050.701930, -------------- SYN_REPORT ------------

  1. /etc/udev/hwdb.d/60-keyboard.hwdb

I tried to remap OK button to 'enter'.

60-keyboard.hwdb file content:


  1. sudo udevadm hwdb --test='evdev:input:b0005v045ep0041*'



So far, I still cannot see any output in xev when I press OK button.

Any suggestions and help will be appreciated.

More From » keyboard


Thanks everyone.

It took me several days to find out the solution, finally, I found the right way.


Map scancodes to keycodes


Version 11 of the X protocol only supports single-byte key codes. So key codes above 255 are ignored. Ubuntu 20.04 LTS, so far, still uses version 11 of X protocol.

My G7BTS remote keyboard has a “OK” button. This button has a key code of 353. Within “xev”, nothing happens when this button is pressed.


By brief, the solution is to create a hwdb configuration file, which is used to remap certain keys to other keys.


udev provides a builtin function called hwdb to maintain the hardware database index in /etc/udev/hwdb.bin. The database is compiled from files with .hwdb extension located in directories /usr/lib/udev/hwdb.d/, /run/udev/hwdb.d/ and /etc/udev/hwdb.d/. The default scancodes-to-keycodes mapping file is /usr/lib/udev/hwdb.d/60-keyboard.hwdb.

Generic input devices (also USB keyboards) identified by the usb kernel modalias:


where <bus_id>, <vendor_id> and <version_id> are the 4-digit hex uppercase vendor, product and version IDs

How to find those ids above is the key

install hardinfo
sudo apt install hardinfo
software – System Profiler – Input Devices – G7BTS Comsumer Control

Device Information
Name G7BTS Comsumer Control
Type keyboard
Bus 0x0005
Vender 0x045e
Product 0x0041
Version 0x0300

Another import thing is to get the scan code of the “OK” button.

install evtest
sudo apt-get install evtest
sudo evtest

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Lid Switch
/dev/input/event1: Sleep Button
/dev/input/event2: Power Button
/dev/input/event3: AT Translated Set 2 keyboard
/dev/input/event4: SynPS/2 Synaptics TouchPad
/dev/input/event5: TPPS/2 IBM TrackPoint
/dev/input/event6: ThinkPad Extra Buttons
/dev/input/event7: Video Bus
/dev/input/event8: Integrated Camera: Integrated C
/dev/input/event9: G7BTS Keyboard
/dev/input/event10: G7BTS Mouse
/dev/input/event11: G7BTS Consumer Control
/dev/input/event12: G7BTS System Control
/dev/input/event13: HDA Intel PCH Mic
/dev/input/event14: HDA Intel PCH Dock Mic
/dev/input/event15: HDA Intel PCH Headphone
/dev/input/event16: HDA Intel PCH Dock Headphone
/dev/input/event17: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event11: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event19: HDA Intel PCH HDMI/DP,pcm=8
Select the device event number [0-19]: ^C

Pay attention to “/dev/input/event11”

sudo evtest /dev/input/event11

Then press “OK” button, and the output is below

Event: time 1640238746.775220, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1640238746.775220, type 1 (EV_KEY), code 353 (KEY_SELECT), value 0
Event: time 1640238746.775220, -------------- SYN_REPORT ------------

Pay attention to “value c0041“. This value c0041 is the scan code of “OK” button.

Make the hwdb file

Now, we have the ids and the scan code we need. Put them into the “Generic input devices (also USB keyboards) identified by the usb kernel modalias” above, and finally we have the configuration file G7BTS.hwdb below:


In the context, the “OK” button is mapped into “enter” key. You can map it into any key you want.

Put file to destination

sudo mv G7BTS.hwdb /etc/udev/hwdb.d/


sudo udevadm hwdb --update
sudo udevadm trigger --verbose


sudo udevadm hwdb --test='evdev:input:b0005v045Ep0041e0300*'

result is


The End

That is all the steps to remap keys. Those remapping still work after reboot.

[#914] Monday, October 10, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 435
Total Questions: 111
Total Answers: 109

Location: Angola
Member since Tue, May 5, 2020
3 Years ago