In on control endpoint

Steve Clark sclark at
Wed May 14 15:07:37 UTC 2008

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.
>>freebsd-usb at mailing list
>>To unsubscribe, send any mail to "freebsd-usb-unsubscribe at"
> Hi,
> All transactions on the control endpoint (0) consist of three parts:
> DATA, if any
> The two most common variants are:
> 1) SETUP
> 2) SETUP
> 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,

I have decided to try your new usb stack. I am running on FreeBSD 6.1. The device I am trying to get
working is a sierra wireless usb 597 EVDO modem. It is also has a slot for a micro-sd memory card, plus
when it is first powered up it doesn't look like a modem it looks like a different device that has both the 
umass device plus a cdrom device that has windows software drivers on it. In this mode it has a VID of 0x1199 and
a PID of 0xfff, after a message on the control pipe it changes its identity to VID = 0x1199, PID=0x0023.

What I had done previously with the original 6.1 usba.c was in the match code look for the 1199:fff and then
in the attach code send a message on the control pipe to set it in modem mode like the code below:
        ubsa_cfg_request( sc, 0x0b, 1);
        ucom->sc_dying = 1;
                goto error;

I tried to do something similar in the usba.c that is part of your new code as follows:
        ubsa_cfg_request( sc, 0x0b, 1);
                goto detach;

but I immediately get a panic:
Fatal trap 12 page fault in kernel mode
Stopped at usbd_config_td_is_gone
bt gives:

Which looks like it doesn't like the device disappearing when it switched modes.
 Any ideas how this should be handled? Or where I should be trying to switch the
device into modem mode?


More information about the freebsd-usb mailing list