Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2012 22:06:56 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        Juergen Lock <nox@jelal.kn-bremen.de>
Cc:        freebsd-multimedia@FreeBSD.org, hselasky@FreeBSD.org
Subject:   Re: In case mythtv setup is broken for you too...
Message-ID:  <20120926200656.GA60363@triton8.kn-bremen.de>
In-Reply-To: <20120812154930.GA23878@triton8.kn-bremen.de>
References:  <20120812154930.GA23878@triton8.kn-bremen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 12, 2012 at 05:49:30PM +0200, Juergen Lock wrote:
> Hi!
> 
>  (I guess I should post here too :)
> 
>  If mythtv setup is broken for you reporting a failed FE_GET_INFO ioctl
> like reported in this mythtv ticket:
> 
> 	http://code.mythtv.org/trac/ticket/10830
> 
> (reduced testcase:
> 
> 	http://people.freebsd.org/~nox/tmp/ioctltst.c
> 
> ) try this media tree patch I posted a little while ago: (i.e. apply it
> to webcamd, there's a Download patch link at the top)
> 
> 	http://patchwork.linuxtv.org/patch/13563/
> 
>  The full thread in case you want to help testing/reviewing the patch
> for upstream Linux:
> 
> 	http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/51644

The patch needed a small tweak for webcamd 3.7.0.3, maybe we should
add it to EXTRA_PATCHES as an OPTION?

--- media_tree/drivers/media/dvb-core/dvb_frontend.c.orig
+++ media_tree/drivers/media/dvb-core/dvb_frontend.c
@@ -603,6 +603,7 @@ static int dvb_frontend_thread(void *dat
 	enum dvbfe_algo algo;
 
 	bool re_tune = false;
+	bool semheld = false;
 
 	dev_dbg(fe->dvb->device, "%s:\n", __func__);
 
@@ -626,6 +627,8 @@ restart:
 
 		if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
 			/* got signal or quitting */
+			if (!down_interruptible (&fepriv->sem))
+				semheld = true;
 			fepriv->exit = DVB_FE_NORMAL_EXIT;
 			break;
 		}
@@ -741,6 +744,8 @@ restart:
 		fepriv->exit = DVB_FE_NO_EXIT;
 	mb();
 
+	if (semheld)
+		up(&fepriv->sem);
 	dvb_frontend_wakeup(fe);
 	return 0;
 }
@@ -1819,16 +1824,20 @@ static int dvb_frontend_ioctl(struct fil
 	int err = -ENOTTY;
 
 	dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd));
-	if (fepriv->exit != DVB_FE_NO_EXIT)
+	if (down_interruptible (&fepriv->sem))
+		return -ERESTARTSYS;
+
+	if (fepriv->exit != DVB_FE_NO_EXIT) {
+		up(&fepriv->sem);
 		return -ENODEV;
+	}
 
 	if ((file->f_flags & O_ACCMODE) == O_RDONLY &&
 	    (_IOC_DIR(cmd) != _IOC_READ || cmd == FE_GET_EVENT ||
-	     cmd == FE_DISEQC_RECV_SLAVE_REPLY))
+	     cmd == FE_DISEQC_RECV_SLAVE_REPLY)) {
+		up(&fepriv->sem);
 		return -EPERM;
-
-	if (down_interruptible (&fepriv->sem))
-		return -ERESTARTSYS;
+	}
 
 	if ((cmd == FE_SET_PROPERTY) || (cmd == FE_GET_PROPERTY))
 		err = dvb_frontend_ioctl_properties(file, cmd, parg);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120926200656.GA60363>