-
Notifications
You must be signed in to change notification settings - Fork 30
11. CoreELEC: Bluetooth Remotes
This tutorial explains how to create a HardWare DataBase configuration file (.hwdb), and add the information from this file to the device's Hardware Database.
The Hardware Database is a key-value store for associating modalias-like keys to udev-property-like values. It is used primarily by udev to add the relevant properties to matching devices, but it can also be queried directly.
HINT: Apply this method when encountering a Bluetooth Remote with a non-responsive or erratic OK button |
---|
For this tutorial, an NVIDIA SHIELD Remote P3700 has been paired with a Khadas VIM4 SBC.
- PC with MS Windows
- Putty
- Android TV Set Top Box
- Home Area Network
- CoreELEC booting from (μ)SD Card or USB Flash Drive
- Alternate input device
- USB Mouse & Keyboard
- Remote with USB dongle (Airmouse, Wifi remote,…)
- Flirc USB Adapter
- System Tools
- Install the System Tools package from the CoreELEC Repository:
- Use an alternate input device (keyboard, mouse,…) to pair the Bluetooth remote:
SSH into the device:
- execute:
systemctl stop kodi
- execute:
cat /proc/bus/input/devices
and find the entry for the paired Bluetooth remote:
I: Bus=0005 Vendor=0955 Product=7217 Version=0002
N: Name="NVIDIA SHIELD Remote"
P: Phys=20:50:e7:7c:6c:6f
S: Sysfs=/devices/virtual/misc/uhid/0005:0955:7217.0005/input/input9
U: Uniq=a4:c1:38:d2:a6:03
H: Handlers=kbd event9
B: PROP=0
B: EV=1b
B: KEY=200 2 0 0 0 0 2010000 1110 40000800 1c1680 0 0 0
B: ABS=100 0
B: MSC=10
I
contains following device information:
B us |
V endor |
P roduct |
V ersion |
---|---|---|---|
0005 | 0955 | 7217 | 0002 |
This translates to following device code: b
0005v
0955p
7217*
NOTE: the version number is represented by an asterisk (wildcard), allowing for compatibility between different versions of the same device.
CAUTION: The Bus, Vendor, Product and Version values are hexadecimal and require to be entered in uppercase (eq: b0005v2B54p1600*)
Index | Description |
---|---|
N contains the remote name |
NVIDIA SHIELD Remote |
S contains the event handler |
…/input/input9 |
c0041 |
the code for the OK Button |
- execute:
evtest /dev/input/eventX
where X
is the event handler
Input driver version is 1.0.1
Input device ID: bus 0x5 vendor 0x955 product 0x7217 version 0x2
Input device name: "NVIDIA SHIELD Remote"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 103 (KEY_UP)
Event code 105 (KEY_LEFT)
Event code 106 (KEY_RIGHT)
Event code 108 (KEY_DOWN)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 116 (KEY_POWER)
Event code 139 (KEY_MENU)
Event code 158 (KEY_BACK)
Event code 164 (KEY_PLAYPAUSE)
Event code 168 (KEY_REWIND)
Event code 172 (KEY_HOMEPAGE)
Event code 208 (KEY_FASTFORWARD)
Event code 217 (KEY_SEARCH)
Event code 353 (KEY_SELECT)
Event code 393 (KEY_VIDEO)
Event type 3 (EV_ABS)
Event code 40 (ABS_MISC)
Value 0
Min 0
Max 1
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
- press the remotes OK button
if the correct handler was selected in evtest
, there should be feedback:
Testing ... (interrupt to exit)
Event: time 1662152630.222944, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1662152630.222944, type 1 (EV_KEY), code 353 (KEY_SELECT), value 1
Event: time 1662152630.222944, -------------- SYN_REPORT ------------
Event: time 1662152630.421979, type 3 (EV_ABS), code 40 (ABS_MISC), value 1
Event: time 1662152630.421979, -------------- SYN_REPORT ------------
Event: time 1662152630.446975, type 4 (EV_MSC), code 4 (MSC_SCAN), value c0041
Event: time 1662152630.446975, type 1 (EV_KEY), code 353 (KEY_SELECT), value 0
Event: time 1662152630.446975, -------------- SYN_REPORT ------------
NOTE: some remotes have multiple entries. If there is no feedback, try a different handler.
- go to the configuration folder:
cd /storage/.config/hwdb.d/
- create a hardware database file (format: myfile.hwdb):
nano nvidia.hwdb
- enter:
# NVIDIA SHIELD Remote
evdev:input:b0005v0955p7217*
KEYBOARD_KEY_c0041=enter
NOTE: the leading space before KEYBOARD_KEY is required.
- save file and exit nano
ctrl+o
ctrl+x
- execute:
udevadm hwdb –update
udevadm trigger -s input
NOTE: if the above commands throw an error, it usually indicates a wrongly formatted or corrupt .hwdb file.
- execute:
reboot
After the device has rebooted, the Bluetooth remote should function correctly.
This method also can be used to map functions to unused buttons, or remap to buttons.
The following addition brings up Player Process Info when pressing the Netflix button
# NVIDIA SHIELD Remote
evdev:input:b0005v0955p7217*
KEYBOARD_KEY_c0041=enter
KEYBOARD_KEY_c01b8=o
The Repository for Amlogic and MesonIR hosts Bluetooth .hwdb configuration files which can be used as reference.
hwdb(7) - Linux manual page
Repository for AmRemote & Meson IR Remote Controllers