From owner-freebsd-usb@FreeBSD.ORG Wed May 14 15:07:37 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 1FE0A1065671 for ; Wed, 14 May 2008 15:07:37 +0000 (UTC) (envelope-from sclark@netwolves.com) Received: from elasmtp-kukur.atl.sa.earthlink.net (elasmtp-kukur.atl.sa.earthlink.net [209.86.89.65]) by mx1.freebsd.org (Postfix) with ESMTP id D64DF8FC15 for ; Wed, 14 May 2008 15:07:36 +0000 (UTC) (envelope-from sclark@netwolves.com) Received: from [205.201.149.100] (helo=[10.0.129.1]) by elasmtp-kukur.atl.sa.earthlink.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JwIZs-0002FN-0a; Wed, 14 May 2008 11:07:36 -0400 Message-ID: <482B0036.5060106@netwolves.com> Date: Wed, 14 May 2008 11:07:34 -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: a437fbc6971e80f61aa676d7e74259b7b3291a7d08dfec79f362f154a1caa277ed6a0712b19d9ec9350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c 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: Wed, 14 May 2008 15:07:37 -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, 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