Add checks and logger interface
Fix a bug in the xioctl function

The bug prevented a lot of settings to be set
which caused (for example) the bug that prevented
the RGB24 format to be used.

The downside is that this bug has slown down the
application significantly.