From 721ae4254258cd591d0f4cc298f5e8571adf7576 Mon Sep 17 00:00:00 2001 From: Andrii Bordunov Date: Thu, 5 Sep 2013 20:12:51 +0300 Subject: [PATCH] VIDIOC_QUERYCTRL: don't treat EINVAL as a fatal error If a control (V4L2_CID_AUDIO_VOLUME in our case) is not supported by VIDIOC_QUERYCTRL, EINVAL is returned. If the query operation (VIDIOC_QUERYCTRL) is not supported at all, ENOTTY is returned. Currently we use VIDIOC_QUERYCTRL just for the V4L2_CID_AUDIO_VOLUME and can survive both of these errors. Let's do it. Related to commit e5a2c03089651659f1b4159a6d7f231b1969db0b (Work with tuners that do not support V4L2_CID_AUDIO_VOLUME.) Tested-by: Paulo Cavalcanti --- fmlib.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fmlib.c b/fmlib.c index ba185a3..1da81c0 100644 --- a/fmlib.c +++ b/fmlib.c @@ -241,8 +241,9 @@ query_control(const struct tuner *tuner, uint32_t id, } } else if (ioctl(tuner->fd, VIDIOC_QUERYCTRL, qc) != -1) { /* Success. */ - } else if (errno == ENOTTY) { - /* This tuner doesn't support 'id'. */ + } else if (errno == ENOTTY || errno == EINVAL) { + /* This tuner doesn't support either query operation + * or the specific control ('id') respectively */ memset(qc, 0, sizeof *qc); } else { fatal(errno, "VIDIOC_QUERYCTRL"); -- 2.11.4.GIT