On Tue, Jan 23, 2024 at 11:52:01AM +0000, Alex Frolkin wrote:
> Hi all,
>
> Has anyone had any success with getting a Huawei (Vodafone-branded)
> K5161h 4G dongle working on OpenBSD?
>
> It looks like it should work with the umb(4) driver, but the problem is
> getting it into the right mode. When I plug it in, it appears as a USB
> CD drive, and there are magic commands you can send to it to make it
> appear either as an Ethernet interface (where it does NAT and DHCP for
> you, should be supported by the cdce(4) driver) or as an MBIM device
> plus three USB serial ports (which should be supported by umb(4) and
> hopefully ucom(4)).
>
> On FreeBSD and Linux, the mode switching is done by usb_modeswitch,
> which supports switching it to either mode. usb_modeswitch compiles
> fine on OpenBSD, but fails to actually send the magic command, and the
> error code (from the usb_bulk_io function in libusb) says "unsupported
> on this platform".
umsm(4) does the equivalent in the kernel. DEV_UMASS5 seems most
likely, but there are other methods to try as well.
Index: sys/dev/usb/umsm.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/umsm.c,v
diff -u -p -r1.125 umsm.c
--- sys/dev/usb/umsm.c 2 Apr 2023 23:57:57 -0000 1.125
+++ sys/dev/usb/umsm.c 24 Jan 2024 00:40:54 -0000
@@ -147,6 +147,8 @@ static const struct umsm_type umsm_devs[
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MU609 }, DEV_TRUINSTALL},
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K4510 }, DEV_UMASS5},
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K4511 }, DEV_UMASS5},
+#define USB_PRODUCT_HUAWEI_K5161H 0x1f1d
+ {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K5161H }, DEV_UMASS5},
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1750 }, DEV_UMASS5},
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1752 }, 0},
{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E3372 }, DEV_UMASS5},