List Info

Thread: Re: In on control endpoint




Re: In on control endpoint
country flaguser name
United States
2008-05-14 10:07:34
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-usbfreebsd.org mailing list
>>http://lists.freebsd.org/mailman/listinfo/freebsd-usb
>>To unsubscribe, send any mail to
"freebsd-usb-unsubscribefreebsd.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,

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:
ucom_cfg_is_gone
ubsa_cfg_request
ubsa_attach
...

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?

Thanks,
Steve
_______________________________________________
freebsd-usbfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to
"freebsd-usb-unsubscribefreebsd.org"

Re: In on control endpoint
country flaguser name
Norway
2008-05-14 10:39:47
Hi Steve,

Can you send me a diff between the original file and the new
one so that I can 
see where you inserted that code ? I suppose you inserted it
at the wrong 
location.

--HPS

On Wednesday 14 May 2008, Steve Clark wrote:
> 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-usbfreebsd.org mailing list
> >>http://lists.freebsd.org/mailman/listinfo/freebsd-usb
> >>To unsubscribe, send any mail to
"freebsd-usb-unsubscribefreebsd.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,
>
> 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:
> ucom_cfg_is_gone
> ubsa_cfg_request
> ubsa_attach
> ...
>
> 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?
>
> Thanks,
> Steve


_______________________________________________
freebsd-usbfreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to
"freebsd-usb-unsubscribefreebsd.org"

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )