summaryrefslogtreecommitdiff
path: root/nuttx/drivers/usbhost/usbhost_skeleton.c
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-08-12 16:29:33 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-08-12 16:29:33 -0600
commita9aab75d3c0903c8cfb75b4abfc44d2fc82ef2df (patch)
tree1503588f076c2528d287ba96dc2da1b8543e0f1b /nuttx/drivers/usbhost/usbhost_skeleton.c
parent3a469a7a7a10d28fb81f53b4494ff137a998bd30 (diff)
downloadnuttx-a9aab75d3c0903c8cfb75b4abfc44d2fc82ef2df.tar.gz
nuttx-a9aab75d3c0903c8cfb75b4abfc44d2fc82ef2df.tar.bz2
nuttx-a9aab75d3c0903c8cfb75b4abfc44d2fc82ef2df.zip
More changes to USB host interface to support multiple downstream ports
Diffstat (limited to 'nuttx/drivers/usbhost/usbhost_skeleton.c')
-rw-r--r--nuttx/drivers/usbhost/usbhost_skeleton.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/nuttx/drivers/usbhost/usbhost_skeleton.c b/nuttx/drivers/usbhost/usbhost_skeleton.c
index bc30eedd7..a486f8768 100644
--- a/nuttx/drivers/usbhost/usbhost_skeleton.c
+++ b/nuttx/drivers/usbhost/usbhost_skeleton.c
@@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbhost/usbhost_skeleton.c
*
- * Copyright (C) 2012 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -105,6 +105,7 @@ struct usbhost_state_s
char devchar; /* Character identifying the /dev/skel[n] device */
volatile bool disconnected; /* TRUE: Device has been disconnected */
uint8_t ifno; /* Interface number */
+ uint8_t funcaddr; /* USB function address */
int16_t crefs; /* Reference count on the driver instance */
sem_t exclsem; /* Used to maintain mutual exclusive access */
struct work_s work; /* For interacting with the worker thread */
@@ -368,7 +369,7 @@ static void usbhost_destroy(FAR void *arg)
/* Disconnect the USB host device */
- DRVR_DISCONNECT(priv->drvr);
+ DRVR_DISCONNECT(priv->drvr, priv->funcaddr);
/* And free the class instance. Hmmm.. this may execute on the worker
* thread and the work structure is part of what is getting freed. That
@@ -954,6 +955,15 @@ static int usbhost_connect(FAR struct usbhost_class_s *class,
{
udbg("usbhost_devinit() failed: %d\n", ret);
}
+ else
+ {
+ /* Save the function address (We will need it when we disconnect).
+ * NOTE that address is available in the endpoint structures as
+ * well.
+ */
+
+ priv->funcaddr = funcaddr;
+ }
}
return ret;