From owner-freebsd-usb@FreeBSD.ORG Fri Feb 8 21:48:03 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ADF7B5D7 for ; Fri, 8 Feb 2013 21:48:03 +0000 (UTC) (envelope-from aman.sawrup@bluecoat.com) Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mx1.freebsd.org (Postfix) with ESMTP id 962F02BD for ; Fri, 8 Feb 2013 21:48:03 +0000 (UTC) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1U3vne-0006R6-V5 for freebsd-usb@freebsd.org; Fri, 08 Feb 2013 13:48:02 -0800 Date: Fri, 8 Feb 2013 13:48:02 -0800 (PST) From: "aman.sawrup" To: freebsd-usb@freebsd.org Message-ID: <1360360082956-5785167.post@n5.nabble.com> Subject: Reading 1024 bytes from mass storage device using 3 frames gives USB_ERR_STALLED MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2013 21:48:03 -0000 Hello, We have ported the FreeBSD USB stack to my employers proprietary RTOS. The code was taken from the MAIN branch a little while after RELENG_8_BP tag was created. I'm trying to read data from the following mass storage device umass0: ehci0: [FILTER+ITHREAD] usbus0: EHCI version 1.0 usbus0: 480Mbps High Speed USB v2.0 ugen0.1: at usbus0 uhub0: on usbus0 uhub0: 2 ports with 2 removable, self powered ugen0.2: at usbus0 uhub1: on usbus0 uhub1: 8 ports with 8 removable, self powered ugen0.3: at usbus0 umass0: on usbus0 umass0: SCSI over Bulk-Only; quirks = 0x4800 Reading data one frame per transfer works. For example, if I want to read 512 bytes that is physically contiguous and is placed in a single frame, that works fine. However, when attempting to read 1024 bytes, that is not physically contiguous, using 3 frames for the same transfer, I get USB_ERR_STALLED. I have the frames setup as follows: frame[0] = 200 bytes frame[1] = 512 bytes frame[2] = 312 bytes Here's what my code looks like to do this: usb_frcount_t frindex = 0; for ( Storage::Byte_device::Scatter_gather *sg_entry = scb->SC_SG_List->In_progress_SGs(); sg_entry; sg_entry=sg_entry->SG_Link ) { usbd_xfer_set_frame_data( xfer, frindex++, reinterpret_cast(sg_entry->SG_Virtual_address), sg_entry->SG_Length ); } usbd_xfer_set_frames(xfer, frindex); usbd_transfer_submit(xfer); Note, in usbd_transfer_setup, I have set the maximum number of frames to 128 for this transfer (UMASS_T_BBB_DATA_READ). Question: Is it possible to transfer 1024 bytes using the method described above? Thanks Aman -- View this message in context: http://freebsd.1045724.n5.nabble.com/Reading-1024-bytes-from-mass-storage-device-using-3-frames-gives-USB-ERR-STALLED-tp5785167.html Sent from the freebsd-usb mailing list archive at Nabble.com.