>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@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);
 
 detach:


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to