Rewritten locking of libhdhomerun functions, added accuire lock for hdhomerun devices and added better error-handeling.