summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2008-12-17 18:14:47 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2008-12-17 18:14:47 +0000
commit7e2e3174519967e54e6c5f28c163263924424176 (patch)
tree7fbf47ba13a0113e10192ddce0ff50c787537be6 /sys/dev
parentb2701fd362ceebffe0d56693f8c31c761b55dbe4 (diff)
- Extend our quirk device table by a flags field.
- Add Apple iSight first revision device to the quirk table for future code. - Fix some logic in the device matching function. OK deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uvideo.c43
-rw-r--r--sys/dev/usb/uvideo.h4
2 files changed, 29 insertions, 18 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index cb2bd5382c1..329114f46ef 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.109 2008/12/17 08:39:01 mglocker Exp $ */
+/* $OpenBSD: uvideo.c,v 1.110 2008/12/17 18:14:46 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -240,19 +240,31 @@ struct video_hw_if uvideo_hw_if = {
* Devices which either fail to declare themselves as UICLASS_VIDEO,
* or which need firmware uploads or other quirk handling later on.
*/
+#define UVIDEO_FLAG_ISIGHT_STREAM_HEADER 0x1
struct uvideo_devs {
- struct usb_devno uv_dev;
- char *ucode_name;
- usbd_status (*ucode_loader)(struct uvideo_softc *);
+ struct usb_devno uv_dev;
+ char *ucode_name;
+ usbd_status (*ucode_loader)(struct uvideo_softc *);
+ int flags;
} uvideo_devs[] = {
{
{ USB_VENDOR_RICOH, USB_PRODUCT_RICOH_VGPVCC7 },
"r5u87x-05ca-183a.fw",
- uvideo_ucode_loader_ricoh
+ uvideo_ucode_loader_ricoh,
+ 0
},
- { /* Incorrectly reports as UICLASS_VENDOR */
+ { /* Incorrectly reports as UICLASS_VENDOR */
{ USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMOEM_1 },
- NULL, NULL
+ NULL,
+ NULL,
+ 0
+ },
+ {
+ /* Has a own streaming header format */
+ { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_ISIGHT_1 },
+ NULL,
+ NULL,
+ UVIDEO_FLAG_ISIGHT_STREAM_HEADER
}
};
#define uvideo_lookup(v, p) \
@@ -355,9 +367,7 @@ uvideo_match(struct device *parent, void *match, void *aux)
id->bInterfaceSubClass == UISUBCLASS_VIDEOCONTROL)
return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
- if (uvideo_lookup(uaa->vendor, uaa->product) != NULL &&
- id->bInterfaceClass == UICLASS_VENDOR &&
- id->bInterfaceSubClass == UISUBCLASS_VIDEOCONTROL)
+ if (uvideo_lookup(uaa->vendor, uaa->product) != NULL)
return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
return (UMATCH_NONE);
@@ -393,10 +403,11 @@ uvideo_attach(struct device *parent, struct device *self, void *aux)
if (error != USBD_NORMAL_COMPLETION)
return;
- /* if the device needs ucode do mountroothook */
- sc->sc_ucode = uvideo_lookup(uaa->vendor, uaa->product);
+ /* maybe the device has quirks */
+ sc->sc_quirk = uvideo_lookup(uaa->vendor, uaa->product);
- if ((sc->sc_ucode && sc->sc_ucode->ucode_name) && rootvp == NULL)
+ /* if the device needs ucode do mountroothook */
+ if ((sc->sc_quirk && sc->sc_quirk->ucode_name) && rootvp == NULL)
mountroothook_establish(uvideo_attach_hook, sc);
else
uvideo_attach_hook(sc);
@@ -408,8 +419,8 @@ uvideo_attach_hook(void *arg)
struct uvideo_softc *sc = arg;
usbd_status error;
- if (sc->sc_ucode && sc->sc_ucode->ucode_name) {
- error = (sc->sc_ucode->ucode_loader)(sc);
+ if (sc->sc_quirk && sc->sc_quirk->ucode_name) {
+ error = (sc->sc_quirk->ucode_loader)(sc);
if (error != USBD_NORMAL_COMPLETION)
return;
}
@@ -3055,7 +3066,7 @@ uvideo_ucode_loader_ricoh(struct uvideo_softc *sc)
}
/* open microcode file */
- error = loadfirmware(sc->sc_ucode->ucode_name, &ucode, &ucode_size);
+ error = loadfirmware(sc->sc_quirk->ucode_name, &ucode, &ucode_size);
if (error != 0) {
printf("%s: loadfirmware error=%d!\n", DEVNAME(sc), error);
return (USBD_INVAL);
diff --git a/sys/dev/usb/uvideo.h b/sys/dev/usb/uvideo.h
index 9ff2bbdb3e3..350845792f2 100644
--- a/sys/dev/usb/uvideo.h
+++ b/sys/dev/usb/uvideo.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.h,v 1.41 2008/12/08 22:02:39 deraadt Exp $ */
+/* $OpenBSD: uvideo.h,v 1.42 2008/12/17 18:14:46 mglocker Exp $ */
/*
* Copyright (c) 2007 Robert Nagy <robert@openbsd.org>
@@ -600,5 +600,5 @@ struct uvideo_softc {
uint8_t *sc_uplayer_fbuffer;
void (*sc_uplayer_intr)(void *);
- struct uvideo_devs *sc_ucode;
+ struct uvideo_devs *sc_quirk;
};