[PATCH 4/5] usb/gadget: add USB serial connect and disconnect
Robert Jarzmik
robert.jarzmik at free.fr
Wed Nov 23 22:01:29 EST 2011
From: Robert Jarzmik <robert.jarzmik at atosorigin.com>
The serial gadget can only work if the serial function is
properly connected on USB trigger (ie. on SET_CONFIGURATION
or SET_INTERFACE USB message triggering set_alt() in
composite.c).
Make this connection and handle also the disconnection in
f_serial.
Signed-off-by: Robert Jarzmik <robert.jarzmik at free.fr>
---
drivers/usb/gadget/f_serial.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/gadget/f_serial.c b/drivers/usb/gadget/f_serial.c
index 5b7eb2c..b933105 100644
--- a/drivers/usb/gadget/f_serial.c
+++ b/drivers/usb/gadget/f_serial.c
@@ -16,7 +16,6 @@
#include "gadget_chips.h"
#include "u_serial.h"
-
/*
* This function packages a simple "generic serial" port with no real
* control mechanisms, just raw data transfer over two bulk endpoints.
@@ -140,6 +139,7 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
gser->hs.in, gser->fs.in);
gser->port.out_desc = ep_choose(cdev->gadget,
gser->hs.out, gser->fs.out);
+ gserial_connect(&gser->port, gser->port_num);
}
return 0;
@@ -147,7 +147,10 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
static void gser_disable(struct usb_function *f)
{
+ struct f_gser *gser = func_to_gser(f);
+
DBG(cdev, "generic ttyGS%d deactivated\n", gser->port_num);
+ gserial_disconnect(&gser->port);
}
/*-------------------------------------------------------------------------*/
--
1.7.5.4
More information about the barebox
mailing list