add a bit of const-correctness

Signed-off-by: Jan Dvořák <mordae@anilinux.org>
use version from the build system in -V output

Signed-off-by: Jan Dvořák <mordae@anilinux.org>
restructure library and add device context

Signed-off-by: Jan Dvořák <mordae@anilinux.org>