From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: linux-media@vger.kernel.org
Cc: mchehab@kernel.org, "Frank Schäfer" <fschaefer.oss@googlemail.com>
Subject: [PATCH 3/5] em28xx: don't treat device as webcam if an unknown sensor is detected
Date: Sat, 15 Apr 2017 12:05:02 +0200 [thread overview]
Message-ID: <20170415100504.3076-3-fschaefer.oss@googlemail.com> (raw)
In-Reply-To: <20170415100504.3076-1-fschaefer.oss@googlemail.com>
With an unknown sensor, norm_maxw() and norm_maxh() return 0 as max.
height and width values, which causes a devide by zero in size_to_scale().
Of course we could use speculative default values for unknown sensors,
but the chance that the device works at this resolution without any
driver/setup is very low and therefore not worth the efforts.
Instead, just don't treat the device as camera.
A message will then be printed to the log that the device isn't supported.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
---
drivers/media/usb/em28xx/em28xx-cards.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 5f80a1b2fb8c..48c7fec47509 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2917,7 +2917,9 @@ static void em28xx_card_setup(struct em28xx *dev)
* If sensor is not found, then it isn't a webcam.
*/
if (dev->board.is_webcam) {
- if (em28xx_detect_sensor(dev) < 0)
+ em28xx_detect_sensor(dev);
+ if (dev->em28xx_sensor == EM28XX_NOSENSOR)
+ /* NOTE: error/unknown sensor/no sensor */
dev->board.is_webcam = 0;
}
@@ -3665,9 +3667,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
try_bulk = usb_xfer_mode > 0;
}
- /* Disable V4L2 if the device doesn't have a decoder */
+ /* Disable V4L2 if the device doesn't have a decoder or image sensor */
if (has_video &&
- dev->board.decoder == EM28XX_NODECODER && !dev->board.is_webcam) {
+ dev->board.decoder == EM28XX_NODECODER &&
+ dev->em28xx_sensor == EM28XX_NOSENSOR) {
+
dev_err(&interface->dev,
"Currently, V4L2 is not supported on this model\n");
has_video = false;
--
2.12.2
next prev parent reply other threads:[~2017-04-15 10:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-15 10:05 [PATCH 1/5] em28xx: get rid of the dummy clock source Frank Schäfer
2017-04-15 10:05 ` [PATCH 2/5] em28xx: add missing auto-selections for build Frank Schäfer
2017-04-15 10:05 ` Frank Schäfer [this message]
2017-04-15 10:05 ` [PATCH 4/5] em28xx: shed some light on video input formats Frank Schäfer
2017-04-15 10:05 ` [PATCH 5/5] em28xx: add support for V4L2_PIX_FMT_SRGGB8 Frank Schäfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170415100504.3076-3-fschaefer.oss@googlemail.com \
--to=fschaefer.oss@googlemail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.