diff options
author | Robert Nagy <robert@cvs.openbsd.org> | 2008-06-11 00:00:38 +0000 |
---|---|---|
committer | Robert Nagy <robert@cvs.openbsd.org> | 2008-06-11 00:00:38 +0000 |
commit | 4b73b3e3eea0e4628c82f49362f28fafa44e8a46 (patch) | |
tree | c66e5636a7d6b0828b82bb2883a11be1d876744b /sys/dev/usb | |
parent | f556c2bf90419ac3e73b5b219993e63b5a32504e (diff) |
If bDefaultFrameIndex is 0 we should use the first bFrameIndex.
In any other case use the one reported by bDefaultFrameIndex.
Fix indentation while here
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/uvideo.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index 2b073310c43..c81ea82150e 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.31 2008/06/10 23:39:01 robert Exp $ */ +/* $OpenBSD: uvideo.c,v 1.32 2008/06/11 00:00:37 robert Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -641,17 +641,24 @@ int uvideo_vs_parse_desc_frame_mjpeg(struct uvideo_softc *sc, const usb_descriptor_t *desc) { - struct usb_video_frame_mjpeg_desc *d; + struct usb_video_frame_mjpeg_desc *d; - d = (struct usb_video_frame_mjpeg_desc *)(uint8_t *)desc; + d = (struct usb_video_frame_mjpeg_desc *)(uint8_t *)desc; - /* choose default frame index */ - if (d->bFrameIndex != sc->sc_desc_format_mjpeg->bDefaultFrameIndex) - return (1); + /* + * If bDefaultFrameIndex is not set by the device + * use the first bFrameIndex available, otherwise + * set it to the default one. + */ + if (!sc->sc_desc_format_mjpeg->bDefaultFrameIndex) + goto set; + else if (d->bFrameIndex != sc->sc_desc_format_mjpeg->bDefaultFrameIndex) + return (1); - sc->sc_desc_frame_mjpeg = d; +set: + sc->sc_desc_frame_mjpeg = d; - return (0); + return (0); } int |