diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-04 17:35:19 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-12-04 17:35:19 +0000 |
commit | 49d757566aca9120bc0b479b72b8aa547959ce7c (patch) | |
tree | dc8e23ad0a0d4044bbcd2d4b4488be9bc0146bb8 /nuttx/drivers/usbdev | |
parent | 3d3a0af8b0d724f46656b6a9cb4a883f374558dc (diff) | |
download | px4-nuttx-49d757566aca9120bc0b479b72b8aa547959ce7c.tar.gz px4-nuttx-49d757566aca9120bc0b479b72b8aa547959ce7c.tar.bz2 px4-nuttx-49d757566aca9120bc0b479b72b8aa547959ce7c.zip |
USB class drivers need to call DEV_CONNECT
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3159 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/usbdev')
-rw-r--r-- | nuttx/drivers/usbdev/usbdev_scsi.c | 1 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/usbdev_serial.c | 10 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/usbdev_storage.c | 10 | ||||
-rw-r--r-- | nuttx/drivers/usbdev/usbdev_storage.h | 46 |
4 files changed, 44 insertions, 23 deletions
diff --git a/nuttx/drivers/usbdev/usbdev_scsi.c b/nuttx/drivers/usbdev/usbdev_scsi.c index 7fd9f200f..0f1d9dd38 100644 --- a/nuttx/drivers/usbdev/usbdev_scsi.c +++ b/nuttx/drivers/usbdev/usbdev_scsi.c @@ -60,6 +60,7 @@ #include <sys/types.h> #include <stdint.h> #include <stdbool.h> +#include <unistd.h> #include <pthread.h> #include <string.h> #include <errno.h> diff --git a/nuttx/drivers/usbdev/usbdev_serial.c b/nuttx/drivers/usbdev/usbdev_serial.c index 4e7b38908..a5a25178d 100644 --- a/nuttx/drivers/usbdev/usbdev_serial.c +++ b/nuttx/drivers/usbdev/usbdev_serial.c @@ -1392,6 +1392,10 @@ static int usbclass_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver #ifdef CONFIG_USBDEV_SELFPOWERED DEV_SETSELFPOWERED(dev); #endif + + /* And pull-up the data line for the soft connect function */ + + DEV_CONNECT(dev); return OK; errout: @@ -1830,6 +1834,12 @@ static void usbclass_disconnect(FAR struct usbdev_s *dev) priv->serdev.xmit.head = 0; priv->serdev.xmit.tail = 0; irqrestore(flags); + + /* Perform the soft connect function so that we will we can be + * re-enumerated. + */ + + DEV_CONNECT(dev); } /**************************************************************************** diff --git a/nuttx/drivers/usbdev/usbdev_storage.c b/nuttx/drivers/usbdev/usbdev_storage.c index d714339eb..7aa0a388f 100644 --- a/nuttx/drivers/usbdev/usbdev_storage.c +++ b/nuttx/drivers/usbdev/usbdev_storage.c @@ -601,6 +601,10 @@ static int usbstrg_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver_ #ifdef CONFIG_USBDEV_SELFPOWERED DEV_SETSELFPOWERED(dev); #endif + + /* And pull-up the data line for the soft connect function */ + + DEV_CONNECT(dev); return OK; errout: @@ -1045,6 +1049,12 @@ static void usbstrg_disconnect(FAR struct usbdev_s *dev) priv->theventset |= USBSTRG_EVENT_DISCONNECT; pthread_cond_signal(&priv->cond); irqrestore(flags); + + /* Perform the soft connect function so that we will we can be + * re-enumerated. + */ + + DEV_CONNECT(dev); } /**************************************************************************** diff --git a/nuttx/drivers/usbdev/usbdev_storage.h b/nuttx/drivers/usbdev/usbdev_storage.h index 03c07f734..75317dcbc 100644 --- a/nuttx/drivers/usbdev/usbdev_storage.h +++ b/nuttx/drivers/usbdev/usbdev_storage.h @@ -367,21 +367,21 @@ struct usbstrg_lun_s struct usbstrg_dev_s { - FAR struct usbdev_s *usbdev; /* usbdev driver pointer (Non-null if registered) */ + FAR struct usbdev_s *usbdev; /* usbdev driver pointer (Non-null if registered) */ /* Worker thread interface */ - pthread_t thread; /* The worker thread */ - pthread_mutex_t mutex; /* Mutually exclusive access to resources*/ - pthread_cond_t cond; /* Used to signal worker thread */ + pthread_t thread; /* The worker thread */ + pthread_mutex_t mutex; /* Mutually exclusive access to resources*/ + pthread_cond_t cond; /* Used to signal worker thread */ volatile uint8_t thstate; /* State of the worker thread */ volatile uint16_t theventset; /* Set of pending events signaled to worker thread */ volatile uint8_t thvalue; /* Value passed with the event (must persist) */ /* Storage class configuration and state */ - uint8_t nluns:4; /* Number of LUNs */ - uint8_t config; /* Configuration number */ + uint8_t nluns:4; /* Number of LUNs */ + uint8_t config; /* Configuration number */ /* Endpoints */ @@ -394,29 +394,29 @@ struct usbstrg_dev_s struct usbstrg_lun_s *lun; /* Currently selected LUN */ struct usbstrg_lun_s *luntab; /* Allocated table of all LUNs */ uint8_t cdb[USBSTRG_MAXCDBLEN]; /* Command data (cdb[]) from CBW */ - uint8_t phaseerror:1; /* Need to send phase sensing status */ - uint8_t shortpacket:1; /* Host transmission stopped unexpectedly */ - uint8_t cbwdir:2; /* Direction from CBW. See USBSTRG_FLAGS_DIR* definitions */ - uint8_t cdblen; /* Length of cdb[] from CBW */ - uint8_t cbwlun; /* LUN from the CBW */ - uint16_t nsectbytes; /* Bytes buffered in iobuffer[] */ - uint16_t nreqbytes; /* Bytes buffered in head write requests */ - uint16_t iosize; /* Size of iobuffer[] */ - uint32_t cbwlen; /* Length of data from CBW */ - uint32_t cbwtag; /* Tag from the CBW */ + uint8_t phaseerror:1; /* Need to send phase sensing status */ + uint8_t shortpacket:1; /* Host transmission stopped unexpectedly */ + uint8_t cbwdir:2; /* Direction from CBW. See USBSTRG_FLAGS_DIR* definitions */ + uint8_t cdblen; /* Length of cdb[] from CBW */ + uint8_t cbwlun; /* LUN from the CBW */ + uint16_t nsectbytes; /* Bytes buffered in iobuffer[] */ + uint16_t nreqbytes; /* Bytes buffered in head write requests */ + uint16_t iosize; /* Size of iobuffer[] */ + uint32_t cbwlen; /* Length of data from CBW */ + uint32_t cbwtag; /* Tag from the CBW */ union { - uint32_t xfrlen; /* Read/Write: Sectors remaining to be transferred */ - uint32_t alloclen; /* Other device-to-host: Host allocation length */ + uint32_t xfrlen; /* Read/Write: Sectors remaining to be transferred */ + uint32_t alloclen; /* Other device-to-host: Host allocation length */ } u; - uint32_t sector; /* Current sector (relative to lun->startsector) */ - uint32_t residue; /* Untransferred amount reported in the CSW */ - uint8_t *iobuffer; /* Buffer for data transfers */ + uint32_t sector; /* Current sector (relative to lun->startsector) */ + uint32_t residue; /* Untransferred amount reported in the CSW */ + uint8_t *iobuffer; /* Buffer for data transfers */ /* Write request list */ - struct sq_queue_s wrreqlist; /* List of empty write request containers */ - struct sq_queue_s rdreqlist; /* List of filled read request containers */ + struct sq_queue_s wrreqlist; /* List of empty write request containers */ + struct sq_queue_s rdreqlist; /* List of filled read request containers */ /* Pre-allocated write request containers. The write requests will * be linked in a free list (wrreqlist), and used to send requests to |