diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-31 19:20:26 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-01-31 19:20:26 +0000 |
commit | 28a0241ccd48963a13638c1dfbef161ab1bf557e (patch) | |
tree | 6ab43c61dc2813511ef296f8cb313d1a4a217b07 /nuttx/drivers/usbdev/pl2303.c | |
parent | 9de6f4d501826f76a5cce3631c6b98b1a6c01d0a (diff) | |
download | px4-firmware-28a0241ccd48963a13638c1dfbef161ab1bf557e.tar.gz px4-firmware-28a0241ccd48963a13638c1dfbef161ab1bf557e.tar.bz2 px4-firmware-28a0241ccd48963a13638c1dfbef161ab1bf557e.zip |
Missing calls to class SUSPEND/RESUME methods in all USB drivers
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5590 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/usbdev/pl2303.c')
-rw-r--r-- | nuttx/drivers/usbdev/pl2303.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/nuttx/drivers/usbdev/pl2303.c b/nuttx/drivers/usbdev/pl2303.c index 98163f133..7b07a9cba 100644 --- a/nuttx/drivers/usbdev/pl2303.c +++ b/nuttx/drivers/usbdev/pl2303.c @@ -343,6 +343,12 @@ static int usbclass_setup(FAR struct usbdevclass_driver_s *driver, size_t outlen); static void usbclass_disconnect(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); +#ifdef CONFIG_SERIAL_REMOVABLE +static void usbclass_suspend(FAR struct usbdevclass_driver_s *driver, + FAR struct usbdev_s *dev); +static void usbclass_resume(FAR struct usbdevclass_driver_s *driver, + FAR struct usbdev_s *dev); +#endif /* Serial port *************************************************************/ @@ -366,8 +372,13 @@ static const struct usbdevclass_driverops_s g_driverops = usbclass_unbind, /* unbind */ usbclass_setup, /* setup */ usbclass_disconnect, /* disconnect */ +#ifdef CONFIG_SERIAL_REMOVABLE + usbclass_suspend, /* suspend */ + usbclass_resume, /* resume */ +#else NULL, /* suspend */ NULL, /* resume */ +#endif }; /* Serial port *************************************************************/ @@ -1889,6 +1900,79 @@ static void usbclass_disconnect(FAR struct usbdevclass_driver_s *driver, } /**************************************************************************** + * Name: usbclass_suspend + * + * Description: + * Handle the USB suspend event. + * + ****************************************************************************/ + +#ifdef CONFIG_SERIAL_REMOVABLE +static void usbclass_suspend(FAR struct usbdevclass_driver_s *driver, + FAR struct usbdev_s *dev) +{ + FAR struct cdcacm_dev_s *priv; + + usbtrace(TRACE_CLASSSUSPEND, 0); + +#ifdef CONFIG_DEBUG + if (!driver || !dev) + { + usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0); + return; + } +#endif + + /* Extract reference to private data */ + + priv = ((FAR struct cdcacm_driver_s*)driver)->dev; + + /* And let the "upper half" driver now that we are suspended */ + + uart_connected(&priv->serdev, false); +} +#endif + +/**************************************************************************** + * Name: usbclass_resume + * + * Description: + * Handle the USB resume event. + * + ****************************************************************************/ + +#ifdef CONFIG_SERIAL_REMOVABLE +static void usbclass_resume(FAR struct usbdevclass_driver_s *driver, + FAR struct usbdev_s *dev) +{ + FAR struct cdcacm_dev_s *priv; + + usbtrace(TRACE_CLASSRESUME, 0); + +#ifdef CONFIG_DEBUG + if (!driver || !dev) + { + usbtrace(TRACE_CLSERROR(USBSER_TRACEERR_INVALIDARG), 0); + return; + } +#endif + + /* Extract reference to private data */ + + priv = ((FAR struct cdcacm_driver_s*)driver)->dev; + + /* Are we still configured? */ + + if (priv->config != PL2303_CONFIGIDNONE) + { + /* Yes.. let the "upper half" know that have resumed */ + + uart_connected(&priv->serdev, true); + } +} +#endif + +/**************************************************************************** * Serial Device Methods ****************************************************************************/ |