From owner-freebsd-usb@FreeBSD.ORG Mon Nov 23 16:30:11 2009 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 801881065670 for ; Mon, 23 Nov 2009 16:30:11 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.freebsd.org (Postfix) with ESMTP id DBD1D8FC08 for ; Mon, 23 Nov 2009 16:30:10 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=wi4sf3SumDsKocyKlhMA:9 a=ybdNRJvGGF3-J4Xq5J4A:7 a=KNBZ6aWmjzg5utrE_p3opsJ6g1YA:4 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.16) with ESMTPA id 1334494582; Mon, 23 Nov 2009 17:30:08 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Mon, 23 Nov 2009 17:31:44 +0100 User-Agent: KMail/1.11.4 (FreeBSD/9.0-CURRENT; KDE/4.2.4; i386; ; ) References: <4B099A50.9000006@gmail.com> In-Reply-To: <4B099A50.9000006@gmail.com> X-Face: (%:6u[ldzJ`0qjD7sCkfdMmD*RxpOwEEQ+KWt[{J#x6ow~JO:,zwp.(t; @Aq :4:&nFCgDb8[3oIeTb^'",;u{5{}C9>"PuY\)!=#\u9SSM-nz8+SR~B\!qBv MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200911231731.45953.hselasky@c2i.net> Cc: Subject: Re: usb ethernet driver question 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: Mon, 23 Nov 2009 16:30:11 -0000 On Sunday 22 November 2009 21:08:48 Alexander Samarin wrote: > Hello, all! > > I'm trying to write a kernel module driver for WiMAX modem. > I have Samsung SWC-U100 USB modem. > > Driver is based on if_cue module (it's source file is smallest in the > tree). I've get module successfully attaching to device and registering new > network interface, but some questions appeared: > > 1. madwimax project have a description of protocol of the modem, but it > says simply "This data should be sent over OUT endpoint in bulk mode." In > other drivers I found only calls to functionu ether_do_request() e.g: > > struct usb_device_request req; > > req.bmRequestType = UT_READ_VENDOR_DEVICE; > req.bRequest = CUE_CMD_GET_MACADDR; > USETW(req.wValue, 0); > USETW(req.wIndex, 0); > USETW(req.wLength, ETHER_ADDR_LEN); > > uether_do_request(&sc->sc_ue, &req, buf, 1000); > > Here I can't understand: > Buffer can be sent or received via buf argument of ether_do_request(), > but what value should be used for req.bRequest, req.wValue and req.wIndex > fields? Hi, The example you have given is for a CONTROL endpoint. CONTROL endpoint messages typically consist of 3 stages: BULK endpoints only transfer If the configuration data is sent accross a BULK endpoint, you need to allocate a separate BULK endpoint for that and consequently cannot use ether_do_request(). > > In dev/usb/net/if_* files drivers read and write to registers or memory > of chip; libusb just writes to file descriptor. > > Can anyone take me a link where I can read more about programming usb > drivers for kernel? man 4 usb > > 2. Is it possible to detach CAM subsystem from virtual DVD-ROM on other > interface? This DVD-ROM contains WinXP drivers and access program, > which will never be used (I think) on UNIX systems. Yes: 1) parent the CAM interface to your driver. Then umass won't attach to it 2) look in sys/dev/usb/usb_msctest.c > > PS: I know that if_cue is an ethernet driver, but WiMAX is a wireless so > basing driver on if_cue code is not a good idea, but wireless drivers are > big and my modem can connect only to one provider (Yota) so I decided to > use if_cue as base code. > > PS2: sorry for my English. Your English is good! --HPS