u3g serial device name query

M. Warner Losh imp at bsdimp.com
Thu Apr 30 14:46:22 UTC 2009


In message: <200904301412.38313.freebsd-usb at dino.sk>
            Milan Obuch <freebsd-usb at dino.sk> writes:
: On Thursday 30 April 2009 12:58:36 Hans Petter Selasky wrote:
: > On Thursday 30 April 2009, Milan Obuch wrote:
: > > Hi,
: > >
: > > I have HUAWEI 3g usb modem. It works with u3g from current. There is
: > > however one thing I did not get working yet.
: > >
: > > When device attaches, it is added into tree as u3gN, devd event is sent.
: > > It is easily matched with 'device-name "u3g[0-9]"' clause in devd.conf. I
: > > can start ppp automatically and it works well, given no other USB serial
: > > device is present.
: > >
: > > If another USB serial device such as uplcom is present, u3g serial ports
: > > does not have the same name. I found no way to relate serial device name
: > > to this event and looking in source I see no place where it is created. I
: > > would like to put a devctl notify call there. This way I could start ppp
: > > with correct device name even if there is some other USB serial device.
: > >
: > > Could someone point me in the right direction?
: >
: > USB serial devices have their own unit management. There is however a way
: > to override the unit number through the "usb2_com_tty_name" callback, which
: > requires some code changes to the u3g driver.
: >
: > All USB modems and serial adapters end up with the same naming
: > prefix: /dev/cuaU%d.%d, so the assigned numbers must be serialised.
: >
: > What we could do is to have a separate naming prefix for 3G modems, and use
: > the device_get_unit() for unit number.
: >
: > See: src/sys/dev/usb/serial and usb_serial.c
: >
: 
: I looked over usb2_com_attach_tty function in usb_serial.c, and somewhere 
: after call to tty_makedev (where a DPRINT is too) I could put a devctl call.
: 
: All I need for it would be device name. In /var/log/message file I see a line 
: telling 'u3g0 : Found 2 ports' just after usb2_com_attach_tty function is 
: called. If you could tell me how I can get 'u3g0' name via sc argument in 
: usb2_com_attach_tty function, I can solve this with no other change.

While I have issues with the names of the new ttys, since they are
gratuitously different than the past, it isn't the fundamental
problem.

What we really need in devd is the ability to tie events to /dev
entries appearing rather than at device attach time, since the two can
be different...

What you really need to do is to take the u3g0 attach, find out what
its children are and use that to figure out things...

Warner


More information about the freebsd-usb mailing list