NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: install/60883: Device debug messages make install impossible



Hi,

Heres a compete patch (I just realized that the quirk was only used with 
ums(4)):


Don't forget to run make -f Makefile.usbdevs in the sys/dev/usb directory first.


Best regards,

Nat

PS: Disabling uts at boot probably wont work and instead flood the console with 
....not configured messages.
diff -r 92a8485b9ed3 sys/dev/usb/usb_quirks.c
--- a/sys/dev/usb/usb_quirks.c	Sun Oct 04 18:35:03 2026 +0000
+++ b/sys/dev/usb/usb_quirks.c	Fri Oct 16 14:27:50 2026 +1100
@@ -397,6 +397,8 @@ Static const struct usbd_quirk_entry {
  */
  { USB_VENDOR_CHICONY,		USB_PRODUCT_CHICONY_OPTMOUSE0939,	ANY,
 	{ UQ_ALWAYS_ON, NULL }},
+ { USB_VENDOR_ELAN,		USB_PRODUCT_ELAN_TPANEL,		ANY,
+	{ UQ_ALWAYS_ON, NULL }},
  { USB_VENDOR_PIXART,		USB_PRODUCT_PIXART_RPIMOUSE,		ANY,
 	{ UQ_ALWAYS_ON, NULL }},
  { USB_VENDOR_LOGITECH, 	USB_PRODUCT_LOGITECH_B100_1,		ANY,
diff -r 92a8485b9ed3 sys/dev/usb/usbdevs
--- a/sys/dev/usb/usbdevs	Sun Oct 04 18:35:03 2026 +0000
+++ b/sys/dev/usb/usbdevs	Fri Oct 16 14:27:50 2026 +1100
@@ -1558,6 +1558,7 @@ product EIZO MONITOR		0x0001	monitor
 
 /* ELAN Products */
 product ELAN ACTIVEJET		0x0103	ActiveJet K-2024 Multimedia Keyboard
+product ELAN TPANEL		0x0125	Elan Touchscreen controller
 
 /* ELCON Systemtechnik products */
 product ELCON PLAN		0x0002	Goldpfeil P-LAN
diff -r 92a8485b9ed3 sys/dev/usb/uts.c
--- a/sys/dev/usb/uts.c	Sun Oct 04 18:35:03 2026 +0000
+++ b/sys/dev/usb/uts.c	Fri Oct 16 14:27:50 2026 +1100
@@ -74,10 +74,13 @@ int	utsdebug = 0;
 struct uts_softc {
 	device_t sc_dev;
 	struct uhidev *sc_hdev;
+	struct usbd_device *sc_udev;
 
 	struct hid_location sc_loc_x, sc_loc_y, sc_loc_z;
 	struct hid_location sc_loc_btn;
 
+	bool	sc_alwayson;
+
 	int sc_enabled;
 
 	int flags;		/* device configuration */
@@ -139,16 +142,22 @@ uts_attach(device_t parent, device_t sel
 	struct uts_softc *sc = device_private(self);
 	struct uhidev_attach_arg *uha = aux;
 	struct wsmousedev_attach_args a;
-	int size;
+	int error, size;
 	void *desc;
 	uint32_t flags;
 	struct hid_data * d;
 	struct hid_item item;
+	uint32_t quirks;
 
 	aprint_normal("\n");
 
 	sc->sc_dev = self;
 	sc->sc_hdev = uha->parent;
+	sc->sc_udev = uha->uiaa->uiaa_device;
+
+	quirks = usbd_get_quirks(sc->sc_udev)->uq_flags;
+	if (quirks & UQ_ALWAYS_ON)
+		sc->sc_alwayson = true;
 
 	uhidev_get_report_desc(uha->parent, &desc, &size);
 
@@ -263,6 +272,14 @@ uts_attach(device_t parent, device_t sel
 	tpcalib_ioctl(&sc->sc_tpcalib, WSMOUSEIO_SCALIBCOORDS,
 	    (void *)&sc->sc_calibcoords, 0, 0);
 
+	if (sc->sc_alwayson) {
+		error = uhidev_open(sc->sc_hdev, &uts_intr, sc);
+		if (error != 0) {
+			aprint_error_dev(self,
+			    "WARNING: couldn't open always-on device\n");
+			sc->sc_alwayson = false;
+		}
+	}
 	return;
 }
 
@@ -272,9 +289,11 @@ uts_detach(device_t self, int flags)
 	struct uts_softc *sc = device_private(self);
 	int error;
 
-	__USE(sc);
 	DPRINTF(("uts_detach: sc=%p flags=%d\n", sc, flags));
 
+	if (sc->sc_alwayson)
+		uhidev_close(sc->sc_hdev);
+
 	error = config_detach_children(self, flags);
 	if (error)
 		return error;
@@ -320,7 +339,12 @@ uts_enable(void *v)
 	if (sc->sc_enabled)
 		return EBUSY;
 
-	error = uhidev_open(sc->sc_hdev, &uts_intr, sc);
+	error = 0;
+	if (!sc->sc_alwayson) {
+		error = uhidev_open(sc->sc_hdev, &uts_intr, sc);
+		if (error)
+			sc->sc_enabled = 0;
+	}
 
 	if (error != 0)
 		return error;
@@ -342,7 +366,8 @@ uts_disable(void *v)
 		return;
 
 	sc->sc_enabled = 0;
-	uhidev_close(sc->sc_hdev);
+	if (!sc->sc_alwayson)
+		uhidev_close(sc->sc_hdev);
 }
 
 Static int


Home | Main Index | Thread Index | Old Index