diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2011-03-26 07:57:43 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2011-03-26 07:57:43 +0000 |
commit | 14fecd0c78405a2d0d4cefc5045fb02d9a6ac2ff (patch) | |
tree | 4750a6b5f6535d9817af8e23dc650d5ab54d9534 /sys | |
parent | 98fd4fb837ff9c7632dbfba2299bca3b960b9c13 (diff) |
print the supported frame intervals when printing the frame descriptor
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/uvideo.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index 4b15d66da45..518eb39d064 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.152 2011/03/25 23:19:41 jakemsr Exp $ */ +/* $OpenBSD: uvideo.c,v 1.153 2011/03/26 07:57:42 jakemsr Exp $ */ /* * Copyright (c) 2008 Robert Nagy <robert@openbsd.org> @@ -2464,6 +2464,8 @@ void uvideo_dump_desc_frame(struct uvideo_softc *sc, const usb_descriptor_t *desc) { struct usb_video_frame_desc *d; + uint8_t *p; + int length, i; d = (struct usb_video_frame_desc *)(uint8_t *)desc; @@ -2481,6 +2483,36 @@ uvideo_dump_desc_frame(struct uvideo_softc *sc, const usb_descriptor_t *desc) printf("dwDefaultFrameInterval=%d\n", UGETDW(d->dwDefaultFrameInterval)); printf("bFrameIntervalType=0x%02x\n", d->bFrameIntervalType); + + p = (uint8_t *)d; + p += sizeof(struct usb_video_frame_desc); + + if (!d->bFrameIntervalType) { + /* continuous */ + if (d->bLength < (sizeof(struct usb_video_frame_desc) + + sizeof(uDWord) * 3)) { + printf("invalid frame descriptor length\n"); + } else { + printf("dwMinFrameInterval = %d\n", UGETDW(p)); + p += sizeof(uDWord); + printf("dwMaxFrameInterval = %d\n", UGETDW(p)); + p += sizeof(uDWord); + printf("dwFrameIntervalStep = %d\n", UGETDW(p)); + p += sizeof(uDWord); + } + } else { + /* discrete */ + length = d->bLength - sizeof(struct usb_video_frame_desc); + for (i = 0; i < d->bFrameIntervalType; i++) { + if (length <= 0) { + printf("frame descriptor ended early\n"); + break; + } + printf("dwFrameInterval = %d\n", UGETDW(p)); + p += sizeof(uDWord); + length -= sizeof(uDWord); + } + } } void |