[patch] fix umct and add F5U409 USB Serial Adaptor

Joe Talbott josepht at cstone.net
Mon Dec 11 19:29:18 PST 2006


Here's a patch that fixes umct and adds the F5U409 device.  This works
with my Belkin F5U409 USB to RS232 adaptor.  I copied over the
Makefile from uplcom and s/uplcom/umct/g.

Joe
Index: sys/dev/usbmisc/Makefile
===================================================================
RCS file: /home/dcvs/src/sys/dev/usbmisc/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- sys/dev/usbmisc/Makefile	15 Aug 2003 08:32:31 -0000	1.1
+++ sys/dev/usbmisc/Makefile	12 Dec 2006 02:20:54 -0000
@@ -2,6 +2,6 @@
 #
 
 SUBDIR= ubsa ucom ufm uftdi ugen uhid ukbd ulpt umass umodem ums \
-	uplcom uscanner uvisor uvscom
+	uplcom uscanner uvisor uvscom umct
 
 .include <bsd.subdir.mk>
Index: sys/dev/usbmisc/umct/umct.c
===================================================================
RCS file: /home/dcvs/src/sys/dev/usbmisc/umct/umct.c,v
retrieving revision 1.4
diff -u -r1.4 umct.c
--- sys/dev/usbmisc/umct/umct.c	5 Sep 2006 00:55:44 -0000	1.4
+++ sys/dev/usbmisc/umct/umct.c	12 Dec 2006 03:10:10 -0000
@@ -44,13 +44,13 @@
 #include <sys/malloc.h>
 #include <sys/bus.h>
 #include <sys/tty.h>
-#include <sys/interrupt.h>
+#include <sys/taskqueue.h>
 
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdi_util.h>
-#include <dev/usb/usbdevs.h>
-#include <dev/usb/ucomvar.h>
+#include <bus/usb/usb.h>
+#include <bus/usb/usbdi.h>
+#include <bus/usb/usbdi_util.h>
+#include <bus/usb/usbdevs.h>
+#include "../ucom/ucomvar.h"
 
 /* The UMCT advertises the standard 8250 UART registers */
 #define UMCT_GET_MSR		2	/* Get Modem Status Register */
@@ -80,7 +80,7 @@
 	uint8_t			sc_msr;
 	uint8_t			sc_lcr;
 	uint8_t			sc_mcr;
-	void			*sc_swicookie;
+	struct task		sc_task;
 };
 
 Static void umct_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
@@ -89,7 +89,7 @@
 Static int  umct_param(void *, int, struct termios *);
 Static int  umct_open(void *, int);
 Static void umct_close(void *, int);
-Static void umct_notify(void *);
+Static void umct_notify(void *, int);
 
 Static struct ucom_callback umct_callback = {
 	umct_get_status,	/* ucom_get_status */
@@ -110,6 +110,7 @@
 	{ USB_VENDOR_MCT, USB_PRODUCT_MCT_SITECOM_USB232 },
 	{ USB_VENDOR_MCT, USB_PRODUCT_MCT_DU_H3SP_USB232 },
 	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U109 },
+	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U409 },
 	{ 0, 0 }
 };
 
@@ -135,8 +136,6 @@
 MODULE_DEPEND(umct, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
 MODULE_VERSION(umct, 1);
 
-Static struct ithd *umct_ithd;
-
 USB_MATCH(umct)
 {
 	USB_MATCH_START(umct, uaa);
@@ -269,9 +268,8 @@
 	ucom->sc_portno = UCOM_UNK_PORTNO;
 	ucom->sc_opkthdrlen = 0;
 	ucom->sc_callback = &umct_callback;
+	TASK_INIT(&sc->sc_task, 0, umct_notify, sc);
 	ucom_attach(ucom);
-	swi_add(&umct_ithd, "ucom", umct_notify, sc, SWI_TTY, 0,
-	    &sc->sc_swicookie);
 
 	kfree(devinfo, M_USBDEV);
 	USB_ATTACH_SUCCESS_RETURN;
@@ -294,7 +292,6 @@
 	}
 
 	sc->sc_ucom.sc_dying = 1;
-	ithread_remove_handler(sc->sc_swicookie);
 	rv = ucom_detach(&sc->sc_ucom);
 	return (rv);
 }
@@ -346,11 +343,11 @@
 	 * Defer notifying the ucom layer as it doesn't like to be bothered
          * from an interrupt context.
 	 */
-	swi_sched(sc->sc_swicookie, 0);
+	taskqueue_enqueue(taskqueue_swi, &sc->sc_task);
 }
 
 Static void
-umct_notify(void *arg)
+umct_notify(void *arg, int count)
 {
 	struct umct_softc *sc;
 
--- /dev/null	2006-12-11 22:17:12.000000000 -0500
+++ sys/dev/usbmisc/umct/Makefile	2006-12-11 21:20:12.000000000 -0500
@@ -0,0 +1,11 @@
+# $FreeBSD: src/sys/modules/umct/Makefile,v 1.1.2.2 2002/08/11 20:05:20 joe Exp $
+# $DragonFly: src/sys/dev/usbmisc/umct/Makefile,v 1.4 2004/08/13 17:51:07 dillon Exp $
+
+.PATH: ${.CURDIR}/../ucom
+
+KMOD=	umct
+SRCS=	umct.c ucomvar.h opt_usb.h device_if.h bus_if.h
+NOMAN=
+KMODDEPS= ucom
+
+.include <bsd.kmod.mk>




More information about the Submit mailing list