From: Pablo Date: Sun, 28 Dec 2025 11:43:53 +0000 (+0100) Subject: fix hdhomerun tuner release X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22ec4915c90ceb924f52e91ae5b9355819e45d18;p=thirdparty%2Ftvheadend.git fix hdhomerun tuner release --- diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index 22ebba04e..c2bd965d7 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -213,6 +213,7 @@ tvhdhomerun_frontend_input_thread ( void *aux ) 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); @@ -407,22 +408,28 @@ static int tvhdhomerun_frontend_tune(tvhdhomerun_frontend_t *hfe, mpegts_mux_ins 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 */ @@ -479,7 +486,10 @@ tvhdhomerun_frontend_stop_mux 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;