In on control endpoint

Hans Petter Selasky hselasky at c2i.net
Tue May 13 15:54:30 UTC 2008


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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> To unsubscribe, send any mail to "freebsd-usb-unsubscribe at 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


More information about the freebsd-usb mailing list