[PATCH 04/11] Add USB UGEN support for RTEMS

Kevin Kirspel kevin-kirspel at idexx.com
Mon May 15 17:26:31 UTC 2017


---
 freebsd/sys/dev/usb/usb_dev.c              | 10 ++++++++++
 rtemsbsd/include/rtems/bsd/local/opt_usb.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/freebsd/sys/dev/usb/usb_dev.c b/freebsd/sys/dev/usb/usb_dev.c
index fe249c2..da96a99 100644
--- a/freebsd/sys/dev/usb/usb_dev.c
+++ b/freebsd/sys/dev/usb/usb_dev.c
@@ -804,9 +804,11 @@ usb_fifo_close(struct usb_fifo *f, int fflags)
 	}
 	/* check if a thread wants SIGIO */
 	if (f->async_p != NULL) {
+#ifndef __rtems__
 		PROC_LOCK(f->async_p);
 		kern_psignal(f->async_p, SIGIO);
 		PROC_UNLOCK(f->async_p);
+#endif /* __rtems__ */
 		f->async_p = NULL;
 	}
 	/* remove FWRITE and FREAD flags */
@@ -1025,6 +1027,7 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
 		break;
 
 	case FIOASYNC:
+#ifndef __rtems__
 		if (*(int *)addr) {
 			if (f->async_p != NULL) {
 				error = EBUSY;
@@ -1034,6 +1037,9 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
 		} else {
 			f->async_p = NULL;
 		}
+#else /* __rtems__ */
+		f->async_p = NULL;
+#endif /* __rtems__ */
 		break;
 
 		/* XXX this is not the most general solution */
@@ -1042,10 +1048,12 @@ usb_ioctl_f_sub(struct usb_fifo *f, u_long cmd, void *addr,
 			error = EINVAL;
 			break;
 		}
+#ifndef __rtems__
 		if (*(int *)addr != USB_PROC_GET_GID(f->async_p)) {
 			error = EPERM;
 			break;
 		}
+#endif /* __rtems__ */
 		break;
 	default:
 		return (ENOIOCTL);
@@ -1769,11 +1777,13 @@ usb_fifo_wakeup(struct usb_fifo *f)
 		selwakeup(&f->selinfo);
 		f->flag_isselect = 0;
 	}
+#ifndef __rtems__
 	if (f->async_p != NULL) {
 		PROC_LOCK(f->async_p);
 		kern_psignal(f->async_p, SIGIO);
 		PROC_UNLOCK(f->async_p);
 	}
+#endif /* __rtems__ */
 }
 
 static int
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_usb.h b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
index 7eb6148..2b7227b 100644
--- a/rtemsbsd/include/rtems/bsd/local/opt_usb.h
+++ b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
@@ -1,6 +1,6 @@
 #define USB_HAVE_CONDVAR 1
 
-#define USB_HAVE_UGEN 0
+#define USB_HAVE_UGEN 1
 
 #define USB_HAVE_BUSDMA 1
 
-- 
1.9.1



More information about the devel mailing list