Index | Thread | Search

From:
Arnaud Fontaine <arnau@duckcorp.org>
Subject:
patch: urndis: Fix for Unisoc phone
To:
tech@openbsd.org
Date:
Sat, 04 Apr 2026 12:08:41 +0200

Download raw body.

Thread
  • Arnaud Fontaine:

    patch: urndis: Fix for Unisoc phone

Hello,

Currently, urndis does not work with Unisoc phone with the following
error[0][1] (`urndis0` network interface is not available):
  urndis0 at uhub1 port 1 configuration 1 interface 0 "Unisoc Unisoc Phone" rev 2.00/0.01 addr 2
  urndis0: using Vendor: interface alternate setting 0 failed
  ugen0 at uhub1 port 1 configuration 1 "Unisoc Unisoc Phone" rev 2.00/0.01 addr 2

I think this is because the first alternateSetting (equal to 0 here) is
already activated when selecting a USB configuration. Here is a patch
from FreeBSD USB implementation which makes urndis works for Unisoc
phone.

Cheers, 
Arnaud

Index: usbdi.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/usbdi.c,v
diff -u -p -r1.112 usbdi.c
--- usbdi.c	3 Apr 2025 11:02:44 -0000	1.112
+++ usbdi.c	27 Mar 2026 09:06:49 -0000
@@ -672,6 +672,13 @@ usbd_set_interface(struct usbd_interface
 	if (LIST_FIRST(&iface->pipes) != 0)
 		return (USBD_IN_USE);
 
+	if (iface->altindex == altno)
+		/* 
+		 * Optimise away duplicate setting of
+		 * alternate setting in USB Host Mode!
+		 */
+		return (USBD_NORMAL_COMPLETION);
+
 	endpoints = iface->endpoints;
 	nendpt = iface->nendpt;
 	err = usbd_fill_iface_data(iface->device, iface->index, altno);

[0] https://marc.info/?l=openbsd-bugs&m=177352253903338&w=2
[1] https://marc.info/?l=openbsd-bugs&m=177446728007101&w=2