usb/164090: [umodem] [patch] Add sysctl with ucom unit number
Hans Petter Selasky
hselasky at c2i.net
Fri Jan 13 20:56:21 UTC 2012
On Friday 13 January 2012 18:05:29 Mykhaylo Yehorov wrote:
> >Number: 164090
> >Category: usb
> >Synopsis: [umodem] [patch] Add sysctl with ucom unit number
> >Confidential: no
> >Severity: non-critical
> >Priority: low
> >Responsible: freebsd-usb
> >State: open
> >Quarter:
> >Keywords:
> >Date-Required:
> >Class: change-request
> >Submitter-Id: current-users
> >Arrival-Date: Fri Jan 13 17:10:08 UTC 2012
> >Closed-Date:
> >Last-Modified:
> >Originator: Mykhaylo Yehorov
> >Release: FreeBSD 9.0-RELEASE
> >Organization:
>
> >Environment:
> FreeBSD atom.lan29.local 9.0-RELEASE FreeBSD 9.0-RELEASE #7: Fri Jan 13
> 15:18:21 EET 2012
> mika at atom.lan29.local:/usr/obj/usr/src/sys/MINI_KVA384 i386
>
> >Description:
> Now there is no easy way to determine which tty device file is used by an
> umodem device. With the following patch the umodem driver will create
> sysctl node dev.umodem.X.ucom. This sysctl will be helpful in devd
> scripts.
>
> >How-To-Repeat:
>
> >Fix:
> Patch attached with submission follows:
>
> --- orig/sys/dev/usb/serial/umodem.c 2011-11-11 06:20:22.000000000 +0200
> +++ sys/dev/usb/serial/umodem.c 2012-01-03 13:06:14.371630639 +0200
> @@ -169,6 +169,8 @@
> uint8_t sc_cm_over_data;
> uint8_t sc_cm_cap; /* CM capabilities */
> uint8_t sc_acm_cap; /* ACM capabilities */
> +
> + int ucom_unit;
> };
>
> static device_probe_t umodem_probe;
> @@ -412,6 +414,13 @@
> }
> ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev);
>
> + sc->ucom_unit = sc->sc_super_ucom.sc_unit;
> +
> + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
> + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
> + OID_AUTO, "ucom", CTLFLAG_RD,
> + &sc->ucom_unit, -1, "Attached ucom unit number");
> +
> return (0);
>
Hi,
Could you patch ucom_set_pnpinfo_usb() instead, so that such a sysctl is
created for all ucom devices, not only umodem?
Can you explain a bit more how you use this information in your scripts?
--HPS
More information about the freebsd-usb
mailing list