UTNuclearRoboticsPublic/keyboard_reader

Hitting caps/num lock leads to core dump

kruusamae opened this issue · 2 comments

Whenever caps or num lock is pressed, program terminates with the following message.
Warning: unexpected event type; ev->type = 0x0011
Segmentation fault (core dumped)

The capslock issue has been resolved with commit: a625ad2

numlock is somewhat trickier. It breaks at line 94 in keyboard_event_publisher.cpp because the size of the event vector is 0. So accessing event[0] would lead to indexing out of bound (thus the seg fault.)

I could throw in a catch for that, but in reality there's a weirder problem happening. The numlock key on dell keyboards is supposed to always have a code of 0x0045, but it sometimes reports a code of 0x0000. This might inevitably be the cause of the zero sized event vector (not 100% sure yet.) There also seems to be reported weirdness with dell keyboard drivers:
dell drivers

see lines 171-179 for the weird stuff. I could either try digging deeper into device code, or I could kinda patch the problem with a catch to ignore all ev->code with 0x0000.

caps and num lock are fixed as of 401cf04

I verified the /keyboard topic could decipher both caps and num lock. Let me know if this is not the case for you.