Make it possible to pass the ugenX.Y to usbconfig(8) without using "-d",

eg "usbconfig ugen1.2 dump_all_desc".

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2018-04-17 19:39:47 +00:00
parent 9de8fcfddf
commit 912280b4b4
2 changed files with 25 additions and 2 deletions

View File

@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd December 30, 2017
.Dd April 17, 2018
.Dt USBCONFIG 8
.Os
.Sh NAME
@ -35,7 +35,7 @@
.Op Fl a Ar addr
.Op cmds...
.Nm
.Op Fl d Ar [ugen]<unit>.<addr>
.Op Oo Fl d Oc Ar [ugen]<unit>.<addr>
.Op cmds...
.Sh DESCRIPTION
The

View File

@ -820,6 +820,29 @@ main(int argc, char **argv)
opt->got_any++;
break;
default:
if (n == 1) {
ptr = argv[n];
if ((ptr[0] == 'u') &&
(ptr[1] == 'g') &&
(ptr[2] == 'e') &&
(ptr[3] == 'n'))
ptr += 4;
if ((sscanf(ptr, "%d.%d",
&unit, &addr) != 2) ||
(unit < 0) || (unit > 65535) ||
(addr < 0) || (addr > 65535)) {
usage();
break;
}
opt->bus = unit;
opt->addr = addr;
opt->got_bus = 1;
opt->got_addr = 1;
break;
}
usage();
break;
}