diff options
author | Yojiro Uo <yuo@cvs.openbsd.org> | 2008-12-10 08:19:24 +0000 |
---|---|---|
committer | Yojiro Uo <yuo@cvs.openbsd.org> | 2008-12-10 08:19:24 +0000 |
commit | f486404117a4ec95538c5c3bb2d738114b84290a (patch) | |
tree | ef732fc0bf171d7fb2d4a96502764b91884924c8 | |
parent | cfac4aed9039cc5ba9d7f013ccee7aff0f027acc (diff) |
use maximum value of dwMaxVideoFrameBufferSize in each vs descriptors
as the maximum frame buffer size of video(4)
current logic potentially brake the device initialization
(and the result of the query is not correct).
ok mglocker@
-rw-r--r-- | sys/dev/usb/uvideo.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index 354f3a672a7..593dc604025 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.104 2008/12/09 06:01:41 brad Exp $ */ +/* $OpenBSD: uvideo.c,v 1.105 2008/12/10 08:19:23 yuo Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -966,6 +966,10 @@ uvideo_vs_parse_desc_frame_mjpeg(struct uvideo_softc *sc, sc->sc_fmtgrp[fmtidx].format->bNumFrameDescriptors) sc->sc_fmtgrp_idx++; + /* store max value */ + if (UGETDW(d->dwMaxVideoFrameBufferSize) > sc->sc_max_fbuf_size) + sc->sc_max_fbuf_size = UGETDW(d->dwMaxVideoFrameBufferSize); + return (USBD_NORMAL_COMPLETION); } @@ -999,6 +1003,10 @@ uvideo_vs_parse_desc_frame_uncompressed(struct uvideo_softc *sc, sc->sc_fmtgrp[fmtidx].format->bNumFrameDescriptors) sc->sc_fmtgrp_idx++; + /* store max value */ + if (UGETDW(d->dwMaxVideoFrameBufferSize) > sc->sc_max_fbuf_size) + sc->sc_max_fbuf_size = UGETDW(d->dwMaxVideoFrameBufferSize); + return (USBD_NORMAL_COMPLETION); } @@ -2975,20 +2983,6 @@ int uvideo_get_bufsize(void *v) { struct uvideo_softc *sc = v; - struct usb_video_probe_commit *pc; - uint8_t probe_data[34]; - usbd_status error; - - pc = (struct usb_video_probe_commit *)probe_data; - - /* find the maximum frame size */ - bzero(probe_data, sizeof(probe_data)); - error = uvideo_vs_get_probe(sc, probe_data, GET_MAX); - if (error != USBD_NORMAL_COMPLETION) { - return (EINVAL); - } - - sc->sc_max_fbuf_size = UGETDW(pc->dwMaxVideoFrameSize); return (sc->sc_max_fbuf_size); } |