usb ethernet driver question
Hans Petter Selasky
hselasky at c2i.net
Mon Nov 23 16:30:11 UTC 2009
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: <SETUP> <DATA> <STATUS>
BULK endpoints only transfer <DATA>
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
More information about the freebsd-usb
mailing list