From owner-freebsd-usb@FreeBSD.ORG Mon Aug 3 11:32:42 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B948106566C; Mon, 3 Aug 2009 11:32:42 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe16.swip.net [212.247.155.225]) by mx1.freebsd.org (Postfix) with ESMTP id 9603C8FC28; Mon, 3 Aug 2009 11:32:41 +0000 (UTC) (envelope-from hselasky@freebsd.org) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=HBWR-9esTTcA:10 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=qCKJFkpRw--tDn6iRjIA:9 a=FD07N6Ti4orsvJTKERswGufQigoA:4 a=X_tFQ-0zX6s4AOxvmxMA:9 a=PbKypl4hG2Rmr9PLRw8A:7 a=e8ZNVJFSvDFimfdULt__kE2arz4A:4 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe16.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 548145140; Mon, 03 Aug 2009 13:32:39 +0200 Received-SPF: softfail receiver=mailfe16.swip.net; client-ip=188.126.201.140; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: Marc Fonvieille Date: Mon, 3 Aug 2009 13:32:36 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: <20090728111131.GA1383@gothic.blackend.org> <200908031138.45877.hselasky@freebsd.org> <20090803110603.GB1230@gothic.blackend.org> In-Reply-To: <20090803110603.GB1230@gothic.blackend.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_WrsdKGLpa4ZIiyc" Message-Id: <200908031332.38041.hselasky@freebsd.org> Cc: freebsd-usb@freebsd.org Subject: Re: uvisor(4) and Palm Z22 under 8.X X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2009 11:32:42 -0000 --Boundary-00=_WrsdKGLpa4ZIiyc Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've tried to optimise the device upload path to 1.0 MByte/second. Download path is limited to wMaxPacketSize*1000 byte/second, due to the device not short terminating its data. Would require a special driver, maybe via libusb. Could you check upload and download speed? --HPS --Boundary-00=_WrsdKGLpa4ZIiyc Content-Type: text/x-patch; charset="iso-8859-1"; name="uvisor.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uvisor.c.diff" --- uvisor.c 2009-06-24 12:59:19.000000000 +0200 +++ uvisor.c 2009-08-03 13:30:18.000000000 +0200 @@ -95,7 +95,15 @@ #define UVISOR_CONFIG_INDEX 0 #define UVISOR_IFACE_INDEX 0 -#define UVISOR_BUFSIZE 1024 /* bytes */ + +/* + * The following buffer sizes are hardcoded due to the way the Palm + * firmware works. It looks like the device is not short terminating + * the data transferred. + */ +#define UVISORIBUFSIZE 0 /* Use wMaxPacketSize */ +#define UVISOROBUFSIZE 32 /* bytes */ +#define UVISOROFRAMES 32 /* units */ /* From the Linux driver */ /* @@ -208,7 +216,8 @@ .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = UVISOR_BUFSIZE, /* bytes */ + .bufsize = UVISOROBUFSIZE * UVISOROFRAMES, + .frames = UVISOROFRAMES, .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, .callback = &uvisor_write_callback, }, @@ -217,7 +226,7 @@ .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = UVISOR_BUFSIZE, /* bytes */ + .bufsize = UVISORIBUFSIZE, .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .callback = &uvisor_read_callback, }, @@ -375,7 +384,6 @@ struct uvisor_connection_info coninfo; struct uvisor_palm_connection_info pconinfo; uint16_t actlen; - uWord wAvail; uint8_t buffer[256]; if (sc->sc_flag & UVISOR_FLAG_VISOR) { @@ -496,6 +504,9 @@ goto done; } } +#if 0 + uWord wAvail; + DPRINTF("getting available bytes\n"); req.bmRequestType = UT_READ_VENDOR_ENDPOINT; req.bRequest = UVISOR_REQUEST_BYTES_AVAILABLE; @@ -507,6 +518,7 @@ goto done; } DPRINTF("avail=%d\n", UGETW(wAvail)); +#endif DPRINTF("done\n"); done: @@ -579,19 +591,31 @@ struct uvisor_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; uint32_t actlen; + uint8_t x; switch (USB_GET_STATE(xfer)) { case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - pc = usbd_xfer_get_frame(xfer, 0); - if (ucom_get_data(&sc->sc_ucom, pc, 0, - UVISOR_BUFSIZE, &actlen)) { + for (x = 0; x != UVISOROFRAMES; x++) { + + usbd_xfer_set_frame_offset(xfer, + x * UVISOROBUFSIZE, x); - usbd_xfer_set_frame_len(xfer, 0, actlen); + pc = usbd_xfer_get_frame(xfer, x); + if (ucom_get_data(&sc->sc_ucom, pc, 0, + UVISOROBUFSIZE, &actlen)) { + usbd_xfer_set_frame_len(xfer, x, actlen); + } else { + break; + } + } + /* check for data */ + if (x != 0) { + usbd_xfer_set_frames(xfer, x); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -599,7 +623,7 @@ usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } --Boundary-00=_WrsdKGLpa4ZIiyc--