Extend the USB device/class interface: Add parameters to pass the EP0 OUT data that should accompany the OUT SETUP request

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4595 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-04-12 16:30:48 +00:00
parent 333bd7254a
commit a571bad413
15 changed files with 65 additions and 40 deletions
+15 -8
View File
@@ -184,7 +184,8 @@ static void cdcacm_unbind(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev);
static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev,
FAR const struct usb_ctrlreq_s *ctrl);
FAR const struct usb_ctrlreq_s *ctrl, FAR uint8_t *dataout,
size_t outlen);
static void cdcacm_disconnect(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev);
@@ -1168,7 +1169,8 @@ static void cdcacm_unbind(FAR struct usbdevclass_driver_s *driver,
static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev,
FAR const struct usb_ctrlreq_s *ctrl)
FAR const struct usb_ctrlreq_s *ctrl,
FAR uint8_t *dataout, size_t outlen)
{
FAR struct cdcacm_dev_s *priv;
FAR struct usbdev_req_s *ctrlreq;
@@ -1398,14 +1400,19 @@ static int cdcacm_setup(FAR struct usbdevclass_driver_s *driver,
case ACM_SET_LINE_CODING:
{
if (ctrl->type == (USB_DIR_OUT|USB_REQ_TYPE_CLASS|USB_REQ_RECIPIENT_INTERFACE) &&
len == SIZEOF_CDC_LINECODING && index == CDCACM_NOTIFID)
len == SIZEOF_CDC_LINECODING && /* dataout && len == outlen && */
index == CDCACM_NOTIFID)
{
/* Save the new line coding in the private data structure */
/* Save the new line coding in the private data structure. NOTE:
* that this is conditional now because not all device controller
* drivers supported provisioni of EP0 OUT data with the setup
* command.
*/
#warning "There is no mechanism now for the class driver to receive EP0 SETUP OUT data"
#if 0
memcpy(&priv->linecoding, ctrlreq->buf, MIN(len, 7));
#endif
if (dataout && len <= SIZEOF_CDC_LINECODING) /* REVISIT */
{
memcpy(&priv->linecoding, dataout, SIZEOF_CDC_LINECODING);
}
ret = 0;
/* If there is a registered callback to receive line status info, then