tvhdebug(LS_TVHDHOMERUN, "setting target to none");
tvh_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
hdhomerun_device_set_tuner_target(hfe->hf_hdhomerun_tuner, "none");
+ hdhomerun_device_tuner_lockkey_release(hfe->hf_hdhomerun_tuner);
tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
sbuf_free(&sb);
tvhinfo(LS_TVHDHOMERUN, "tuning to %s", channel_buf);
tvh_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
+
res = hdhomerun_device_tuner_lockkey_request(hfe->hf_hdhomerun_tuner, &perror);
if(res < 1) {
tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
tvherror(LS_TVHDHOMERUN, "failed to acquire lockkey: %s", perror);
return SM_CODE_TUNING_FAILED;
}
+
if (hfe->hf_type == DVB_TYPE_CABLECARD)
res = hdhomerun_device_set_tuner_vchannel(hfe->hf_hdhomerun_tuner, channel_buf);
else
res = hdhomerun_device_set_tuner_channel(hfe->hf_hdhomerun_tuner, channel_buf);
- tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
+
if(res < 1) {
+ hdhomerun_device_tuner_lockkey_release(hfe->hf_hdhomerun_tuner);
+ tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
tvherror(LS_TVHDHOMERUN, "failed to tune to %s", channel_buf);
return SM_CODE_TUNING_FAILED;
}
+ tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
+
hfe->hf_status = SIGNAL_NONE;
/* start the monitoring */
tvhtrace(LS_TVHDHOMERUN, "%s - input thread stopped", buf1);
}
+ tvh_mutex_lock(&hfe->hf_hdhomerun_device_mutex);
+ hdhomerun_device_set_tuner_target(hfe->hf_hdhomerun_tuner, "none");
hdhomerun_device_tuner_lockkey_release(hfe->hf_hdhomerun_tuner);
+ tvh_mutex_unlock(&hfe->hf_hdhomerun_device_mutex);
hfe->hf_locked = 0;
hfe->hf_status = 0;