Troubleshooting Input Devices in Linux
Here are some steps for troubleshooting an input device on Linux.
1) Check the system log to see if the device is recognized:
$: dmesg
In this case we are looking for a Soundgraph imon device that has a keys, a VFD display and an IR remote sensor, so we can do:
$: dmesg|grep imon
which gives:
[ 5.499413] imon 1-1.2.2:1.0: Unknown 0xffdc device, defaulting to VFD and iMON IR
[ 5.549551] Registered IR keymap rc-imon-pad
[ 5.560342] imon 1-1.2.2:1.0: iMON device (15c2:ffdc, intf0) on usb<1:6> initialized
[ 5.560512] usbcore: registered new interface driver imon
so we can see the device has indeed been recognized.
2) Test if the device is generating input events:
$: evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: HID 1267:0103
/dev/input/event1: HID 1267:0103
/dev/input/event2: iMON Panel, Knob and Mouse(15c2:ffdc)
/dev/input/event3: iMON Remote (15c2:ffdc)
Select the device event number [0-3]:
Devices event0 and event1 are a multimedia keyboard, thus if we press “1” above we will see something like:
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x1267 product 0x103 version 0x110
Input device name: "HID 1267:0103"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 1 (KEY_ESC)
Event code 28 (KEY_ENTER)
Event code 74 (KEY_KPMINUS)
Event code 78 (KEY_KPPLUS)
Event code 103 (KEY_UP)
Event code 105 (KEY_LEFT)
Event code 106 (KEY_RIGHT)
Event code 108 (KEY_DOWN)
Event code 113 (KEY_MUTE)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 116 (KEY_POWER)
Event code 119 (KEY_PAUSE)
Event code 128 (KEY_STOP)
Event code 130 (KEY_PROPS)
Event code 131 (KEY_UNDO)
Event code 133 (KEY_COPY)
Event code 134 (KEY_OPEN)
Event code 135 (KEY_PASTE)
Event code 136 (KEY_FIND)
Event code 137 (KEY_CUT)
Event code 138 (KEY_HELP)
Event code 139 (KEY_MENU)
Event code 140 (KEY_CALC)
Event code 142 (KEY_SLEEP)
Event code 143 (KEY_WAKEUP)
Event code 144 (KEY_FILE)
Event code 150 (KEY_WWW)
Event code 152 (KEY_SCREENLOCK)
Event code 155 (KEY_MAIL)
Event code 156 (KEY_BOOKMARKS)
Event code 158 (KEY_BACK)
Event code 159 (KEY_FORWARD)
Event code 161 (KEY_EJECTCD)
Event code 163 (KEY_NEXTSONG)
Event code 164 (KEY_PLAYPAUSE)
Event code 165 (KEY_PREVIOUSSONG)
Event code 166 (KEY_STOPCD)
Event code 167 (KEY_RECORD)
Event code 168 (KEY_REWIND)
Event code 169 (KEY_PHONE)
Event code 171 (KEY_CONFIG)
Event code 172 (KEY_HOMEPAGE)
Event code 173 (KEY_REFRESH)
Event code 174 (KEY_EXIT)
Event code 177 (KEY_SCROLLUP)
Event code 178 (KEY_SCROLLDOWN)
Event code 181 (KEY_NEW)
Event code 206 (KEY_CLOSE)
Event code 207 (KEY_PLAY)
Event code 208 (KEY_FASTFORWARD)
Event code 209 (KEY_BASSBOOST)
Event code 210 (KEY_PRINT)
Event code 212 (KEY_CAMERA)
Event code 216 (KEY_CHAT)
Event code 217 (KEY_SEARCH)
Event code 219 (KEY_FINANCE)
Event code 224 (KEY_BRIGHTNESSDOWN)
Event code 225 (KEY_BRIGHTNESSUP)
Event code 228 (KEY_KBDILLUMTOGGLE)
Event code 234 (KEY_SAVE)
Event code 235 (KEY_DOCUMENTS)
Event code 240 (KEY_UNKNOWN)
Event code 241 (KEY_VIDEO_NEXT)
Event code 244 (KEY_BRIGHTNESS_ZERO)
Event code 256 (BTN_0)
Event code 353 (KEY_SELECT)
Event code 354 (KEY_GOTO)
Event code 358 (KEY_INFO)
Event code 362 (KEY_PROGRAM)
Event code 366 (KEY_PVR)
Event code 370 (KEY_SUBTITLE)
Event code 372 (KEY_ZOOM)
Event code 374 (KEY_KEYBOARD)
Event code 376 (KEY_PC)
Event code 377 (KEY_TV)
Event code 378 (KEY_TV2)
Event code 379 (KEY_VCR)
Event code 380 (KEY_VCR2)
Event code 381 (KEY_SAT)
Event code 383 (KEY_CD)
Event code 384 (KEY_TAPE)
Event code 386 (KEY_TUNER)
Event code 387 (KEY_PLAYER)
Event code 389 (KEY_DVD)
Event code 392 (KEY_AUDIO)
Event code 393 (KEY_VIDEO)
Event code 396 (KEY_MEMO)
Event code 397 (KEY_CALENDAR)
Event code 398 (KEY_RED)
Event code 399 (KEY_GREEN)
Event code 400 (KEY_YELLOW)
Event code 401 (KEY_BLUE)
Event code 402 (KEY_CHANNELUP)
Event code 403 (KEY_CHANNELDOWN)
Event code 405 (KEY_LAST)
Event code 407 (KEY_NEXT)
Event code 408 (KEY_RESTART)
Event code 409 (KEY_SLOW)
Event code 410 (KEY_SHUFFLE)
Event code 412 (KEY_PREVIOUS)
Event code 416 (KEY_VIDEOPHONE)
Event code 417 (KEY_GAMES)
Event code 418 (KEY_ZOOMIN)
Event code 419 (KEY_ZOOMOUT)
Event code 420 (KEY_ZOOMRESET)
Event code 421 (KEY_WORDPROCESSOR)
Event code 422 (KEY_EDITOR)
Event code 423 (KEY_SPREADSHEET)
Event code 424 (KEY_GRAPHICSEDITOR)
Event code 425 (KEY_PRESENTATION)
Event code 426 (KEY_DATABASE)
Event code 427 (KEY_NEWS)
Event code 428 (KEY_VOICEMAIL)
Event code 429 (KEY_ADDRESSBOOK)
Event code 430 (KEY_MESSENGER)
Event code 431 (KEY_DISPLAYTOGGLE)
Event code 432 (KEY_SPELLCHECK)
Event code 433 (KEY_LOGOFF)
Event code 439 (KEY_MEDIA_REPEAT)
Event code 442 (?)
Event code 576 (?)
Event code 577 (?)
Event code 578 (?)
Event code 579 (?)
Event code 580 (?)
Event code 581 (?)
Event code 582 (?)
Event code 592 (?)
Event code 593 (?)
Event type 2 (EV_REL)
Event code 6 (REL_HWHEEL)
Event type 3 (EV_ABS)
Event code 32 (ABS_VOLUME)
Value 0
Min 0
Max 572
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Which shows a list of multimedia key codes and what they are mapped to. We can now press any button on the keyboard and see how it is recognized, for example the mute button:
Event: time 1499451644.597210, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00e2
Event: time 1499451644.597210, type 1 (EV_KEY), code 113 (KEY_MUTE), value 1
Event: time 1499451644.597210, -------------- EV_SYN ------------
Event: time 1499451644.685177, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00e2
Event: time 1499451644.685177, type 1 (EV_KEY), code 113 (KEY_MUTE), value 0
Event: time 1499451644.685177, -------------- EV_SYN ------------
An event is generated for key down and key up.