From owner-freebsd-mobile@FreeBSD.ORG Mon Jul 7 10:21:12 2003 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7E2DA37B404 for ; Mon, 7 Jul 2003 10:21:12 -0700 (PDT) Received: from smtp.mho.com (smtp.mho.net [64.58.4.6]) by mx1.FreeBSD.org (Postfix) with SMTP id C0B4443FAF for ; Mon, 7 Jul 2003 10:21:10 -0700 (PDT) (envelope-from scottl@freebsd.org) Received: (qmail 97239 invoked by uid 1002); 7 Jul 2003 17:21:07 -0000 Received: from adsl-64-58-12-196.mho.net (HELO freebsd.org) (64.58.12.196) by smtp.mho.net with SMTP; 7 Jul 2003 17:21:07 -0000 Message-ID: <3F09AC10.4010401@freebsd.org> Date: Mon, 07 Jul 2003 11:21:20 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bill Paul References: <20030707171405.854DF37B401@hub.freebsd.org> In-Reply-To: <20030707171405.854DF37B401@hub.freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: hackers@FreeBSD.ORG cc: mobile@FreeBSD.ORG cc: "M. Warner Losh" Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 17:21:12 -0000 Bill Paul wrote: >>In message: <20030707043655.71E6537B422@hub.freebsd.org> >> wpaul@freebsd.org (Bill Paul) writes: >>: When I got it home, I found that almost everything is supported in >>: FreeBSD 5.x, except for one thing: the serial port. The chip is a >>: MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. >> >>But Scott Long already committed his umct driver a few days ago... :-) >> >>Warner >> > > > Yes, so I have been told. :P > > And guess what. It has a bug. :) > > Well ok, to be fair, it doesn't really have a bug: it lacks a workaround > for a buggy chip. The driver determines the bulk output buffer size > by checking the data returned by the chip in its bulk out endpoint > descriptor. This is right in most cases, but not for the > USB_PRODUCT_MCT_SITECOM_USB232 device (which, unfortunately, is what > they put in the port replicator I bought). The value it returns for > wMaxPacketSize is 32, but in reality, you must use 16. If you don't, > the chip drops data under certain circumstances. A good example: attach > a modem to the serial adapter and set up a PPP link over it, then try > to ssh to a remote host somewhere. Ssh will get about halfway through > the connection attempt and then hang. I observed a similar problem > with my IRC client. > > It turns out the NetBSD driver that I hacked up worked because it has > a workaround for this chip bug. I applied a similar workaround to Scott's > driver and now PPP works again. Here's a patch: > > --- umct.c.orig Thu Jul 3 18:50:39 2003 > +++ umct.c Mon Jul 7 00:52:55 2003 > @@ -241,7 +241,10 @@ > > if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { > ucom->sc_bulkout_no = ed->bEndpointAddress; > - ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); > + if (uaa->product == USB_PRODUCT_MCT_SITECOM_USB232) > + ucom->sc_obufsize = 16; /* device is broken */ > + else > + ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); > continue; > } > > This is almost literally what NetBSD does. Barring any objections, I'd > like to check this in. (CC'ing Scott on this e-mail.) > Bill, Excellent, feel free to commit this. I remember seeing this workaround, but since I didn't have the device that it applied to I must have dropped the code by accident. Scott