summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-09 09:48:05 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2010-10-09 09:48:05 +0000
commit1c7a6b97070f129f2baf27897c9085e49d08cde5 (patch)
tree9612ad0be5944c43055d7e1e97e3a9bf89363c81 /sys/dev
parentbee242872ee7106f4af3c9775cce357ab6ae2095 (diff)
* define structure that represents USB descriptor with variable sized
member the way uaudio does, make the variable sized member as large as it can be and don't define the following members. * reenable control support for devices where bControlSize != 2 in the processing unit descriptor. tested on alpha, amd64, i386, sparc64 and zaurus, as well as the machine where previous support for variable bControlSize caused a hang.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uvideo.c19
-rw-r--r--sys/dev/usb/uvideo.h9
2 files changed, 11 insertions, 17 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index aaa42f919cd..91d40e1b765 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.141 2010/10/09 08:41:28 jakemsr Exp $ */
+/* $OpenBSD: uvideo.c,v 1.142 2010/10/09 09:48:03 jakemsr Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -674,20 +674,14 @@ uvideo_vc_parse_desc_pu(struct uvideo_softc *sc,
{
struct usb_video_vc_processing_desc *d;
- d = (struct usb_video_vc_processing_desc *)(uint8_t *)desc;
+ /* PU descriptor is variable sized */
+ d = (void *)desc;
if (sc->sc_desc_vc_pu_num == UVIDEO_MAX_PU) {
printf("%s: too many PU descriptors found!\n", DEVNAME(sc));
return (USBD_INVAL);
}
- /* XXX support variable bmControls fields */
- if (d->bControlSize != 2) {
- printf("%s: video control not supported for this device.\n",
- DEVNAME(sc));
- return (USBD_INVAL);
- }
-
sc->sc_desc_vc_pu[sc->sc_desc_vc_pu_num] = d;
sc->sc_desc_vc_pu_num++;
@@ -2573,7 +2567,8 @@ uvideo_dump_desc_processing(struct uvideo_softc *sc,
{
struct usb_video_vc_processing_desc *d;
- d = (struct usb_video_vc_processing_desc *)(uint8_t *)desc;
+ /* PU descriptor is variable sized */
+ d = (void *)desc;
printf("bLength=%d\n", d->bLength);
printf("bDescriptorType=0x%02x\n", d->bDescriptorType);
@@ -2584,8 +2579,8 @@ uvideo_dump_desc_processing(struct uvideo_softc *sc,
printf("bControlSize=%d\n", d->bControlSize);
printf("bmControls=0x");
uvideo_hexdump(d->bmControls, d->bControlSize, 1);
- printf("iProcessing=0x%02x\n", d->iProcessing);
- printf("bmVideoStandards=0x%02x\n", d->bmVideoStandards);
+ printf("iProcessing=0x%02x\n", d->bmControls[d->bControlSize]);
+ printf("bmVideoStandards=0x%02x\n", d->bmControls[d->bControlSize + 1]);
}
void
diff --git a/sys/dev/usb/uvideo.h b/sys/dev/usb/uvideo.h
index 509f6f8deb4..44cb38d37a9 100644
--- a/sys/dev/usb/uvideo.h
+++ b/sys/dev/usb/uvideo.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.h,v 1.49 2010/10/09 08:41:28 jakemsr Exp $ */
+/* $OpenBSD: uvideo.h,v 1.50 2010/10/09 09:48:04 jakemsr Exp $ */
/*
* Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
@@ -217,10 +217,9 @@ struct usb_video_vc_processing_desc {
uByte bSourceID;
uWord wMaxMultiplier;
uByte bControlSize;
- uWord bmControls; /* XXX must be variable size of bControlSize */
- uByte iProcessing;
- uByte bmVideoStandards;
-
+ uByte bmControls[255]; /* [bControlSize] */
+ /* uByte iProcessing; */
+ /* uByte bmVideoStandards; */
} __packed;
/* Table 3-9: VC Extension Unit Descriptor */