-/* $OpenBSD: uvideo.c,v 1.63 2008/07/25 17:20:27 mglocker Exp $ */
+/* $OpenBSD: uvideo.c,v 1.64 2008/07/26 11:42:43 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
}
DPRINTF(1, "%s: GET probe request successfully\n", DEVNAME(sc));
- sc->sc_video_buf_size = UGETDW(pc->dwMaxVideoFrameSize);
-
DPRINTF(1, "bmHint=0x%02x\n", UGETW(pc->bmHint));
DPRINTF(1, "bFormatIndex=0x%02x\n", pc->bFormatIndex);
DPRINTF(1, "bFrameIndex=0x%02x\n", pc->bFrameIndex);
DPRINTF(1, "wCompWindowSize=%d\n", UGETW(pc->wCompWindowSize));
DPRINTF(1, "wDelay=%d (ms)\n", UGETW(pc->wDelay));
DPRINTF(1, "dwMaxVideoFrameSize=%d (bytes)\n",
- sc->sc_video_buf_size);
+ UGETDW(pc->dwMaxVideoFrameSize));
DPRINTF(1, "dwMaxPayloadTransferSize=%d (bytes)\n",
UGETDW(pc->dwMaxPayloadTransferSize));
fb->buf_size = UGETDW(sc->sc_desc_probe.dwMaxVideoFrameSize);
/* don't overflow the upper layer sample buffer */
- if (sc->sc_video_buf_size < fb->buf_size) {
+ if (sc->sc_max_fbuf_size < fb->buf_size) {
printf("%s: sofware video buffer is too small!\n", DEVNAME(sc));
return (USBD_NOMEM);
}
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_video_buf_size);
+ return (sc->sc_max_fbuf_size);
}
void
-/* $OpenBSD: video.c,v 1.18 2008/07/23 22:10:21 mglocker Exp $ */
+/* $OpenBSD: video.c,v 1.19 2008/07/26 11:42:43 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
* Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org>
if (sc->hw_if->get_bufsize)
video_buf_size = (sc->hw_if->get_bufsize)(sc->hw_hdl);
+ if (video_buf_size == EINVAL) {
+ printf("video: could not request frame buffer size\n");
+ return;
+ }
sc->sc_fbuffer = malloc(video_buf_size, M_DEVBUF, M_NOWAIT);
if (sc->sc_fbuffer == NULL) {