Make one more Sonix chipset cam work with 640x480 by a) adding it to the
authormglocker <mglocker@openbsd.org>
Mon, 26 Jul 2010 07:01:08 +0000 (07:01 +0000)
committermglocker <mglocker@openbsd.org>
Mon, 26 Jul 2010 07:01:08 +0000 (07:01 +0000)
UVIDEO_FLAG_FIX_MAX_VIDEO_FRAME_SIZE quirk list and b) cranking the
manually calculated frame size by pixels * 4 bytes (discussed with
jakemsr@).

sys/dev/usb/uvideo.c

index 7a4f78a..e216059 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvideo.c,v 1.133 2010/07/15 04:46:33 mglocker Exp $ */
+/*     $OpenBSD: uvideo.c,v 1.134 2010/07/26 07:01:08 mglocker Exp $ */
 
 /*
  * Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -328,6 +328,13 @@ struct uvideo_devs {
            NULL,
            UVIDEO_FLAG_FIX_MAX_VIDEO_FRAME_SIZE
        },
+       {
+           /* Needs to fix dwMaxVideoFrameSize */
+           { USB_VENDOR_MICRODIA, USB_PRODUCT_MICRODIA_CAM_1 },
+           NULL,
+           NULL,
+           UVIDEO_FLAG_FIX_MAX_VIDEO_FRAME_SIZE
+       },
 };
 #define uvideo_lookup(v, p) \
        ((struct uvideo_devs *)usb_lookup(uvideo_devs, v, p))
@@ -1116,7 +1123,7 @@ uvideo_vs_parse_desc_frame_uncompressed(struct uvideo_softc *sc,
            sc->sc_fmtgrp[fmtidx].pixelformat == V4L2_PIX_FMT_YUYV) {
                fd = (struct usb_video_frame_uncompressed_desc *)
                    sc->sc_fmtgrp[fmtidx].frame[d->bFrameIndex]; 
-               fbuf_size = UGETW(fd->wWidth) * UGETW(fd->wHeight) * 2;
+               fbuf_size = UGETW(fd->wWidth) * UGETW(fd->wHeight) * 4;
                DPRINTF(1, "wWidth = %d, wHeight = %d\n",
                        UGETW(fd->wWidth), UGETW(fd->wHeight));
        } else
@@ -1469,7 +1476,7 @@ uvideo_vs_get_probe(struct uvideo_softc *sc, uint8_t *probe_data,
                    sc->sc_fmtgrp_cur->pixelformat == V4L2_PIX_FMT_YUYV) {
                        USETDW(pc->dwMaxVideoFrameSize, 
                            UGETW(sc->sc_fmtgrp_cur->frame_cur->wWidth) *
-                           UGETW(sc->sc_fmtgrp_cur->frame_cur->wHeight) * 2);
+                           UGETW(sc->sc_fmtgrp_cur->frame_cur->wHeight) * 4);
                }
        }