sc-controller
sc-controller copied to clipboard
sc-controller is limited in the keys it can send
I'm trying to set my controller to send keys which aren't ordinarily on the keyboard to act as a push-to-talk button for Mumble without interfering with the operation of other software. I've been trying to set it to send the F13 key but the scc-daemon crashes:
Traceback (most recent call last):
File "/usr/bin/scc-daemon", line 36, in <module>
main()
File "/usr/bin/scc-daemon", line 32, in main
daemon.debug()
File "/usr/lib/python2.7/dist-packages/scc/sccdaemon.py", line 1097, in debug
self.run()
File "/usr/lib/python2.7/dist-packages/scc/sccdaemon.py", line 656, in run
fn()
File "/usr/lib/python2.7/dist-packages/scc/drivers/sc_by_cable.py", line 81, in _timer
self.input(self._last_tup)
File "/usr/lib/python2.7/dist-packages/scc/drivers/sc_dongle.py", line 214, in input
self.mapper.input(self, old_state, idata)
File "/usr/lib/python2.7/dist-packages/scc/mapper.py", line 451, in input
self.generate_events()
File "/usr/lib/python2.7/dist-packages/scc/mapper.py", line 458, in generate_events
self.keyboard.pressEvent(self.keypress_list)
File "/usr/lib/python2.7/dist-packages/scc/uinput.py", line 553, in pressEvent
self.scanEvent(Scans[i])
KeyError: <Keys.KEY_F13: 183>
It seems that there is a static list of key scan codes which the scc-daemon emulates:
https://github.com/kozec/sc-controller/blob/ce92c773b8b26f6404882e9209aff212c4053170/scc/uinput.py#L58
Going deeper into uinput, it seems scc-daemon is sending keyboard scan codes when it could be sending raw key events, as shown in the example from the kernel documentation:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/input/uinput.rst?id=a38fd8748464831584a19438cbb3082b5a2dab15#n95
I'm wondering if there's a particular reason for scc-daemon to send scan codes instead of key events? Sending key events would eliminate the need for the restricted list of static key codes and scc-daemon could send any key at all from its list of key codes generated from the kernel headers.
I'm wondering if there's a particular reason for scc-daemon to send scan codes instead of key events?
It seemd like best solution at the time (what's code phrase for 'i can't remember why I did it like this'). I don't have any problem with changing so it works better.