mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Cc: Robert Jarzmik <robert.jarzmik@atosorigin.com>
Subject: [PATCH 4/5] usb/gadget: add USB serial connect and disconnect
Date: Thu, 24 Nov 2011 04:01:29 +0100	[thread overview]
Message-ID: <1322103690-32669-5-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1322103690-32669-1-git-send-email-robert.jarzmik@free.fr>

From: Robert Jarzmik <robert.jarzmik@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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-11-24  3:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  3:01 [PATCH 0/5] Enable a console over a serial USB gadget Robert Jarzmik
2011-11-24  3:01 ` [PATCH 1/5] console: add console unregistering Robert Jarzmik
2011-11-24  3:01 ` [PATCH 2/5] usb/gadget: add pxa27x_udc driver Robert Jarzmik
2011-11-24  3:01 ` [PATCH 3/5] usb/gadget: use generic usb_gadget_poll() in u_serial Robert Jarzmik
2011-11-24  3:01 ` Robert Jarzmik [this message]
2011-11-24  3:01 ` [PATCH 5/5] usb/gadget: make serial gadget resistant to cable unplug Robert Jarzmik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322103690-32669-5-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    --cc=robert.jarzmik@atosorigin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox