diff --git a/usr.sbin/usbconfig/usbconfig.8 b/usr.sbin/usbconfig/usbconfig.8 index 6c14028d4bf5..57f118ad8d65 100644 --- a/usr.sbin/usbconfig/usbconfig.8 +++ b/usr.sbin/usbconfig/usbconfig.8 @@ -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]. +.Op Oo Fl d Oc Ar [ugen]. .Op cmds... .Sh DESCRIPTION The diff --git a/usr.sbin/usbconfig/usbconfig.c b/usr.sbin/usbconfig/usbconfig.c index 4c5bfb61c3ef..2fd45c500868 100644 --- a/usr.sbin/usbconfig/usbconfig.c +++ b/usr.sbin/usbconfig/usbconfig.c @@ -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; }