Extend boardctl() USB device control to include PL2303 serial

This commit is contained in:
Gregory Nutt
2016-03-25 16:01:40 -06:00
parent 78be285ca5
commit 512a31527b
+26
View File
@@ -51,6 +51,7 @@
#ifdef CONFIG_BOARDCTL_USBDEVCTRL #ifdef CONFIG_BOARDCTL_USBDEVCTRL
# include <nuttx/usb/cdcacm.h> # include <nuttx/usb/cdcacm.h>
# include <nuttx/usb/pl2303.h>
# include <nuttx/usb/usbmsc.h> # include <nuttx/usb/usbmsc.h>
# include <nuttx/usb/composite.h> # include <nuttx/usb/composite.h>
#endif #endif
@@ -108,6 +109,29 @@ static inline int boardctl_usbdevctrl(FAR struct boardioc_usbdev_ctrl_s *ctrl)
default: default:
ret = -EINVAL; ret = -EINVAL;
break;
}
break;
#endif
#ifdef CONFIG_PL2303
case BOARDIOC_USBDEV_PL2303: /* PL2303 serial, not in a composite */
switch (ctrl->action)
{
case BOARDIOC_USBDEV_INITIALIZE: /* Initialize PL2303 serial device */
break; /* There is no PL2303 serial initialization */
case BOARDIOC_USBDEV_CONNECT: /* Connect the CDC/ACM device */
ret = usbdev_serialinitialize(ctrl->instance);
break;
case BOARDIOC_USBDEV_DISCONNECT: /* There is no PL2303 serial disconnect */
ret = -ENOSYS;
break;
default:
ret = -EINVAL;
break;
} }
break; break;
#endif #endif
@@ -139,6 +163,7 @@ static inline int boardctl_usbdevctrl(FAR struct boardioc_usbdev_ctrl_s *ctrl)
default: default:
ret = -EINVAL; ret = -EINVAL;
break;
} }
break; break;
#endif #endif
@@ -173,6 +198,7 @@ static inline int boardctl_usbdevctrl(FAR struct boardioc_usbdev_ctrl_s *ctrl)
default: default:
ret = -EINVAL; ret = -EINVAL;
break;
} }
break; break;
#endif #endif