Hi,
umstc is essentially a less capable version of ucc. Now that matthieu@
recently taught wskbd to adjust the brightness in process context, we
should be able to get rid of umstc in favor of ucc.

In order for ucc to be feature compatible with umstc, it must honor the
always open quirk as pointed out by jcs@ earlier.

I don't have access to any umstc hardware. Could someone with such
hardware try the following diff? Ideally, umstc should no longer attach
whereas ucc should. A dmesg before and after would be helpful.

diff --git sys/dev/usb/ucc.c sys/dev/usb/ucc.c
index acc14ce86cf..25b391fd9ee 100644
--- sys/dev/usb/ucc.c
+++ sys/dev/usb/ucc.c
@@ -20,6 +20,7 @@
 #include <sys/systm.h>
 
 #include <dev/usb/usb.h>
+#include <dev/usb/usb_quirks.h>
 #include <dev/usb/usbhid.h>
 #include <dev/usb/usbdi.h>
 #include <dev/usb/uhidev.h>
@@ -29,6 +30,7 @@
 struct ucc_softc {
        struct uhidev    sc_hdev;
        struct hidcc    *sc_cc;
+       u_int32_t        sc_quirks;
 };
 
 int    ucc_match(struct device *, void *, void *);
@@ -76,6 +78,8 @@ ucc_attach(struct device *parent, struct device *self, void 
*aux)
        void *desc;
        int repid, size;
 
+       sc->sc_quirks = usbd_get_quirks(sc->sc_hdev.sc_udev)->uq_flags;
+
        sc->sc_hdev.sc_intr = ucc_intr;
        sc->sc_hdev.sc_parent = uha->parent;
        sc->sc_hdev.sc_udev = uha->uaa->device;
@@ -98,6 +102,9 @@ ucc_attach(struct device *parent, struct device *self, void 
*aux)
                .arg            = self,
        };
        sc->sc_cc = hidcc_attach(&hca);
+
+       if (sc->sc_quirks & UQ_ALWAYS_OPEN)
+               uhidev_open(&sc->sc_hdev);
 }
 
 int
@@ -127,6 +134,9 @@ ucc_enable(void *v, int on)
        struct ucc_softc *sc = (struct ucc_softc *)v;
        int error = 0;
 
+       if (sc->sc_quirks & UQ_ALWAYS_OPEN)
+               return 0;
+
        if (on)
                error = uhidev_open(&sc->sc_hdev);
        else
diff --git sys/dev/usb/umstc.c sys/dev/usb/umstc.c
index 4bebeb41811..c3be6cce41f 100644
--- sys/dev/usb/umstc.c
+++ sys/dev/usb/umstc.c
@@ -80,6 +80,8 @@ umstc_match(struct device *parent, void *match, void *aux)
        int size;
        void *desc;
 
+       return (UMATCH_NONE);
+
        if (UHIDEV_CLAIM_MULTIPLE_REPORTID(uha))
                return (UMATCH_NONE);
 

Reply via email to