Forgot to mention: MFC: 2 weeks
On 5 Nov 2010, at 20:12, Nick Hibma wrote: > Author: n_hibma > Date: Fri Nov 5 19:12:48 2010 > New Revision: 214843 > URL: http://svn.freebsd.org/changeset/base/214843 > > Log: > Implement ucom_set_pnpinfo_usb() providing ttyname and port number > information through devd. My E220 now produces the notification (1 line): > > +u3g0 at bus=1 hubaddr=1 port=0 devaddr=2 interface=0 \ > vendor=0x12d1 product=0x1003 devclass=0x00 devsubclass=0x00 \ > sernum="" release=0x0000 intclass=0xff intsubclass=0xff \ > ttyname=U0 ttyports=2 on uhub0 > > Note: serial/ufoma and net/uhso still provide port number and tty name > (uhso only) information through sysctls, which should now be removed. > > Reviewed by: hpselasky > > Modified: > head/sys/dev/usb/net/uhso.c > head/sys/dev/usb/serial/u3g.c > head/sys/dev/usb/serial/uark.c > head/sys/dev/usb/serial/ubsa.c > head/sys/dev/usb/serial/ubser.c > head/sys/dev/usb/serial/uchcom.c > head/sys/dev/usb/serial/ucycom.c > head/sys/dev/usb/serial/ufoma.c > head/sys/dev/usb/serial/uftdi.c > head/sys/dev/usb/serial/ugensa.c > head/sys/dev/usb/serial/uipaq.c > head/sys/dev/usb/serial/umct.c > head/sys/dev/usb/serial/umodem.c > head/sys/dev/usb/serial/umoscom.c > head/sys/dev/usb/serial/uplcom.c > head/sys/dev/usb/serial/usb_serial.c > head/sys/dev/usb/serial/usb_serial.h > head/sys/dev/usb/serial/uslcom.c > head/sys/dev/usb/serial/uvisor.c > head/sys/dev/usb/serial/uvscom.c > > Modified: head/sys/dev/usb/net/uhso.c > ============================================================================== > --- head/sys/dev/usb/net/uhso.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/net/uhso.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -902,6 +902,7 @@ uhso_probe_iface(struct uhso_softc *sc, > device_printf(sc->sc_dev, "ucom_attach > failed\n"); > return (ENXIO); > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, sc->sc_dev); > > mtx_lock(&sc->sc_mtx); > usbd_transfer_start(sc->sc_xfer[UHSO_MUX_ENDPT_INTR]); > @@ -920,6 +921,7 @@ uhso_probe_iface(struct uhso_softc *sc, > device_printf(sc->sc_dev, "ucom_attach failed\n"); > return (ENXIO); > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, sc->sc_dev); > } > else { > UHSO_DPRINTF(0, "Unknown type %x\n", type); > > Modified: head/sys/dev/usb/serial/u3g.c > ============================================================================== > --- head/sys/dev/usb/serial/u3g.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/u3g.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -818,8 +818,10 @@ u3g_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > device_printf(dev, "Found %u port%s.\n", sc->sc_numports, > sc->sc_numports > 1 ? "s":""); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/uark.c > ============================================================================== > --- head/sys/dev/usb/serial/uark.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uark.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -227,6 +227,8 @@ uark_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ > > detach: > > Modified: head/sys/dev/usb/serial/ubsa.c > ============================================================================== > --- head/sys/dev/usb/serial/ubsa.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/ubsa.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -331,6 +331,8 @@ ubsa_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/ubser.c > ============================================================================== > --- head/sys/dev/usb/serial/ubser.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/ubser.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -296,6 +296,7 @@ ubser_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > > mtx_lock(&sc->sc_mtx); > usbd_xfer_set_stall(sc->sc_xfer[UBSER_BULK_DT_WR]); > > Modified: head/sys/dev/usb/serial/uchcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uchcom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uchcom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -354,6 +354,8 @@ uchcom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/ucycom.c > ============================================================================== > --- head/sys/dev/usb/serial/ucycom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/ucycom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -272,13 +272,15 @@ ucycom_attach(device_t dev) > } > error = ucom_attach(&sc->sc_super_ucom, &sc->sc_ucom, 1, sc, > &ucycom_callback, &sc->sc_mtx); > - > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > if (urd_ptr) { > free(urd_ptr, M_USBDEV); > } > + > return (0); /* success */ > > detach: > > Modified: head/sys/dev/usb/serial/ufoma.c > ============================================================================== > --- head/sys/dev/usb/serial/ufoma.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/ufoma.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -450,6 +450,8 @@ ufoma_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > /*Sysctls*/ > sctx = device_get_sysctl_ctx(dev); > soid = device_get_sysctl_tree(dev); > > Modified: head/sys/dev/usb/serial/uftdi.c > ============================================================================== > --- head/sys/dev/usb/serial/uftdi.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uftdi.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -332,6 +332,8 @@ uftdi_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ > > detach: > > Modified: head/sys/dev/usb/serial/ugensa.c > ============================================================================== > --- head/sys/dev/usb/serial/ugensa.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/ugensa.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -247,6 +247,8 @@ ugensa_attach(device_t dev) > DPRINTF("attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ > > detach: > > Modified: head/sys/dev/usb/serial/uipaq.c > ============================================================================== > --- head/sys/dev/usb/serial/uipaq.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uipaq.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -1161,6 +1161,8 @@ uipaq_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/umct.c > ============================================================================== > --- head/sys/dev/usb/serial/umct.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/umct.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -297,6 +297,8 @@ umct_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); /* success */ > > detach: > > Modified: head/sys/dev/usb/serial/umodem.c > ============================================================================== > --- head/sys/dev/usb/serial/umodem.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/umodem.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -389,6 +389,8 @@ umodem_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/umoscom.c > ============================================================================== > --- head/sys/dev/usb/serial/umoscom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/umoscom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -338,6 +338,8 @@ umoscom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/uplcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uplcom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uplcom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -445,6 +445,8 @@ uplcom_attach(device_t dev) > device_printf(dev, "init failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/usb_serial.c > ============================================================================== > --- head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/usb_serial.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -185,6 +185,8 @@ static uint8_t ucom_bitmap[(UCOM_UNIT_MA > static struct mtx ucom_bitmap_mtx; > MTX_SYSINIT(ucom_bitmap_mtx, &ucom_bitmap_mtx, "ucom bitmap", MTX_DEF); > > +#define UCOM_TTY_PREFIX "U" > + > /* > * Mark a unit number (the X in cuaUX) as in use. > * > @@ -320,11 +322,12 @@ ucom_attach_tty(struct ucom_super_softc > /* Use default TTY name */ > if (ssc->sc_subunits > 1) { > /* multiple modems in one */ > - snprintf(buf, sizeof(buf), "U%u.%u", > + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX "%u.%u", > ssc->sc_unit, sc->sc_subunit); > } else { > /* single modem */ > - snprintf(buf, sizeof(buf), "U%u", ssc->sc_unit); > + snprintf(buf, sizeof(buf), UCOM_TTY_PREFIX "%u", > + ssc->sc_unit); > } > } > tty_makedev(tp, NULL, "%s", buf); > @@ -409,6 +412,24 @@ ucom_detach_tty(struct ucom_softc *sc) > cv_destroy(&sc->sc_cv); > } > > +void > +ucom_set_pnpinfo_usb(struct ucom_super_softc *ssc, device_t dev) > +{ > + char buf[64]; > + uint8_t iface_index; > + struct usb_attach_arg *uaa; > + > + snprintf(buf, sizeof(buf), "ttyname=%s%d ttyports=%d", > + UCOM_TTY_PREFIX, ssc->sc_unit, ssc->sc_subunits); > + > + /* Store the PNP info in the first interface for the dev */ > + uaa = device_get_ivars(dev); > + iface_index = uaa->info.bIfaceIndex; > + > + if (usbd_set_pnpinfo(uaa->device, iface_index, buf) != 0) > + device_printf(dev, "Could not set PNP info\n"); > +} > + > static void > ucom_queue_command(struct ucom_softc *sc, > usb_proc_callback_t *fn, struct termios *pt, > > Modified: head/sys/dev/usb/serial/usb_serial.h > ============================================================================== > --- head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/usb_serial.h Fri Nov 5 19:12:48 2010 > (r214843) > @@ -193,6 +193,7 @@ int ucom_attach(struct ucom_super_softc > struct ucom_softc *, uint32_t, void *, > const struct ucom_callback *callback, struct mtx *); > void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); > +void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); > void ucom_status_change(struct ucom_softc *); > uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, > uint32_t, uint32_t, uint32_t *); > > Modified: head/sys/dev/usb/serial/uslcom.c > ============================================================================== > --- head/sys/dev/usb/serial/uslcom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uslcom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -324,6 +324,8 @@ uslcom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/uvisor.c > ============================================================================== > --- head/sys/dev/usb/serial/uvisor.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uvisor.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -347,6 +347,8 @@ uvisor_attach(device_t dev) > DPRINTF("ucom_attach failed\n"); > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > return (0); > > detach: > > Modified: head/sys/dev/usb/serial/uvscom.c > ============================================================================== > --- head/sys/dev/usb/serial/uvscom.c Fri Nov 5 18:24:50 2010 > (r214842) > +++ head/sys/dev/usb/serial/uvscom.c Fri Nov 5 19:12:48 2010 > (r214843) > @@ -321,6 +321,8 @@ uvscom_attach(device_t dev) > if (error) { > goto detach; > } > + ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev); > + > /* start interrupt pipe */ > mtx_lock(&sc->sc_mtx); > usbd_transfer_start(sc->sc_xfer[UVSCOM_INTR_DT_RD]); > _______________________________________________ > svn-src-...@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org" _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"