tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Fwd: usb driver programming



(Sorry for HTML in prev post)


Good day everybody!

I am trying to write driver for my wimax usb dongle (samsung swc-200).
I am using if-atu driver for reference.
But it seems that I have some misunderstanding with usb.
What I have already done is that on insertion of the device my driver
probes for it and makes an attach:

output from dmesg:
-->wimax_match
passed vid = 4e8, pid = 6761
Device match!
wimax0 at uhub0 port 1-->wimax_attach

wimax0: SAMSUNG ELECTRONICS Co.Ltd. Samsung USB mWiMAX Modem, rev
2.00/0.01, addr 2
I know that I communicate the device through interface #0 and
endpoints 0x83(in) and 0x04(out).
Bulk mode is used for data transfer.

The code from if-atu has:
usbd_status
 atu_usb_request(struct wimax_softc *sc, u_int8_t type,
u_int8_t request, u_int16_t value, u_int16_t index, u_int16_t length,
u_int8_t *data)
{

usbd_xfer_handle xfer;

req.bmRequestType = type;
req.bRequest = request;
USETW(req.wValue, value);
USETW(req.wIndex, index);
USETW(req.wLength, length);

....
s = splnet();

xfer = usbd_alloc_xfer(sc->wimax_udev);
usbd_setup_default_xfer(xfer, sc->wimax_udev, 0, 500000, &req, data,
length, USBD_SHORT_XFER_OK, 0);

err = usbd_sync_transfer(xfer);

usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
....
if_atu uses
request = 0x0e,
value = 0x0000,
index = 0x0000
for sending commands.

What I don't understand is where can I specify the endpoint for the
communication?
What does value, index, length fields of usb_device_request structure mean?
My source code is attached. (file extension should be named "tgz")

Thank you.

Attachment: wimax.tg
Description: Binary data



Home | Main Index | Thread Index | Old Index