From owner-freebsd-usb@FreeBSD.ORG Tue May 13 16:50:59 2008 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 D499B106567B for ; Tue, 13 May 2008 16:50:59 +0000 (UTC) (envelope-from sclark@netwolves.com) Received: from elasmtp-curtail.atl.sa.earthlink.net (elasmtp-curtail.atl.sa.earthlink.net [209.86.89.64]) by mx1.freebsd.org (Postfix) with ESMTP id 6580E8FC2B for ; Tue, 13 May 2008 16:50:58 +0000 (UTC) (envelope-from sclark@netwolves.com) Received: from [205.201.149.100] (helo=[10.0.129.1]) by elasmtp-curtail.atl.sa.earthlink.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JvxiM-0003Tm-46; Tue, 13 May 2008 12:50:58 -0400 Message-ID: <4829C6EE.8040404@netwolves.com> Date: Tue, 13 May 2008 12:50:54 -0400 From: Steve Clark User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20080425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hans Petter Selasky References: <4828AA64.7060306@netwolves.com> <200805131755.54080.hselasky@c2i.net> In-Reply-To: <200805131755.54080.hselasky@c2i.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: a437fbc6971e80f61aa676d7e74259b7b3291a7d08dfec79d2ffa0bf629b0d2e8e669053e298e275350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 205.201.149.100 Cc: freebsd-usb@freebsd.org Subject: Re: In on control endpoint 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: Tue, 13 May 2008 16:51:00 -0000 Hans Petter Selasky wrote: > On Monday 12 May 2008, Steve Clark wrote: > >>Hello List, >> >>I have spent the afternoon going thru the usb code trying to figure out how >>to do a read on the control port (endpoint 80 ? ) instead of a write ( >>endpoint 0 ). I am still trying to emulate what the linux sierra.c usb >>serial driver does. >> >>Any pointers would be greatly appreciated. >> >>Thanks, >>Steve >>_______________________________________________ >>freebsd-usb@freebsd.org mailing list >>http://lists.freebsd.org/mailman/listinfo/freebsd-usb >>To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebsd.org" > > > Hi, > > All transactions on the control endpoint (0) consist of three parts: > > SETUP > DATA, if any > STATUS > > The two most common variants are: > > 1) SETUP > DATA OUT > STATUS IN > > 2) SETUP > DATA IN > STATUS OUT > > Rules: > > The MSB of the first byte in the SETUP decides wheter the data is OUT (0x00) > or IN (0x80). IN and OUT is relative to the USB Host. > > See: usbd_do_request and /sys/dev/usb/usb.h > > typedef struct { > uByte bmRequestType; > uByte bRequest; > uWord wValue; > uWord wIndex; > uWord wLength; > uByte bData[0]; > } __packed usb_device_request_t; > > #define UT_WRITE 0x00 > #define UT_READ 0x80 > #define UT_STANDARD 0x00 > #define UT_CLASS 0x20 > #define UT_VENDOR 0x40 > #define UT_DEVICE 0x00 > #define UT_INTERFACE 0x01 > #define UT_ENDPOINT 0x02 > #define UT_OTHER 0x03 > > --HPS > > Hi Hans, Thanks so much - I have just been reviewing the usb spec and had about determined as much. So I need to have UT_READ or'ed in with my bmRequestType as I understand it. Regards, Steve