Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Compute a unique port number from interface index.
details: https://anonhg.NetBSD.org/src/rev/0656af2f121c
branches: trunk
changeset: 368734:0656af2f121c
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Jul 31 13:01:16 2022 +0000
description:
Compute a unique port number from interface index.
diffstat:
sys/dev/usb/umodem_common.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diffs (42 lines):
diff -r 0cb06c650006 -r 0656af2f121c sys/dev/usb/umodem_common.c
--- a/sys/dev/usb/umodem_common.c Sun Jul 31 12:59:26 2022 +0000
+++ b/sys/dev/usb/umodem_common.c Sun Jul 31 13:01:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: umodem_common.c,v 1.35 2021/08/07 16:19:17 thorpej Exp $ */
+/* $NetBSD: umodem_common.c,v 1.36 2022/07/31 13:01:16 mlelstv Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.35 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.36 2022/07/31 13:01:16 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -68,6 +68,7 @@
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
+#include <dev/usb/usbdivar.h>
#include <dev/usb/usbdevs.h>
#include <dev/usb/usb_quirks.h>
@@ -260,6 +261,15 @@
ucaa->ucaa_iface = sc->sc_data_iface;
ucaa->ucaa_arg = sc;
+ /*
+ * Each port takes two interfaces (control and data).
+ *
+ * If no port number is assigned by the specific driver,
+ * use the interface to compute a logical port number.
+ */
+ if (ucaa->ucaa_portno == UCOM_UNK_PORTNO)
+ ucaa->ucaa_portno = uiaa->uiaa_iface->ui_index / 2;
+
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
DPRINTF(("umodem_common_attach: sc=%p\n", sc));
Home |
Main Index |
Thread Index |
Old Index