From owner-freebsd-usb@FreeBSD.ORG Fri Jan 13 20:56:21 2012 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02EFF106566C for ; Fri, 13 Jan 2012 20:56:21 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 56FBB8FC0A for ; Fri, 13 Jan 2012 20:56:19 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 228659150; Fri, 13 Jan 2012 21:56:16 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Fri, 13 Jan 2012 21:54:01 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201201131705.q0DH5Tko030020@red.freebsd.org> In-Reply-To: <201201131705.q0DH5Tko030020@red.freebsd.org> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201201132154.01815.hselasky@c2i.net> Cc: freebsd-gnats-submit@freebsd.org Subject: Re: usb/164090: [umodem] [patch] Add sysctl with ucom unit number X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jan 2012 20:56:21 -0000 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@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