Index | Thread | Search

From:
David Leadbeater <dgl@dgl.cx>
Subject:
uonerng(4) attach only once
To:
tech@openbsd.org
Date:
Mon, 12 Oct 2026 10:01:21 +1100

Download raw body.

Thread
  • David Leadbeater:

    uonerng(4) attach only once

uonerng(4) was attempting to attach for both the data and control
interfaces, resulting in it trying to attach twice for a single device
and then failing (which called usbd_deactivate for the udev):

uonerng0 at uhub3 port 4 configuration 1 interface 0 "Moonbase Otago http://www.moonbaseotago.com/random 00" rev 2.00/0.09 addr 10
uonerng1 at uhub3 port 4 configuration 1 interface 1 "Moonbase Otago http://www.moonbaseotago.com/random 00" rev 2.00/0.09 addr 10
uonerng1: failed to open bulk-in pipe: IN_USE

There are several reports of this issue in the past. Tested on "v2.0"
hardware, tests on other versions if anyone has one would be welcome.

ok?

Index: uonerng.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uonerng.c,v
diff -u -p -r1.7 uonerng.c
--- uonerng.c	23 May 2024 03:21:09 -0000	1.7
+++ uonerng.c	11 Oct 2026 22:39:57 -0000
@@ -151,6 +151,9 @@ uonerng_match(struct device *parent, voi
 	    uaa->product != USB_PRODUCT_OPENMOKO2_ONERNG)
 		return UMATCH_NONE;
 
+	if (uaa->ifaceno != ONERNG_IFACE_CTRL_INDEX)
+		return UMATCH_NONE;
+
 	return UMATCH_VENDOR_PRODUCT;
 }
 
@@ -192,6 +195,7 @@ uonerng_attach(struct device *parent, st
 		    DEVNAME(sc));
 		goto fail;
 	}
+	usbd_claim_iface(sc->sc_udev, ONERNG_IFACE_CTRL_INDEX);
 
 	err = usbd_device2interface_handle(sc->sc_udev,
 	    ONERNG_IFACE_DATA_INDEX, &sc->sc_data_iface);
@@ -200,6 +204,7 @@ uonerng_attach(struct device *parent, st
 		    DEVNAME(sc), usbd_errstr(err));
 		goto fail;
 	}
+	usbd_claim_iface(sc->sc_udev, ONERNG_IFACE_DATA_INDEX);
 
 	/* Find the bulk endpoints */
 	id = usbd_get_interface_descriptor(sc->sc_data_iface);