On 09/10/2012 05:27 PM, Mauro Carvalho Chehab wrote:
Em 15-08-2012 21:28, Antti Palosaari escreveu:
Demodulator cannot perform statistic IOCTLs when it is not tuned.
Return -EAGAIN in such case.

Signed-off-by: Antti Palosaari <[email protected]>
---
  drivers/media/dvb-core/dvb_frontend.c | 34 +++++++++++++++++++++++++---------
  1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 2bc80b1..7d079fb 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2132,27 +2132,43 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
                        err = fe->ops.read_status(fe, status);
                break;
        }
+
        case FE_READ_BER:
-               if (fe->ops.read_ber)
-                       err = fe->ops.read_ber(fe, (__u32*) parg);
+               if (fe->ops.read_ber) {
+                       if (fepriv->thread)
+                               err = fe->ops.read_ber(fe, (__u32 *) parg);
+                       else
+                               err = -EAGAIN;
+               }
                break;



        case FE_READ_SIGNAL_STRENGTH:
-               if (fe->ops.read_signal_strength)
-                       err = fe->ops.read_signal_strength(fe, (__u16*) parg);
+               if (fe->ops.read_signal_strength) {
+                       if (fepriv->thread)
+                               err = fe->ops.read_signal_strength(fe, (__u16 
*) parg);
+                       else
+                               err = -EAGAIN;
+               }
                break;

This one doesn't look right, as the frontend can be able to get the signal 
strength
at the analog part (afaik, most DVB-S frontends do that). Also, some drivers 
just
map it to the tuner RF strength.

The proper approach for it is to break signal strength into two different 
statistics:
        - analog RF strength;
        - signal strength at the demod, after having demod locked.

It makes sense to return -EAGAIN for the second case, but doing it for the 
first case
is bad, as the RF strength can be used on DVB-S devices, in order to 
fine-adjust the
antenna position.

I have to say I don't understand what you mean. That one is DVB frontend callback and it is not called in case of analog. Could you provide some example?

Frontend thread is running always when frontend is opened. It is hard for me to see why frontend FE_READ_SIGNAL_STRENGTH should be allowed call even frontend is closed.

OK, I will try to grep sources to see what you mean.

regards
Antti

--
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to