Add input device support
Continuing the progress from #172 (closed), this is what I have currently written. Some parts were written some time ago so I might have messed some essential logic, also I added some comments about impl details to better understand what I'm doing but I can remove it before merging if it's unnecessary. I intend to run uncrustify before merging, so don't mind my ugly formatting :)
Also, I have only ever used GitHub for pull requests before so pardon in advance if something's wrong with this MR.