[EMAIL PROTECTED] wrote:
Yes, but for reading/writing they should be the same.

But it's definitely different behavior. With ACM I was able to establish a connection (data loss, due to no flow control, but that's expected), and I could send both ways. Without ACM, I _never_ saw this. The gadget->host direction always stopped very soon (no requests free, old requests did not get requeued because of no completion callback called).

Sorry, I wasn't precise. The code in g_serial for reading/writing is the same whether you are using it as an ACM device or a usbserial generic device. The host side is, of course, different in these two cases.

I have a guess of what the problem might be.  Set interface is handled
specially for PXA and the g_serial code mistakenly assumes that it is
in ACM mode there.

Try this patch and let me know if it makes a difference.

This patch assumes that the g_serial ACM patch has been applied.
It is against 2.6.9-rc1, but you should be able to get it to
apply to your backport (maybe by hand if necessary).

-- Al
--- linux-2.6.9-rc1.test/drivers/usb/gadget/serial.c    2004-09-04 14:59:17.360030472 
-0500
+++ linux-2.6.9-rc1.new/drivers/usb/gadget/serial.c     2004-09-04 14:54:36.850674376 
-0500
@@ -798,8 +798,6 @@ static int gs_open(struct tty_struct *tt
 
        gs_debug("gs_open: (%d,%p,%p)\n", port_num, tty, file);
 
-       tty->driver_data = NULL;
-
        if (port_num < 0 || port_num >= GS_NUM_PORTS) {
                printk(KERN_ERR "gs_open: (%d,%p,%p) invalid port number\n",
                        port_num, tty, file);
@@ -859,6 +857,8 @@ static int gs_open(struct tty_struct *tt
                goto exit_unlock_port;
        }
 
+       tty->driver_data = NULL;
+
        /* mark port as in use, we can drop port lock and sleep if necessary */
        port->port_in_use = 1;
 
@@ -1801,7 +1801,8 @@ static int gs_setup_standard(struct usb_
                /* PXA hardware partially handles SET_INTERFACE;
                 * we need to kluge around that interference.  */
                if (gadget_is_pxa(gadget)) {
-                       ret = gs_set_config(dev, GS_ACM_CONFIG_ID);
+                       ret = gs_set_config(dev, use_acm ?
+                               GS_ACM_CONFIG_ID : GS_BULK_CONFIG_ID);
                        goto set_interface_done;
                }
                if (dev->dev_config != GS_BULK_CONFIG_ID

Reply via email to