daemon: cleanups to output error messages and silence compiler warnings

Misc cleanups from last weekend:

* make sure to print an error message when opening, reading or writing to
  various files/devices fails
* more updates for more consistent indentation and code style
* use booleans instead of strings as arguments to internal functions
* clean up unused includes and code

NOTE: I'm able to build tohkbd with these changes without any warnings on my box, but as I sent my keyboard back to Dirk for fixing I haven't actually tested these changes on the device.