tech-kern archive

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

Re: Tips on programming usb devices?



        hello Iain.  Thank you again for your assistance in getting this
Novatel modem working.  I now have a working driver which, when activated
through the modem interface, fires up the ethernet portion of the device
and seems to work quite well.  I'd like to commit this driver,aand probably
the scripts to activate it, to -current, but I have a few style questions
which I'd like to ask of you and of the NetBSD community in hopes of
getting some clarification on which approach might be best for getting a
good stable driver into the tree.
        For those of you who haven't been following the thread, I'm working on
a driver for the Novatel 551L USB modem.  I believe this device is based on
the Qualcomm Gobi 3,000 chip set and features a multi-interface USB device.
The first 4 interfaces present themselves as  general communications ports,
of which the first permits standard serial connections through which modem
Hayes style AT commands can be sent to control the modem's behavior.   The
other 3 ports are available and, I believe, work, but I don't know how to
use them.  The last 2 interfaces look like a cdce(4) ethernet device, which
once the modem is activated, responds to dhcp client requests  and allows IP
traffic to flow in and out through the device.
        The driver I have, which runs under NetBSD-5, is essentially a mash up
of the u3g(4) and cdce(4) drivers.  It attaches the first four interfaces
as serial ports using the ucom(4) driver and presents an ethernet interface
to the system for the last two interfaces.  The Linux folks have chosen to
extend their cdce kernel driver to allow it to attach serial ports on
selected devices.  Because I was learning how to do USB programming on this
project, I elected to implement a stand-alone driver.  The new driver,
which I'm calling ugobi(4), can support other devices of this nature, I'm
thinking of devices like the LG Vl600 or the Pantech 290.  I can think of
three ways to approach this issue, which is where I'd like feedback.  Here
are my thoughts:

1.  Keep the ugobi(4) driver as it is and commit it as a new USB driver,
complete with manual page and sample scripts showing how to activate the
modem through the At modem interface.  Then, as more folks encounter these
modems, they can easily add them to this driver.

2.  Extend the cdce(4) driver to look for flags in device specific entries
telling it to attach serial ports in addition to the ethernet interface.
this seems somehow unclean to me, though it was my original idea to do this
when I started this project.

3.  Extend the umodem(4) driver to attach the unclaimed interfaces of these
modems as serial ports.  This seems like the cleanest approach from a code
development perspective, but could cause a little confusion in practical
usage, as it could be more challenging to match up which serial ports go
with which ethernet interfaces.  (Approach 1 doesn't have this problem
because the name of the base driver shows up on the same line as all the
sub-devices when the thing probes, see below.)

4.  Another approach I haven't thought of?

Thoughts?

-thanks
-Brian

Here's the output from dmesg for the new device.

ugobi0 at uhub3 port 4
ugobi0: Novatel Wireless, Inc. Novatel Wireless 4G, rev 2.00/0.15, addr 2
ucom0 at ugobi0 portno 0: uGobi Serial Device
ucom1 at ugobi0 portno 1: uGobi Serial Device
ucom2 at ugobi0 portno 2: uGobi Serial Device
ucom3 at ugobi0 portno 3: uGobi Serial Device
ugobi0: faking address
ugobi0: address 2a:dc:14:00:00:00


Home | Main Index | Thread Index | Old Index