Change the behavior of the UVIDEO_FLAG_REATTACH flag to attach an
authormglocker <mglocker@openbsd.org>
Mon, 31 May 2021 21:06:48 +0000 (21:06 +0000)
committermglocker <mglocker@openbsd.org>
Mon, 31 May 2021 21:06:48 +0000 (21:06 +0000)
unsupported device to uvideo(4), but not to video(1), instead of just
keeping it unmatched.  Also uvideo(4) will print a message about the
device not being supported.

ok mpi@

sys/dev/usb/uvideo.c

index 79297d8..1b3788d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvideo.c,v 1.212 2021/04/05 20:45:49 mglocker Exp $ */
+/*     $OpenBSD: uvideo.c,v 1.213 2021/05/31 21:06:48 mglocker Exp $ */
 
 /*
  * Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -490,9 +490,6 @@ uvideo_match(struct device *parent, void *match, void *aux)
        /* quirk devices */
        quirk = uvideo_lookup(uaa->vendor, uaa->product);
        if (quirk != NULL) {
-               if (quirk->flags & UVIDEO_FLAG_NOATTACH)
-                       return (UMATCH_NONE);
-
                if (quirk->flags & UVIDEO_FLAG_REATTACH)
                        return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
 
@@ -578,6 +575,11 @@ uvideo_attach(struct device *parent, struct device *self, void *aux)
        /* maybe the device has quirks */
        sc->sc_quirk = uvideo_lookup(uaa->vendor, uaa->product);
 
+       if (sc->sc_quirk && sc->sc_quirk->flags & UVIDEO_FLAG_NOATTACH) {
+               printf("%s: device not supported\n", DEVNAME(sc));
+               return;
+       }
+
        if (sc->sc_quirk && sc->sc_quirk->ucode_name)
                config_mountroot(self, uvideo_attach_hook);
        else