Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2008 17:55:53 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: In on control endpoint
Message-ID:  <200805131755.54080.hselasky@c2i.net>
In-Reply-To: <4828AA64.7060306@netwolves.com>
References:  <4828AA64.7060306@netwolves.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805131755.54080.hselasky>