I'm back to continue the investigation. The gamepad is the same as
https://www.gearbest.com/video-game/pp_167775.html.
With "cat /proc/bus/input/devices", it shows:
I: Bus=0005 Vendor=2717 Product=3144 Version=0129
N: Name="小米蓝牙手柄"
P: Phys=43:45:c0:00:1f:ac
S: Sysfs=/devices/c11084c0.serial/tty/ttyS1/hci0/hci0:11/0005:2717:3144.0001/input/input6
U: Uniq=ac:fd:93:f0:b0:70
H: Handlers=kbd js1 event5
B: PROP=0
B: EV=10001b
B: KEY=7fff0000 0 0 0 1000 40000000 1680 0 0 0
B: ABS=100 3047f
B: MSC=10
If I run "cat /dev/input/js1", I can see output when I press buttons on the gamepad.
According to
Keymap (wiki), I can custom Joystick Configuration by joystick name and button ids. 'id' is the button ID used by SDL. Joystick button ids of connected joysticks appear in kodi.log when they are pressed. Use your log to map custom buttons to actions.
I already have the joystick name, but when I look at kodi.log, I can only find those "libinput: event5 - debounce state" instead of button ids. Can someone shed some light? Is this something that can be fixed by config file? Or it lacks the support from the low-level driver and simply won't work?
00:32:31.065 T:4096783216 DEBUG: CLibInputHandler:
eviceAdded - keyboard type device added: 小米蓝牙手柄 (event5)
00:32:31.065 T:4096783216 DEBUG: CLibInputKeyboard::GetRepeat - delay: 500ms repeat: 33ms for 小米蓝牙手柄 (event5)
00:32:31.069 T:3954156400 INFO: AddOnLog: Joystick Support: Initialized joystick 1: "小米蓝牙手柄", axes: 11, hats: 0, buttons: 15
00:32:31.113 T:3954156400 DEBUG: GetMappingForDevice - device (0000:0000) mapped to (type = joystick)
00:32:31.168 T:3954156400 DEBUG: Failed to load button map for "小米蓝牙手柄"
00:32:31.201 T:3954156400 DEBUG: Previous line repeats 2 times.
00:32:31.201 T:3954156400 DEBUG: Initialise - initialised peripheral on 'peripheral.joystick/1' with 1 features and 0 sub devices
00:32:31.201 T:3954156400 NOTICE: Register - new joystick device registered on addon->peripheral.joystick/1: 小米蓝牙手柄
00:32:38.957 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_OTHERBUTTON → DEBOUNCE_STATE_IS_UP
00:32:38.957 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_PRESS → DEBOUNCE_STATE_DOWN_WAITING
00:32:38.982 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_DOWN_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_DOWN
00:32:39.159 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_IS_DOWN → DEBOUNCE_EVENT_RELEASE → DEBOUNCE_STATE_RELEASE_WAITING
00:32:39.171 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_RELEASE_WAITING → DEBOUNCE_EVENT_TIMEOUT_SHORT → DEBOUNCE_STATE_RELEASED
00:32:39.184 T:4096783216 DEBUG: libinput: event5 - debounce state: DEBOUNCE_STATE_RELEASED → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_UP