summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraugustss <augustss@NetBSD.org>1998-07-23 13:48:59 +0000
committeraugustss <augustss@NetBSD.org>1998-07-23 13:48:59 +0000
commit02c8f266db23d640bb481de1ac21abc2037158bf (patch)
treebe277f2e5586eb22e93dfaa5674c25240d4a0e16
parentd6ef9cbb33658c71d98ce85bfc30adca4f70a8c0 (diff)
Make the /dev/ part of the device name optional.
-rw-r--r--usr.bin/usbhidctl/usbhid.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/usbhidctl/usbhid.c b/usr.bin/usbhidctl/usbhid.c
index 2579a4d431b..26519f20b25 100644
--- a/usr.bin/usbhidctl/usbhid.c
+++ b/usr.bin/usbhidctl/usbhid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbhid.c,v 1.3 1998/07/13 20:56:28 augustss Exp $ */
+/* $NetBSD: usbhid.c,v 1.4 1998/07/23 13:48:59 augustss Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <err.h>
+#include <ctype.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@@ -264,7 +265,7 @@ int
main(int argc, char **argv)
{
int f, r;
- char *dev = 0;
+ char devname[100], *dev = 0;
int ch;
extern char *optarg;
extern int optind;
@@ -308,6 +309,14 @@ main(int argc, char **argv)
names = argv;
nnames = argc;
+ if (dev[0] != '/') {
+ if (isdigit(dev[0]))
+ sprintf(devname, "/dev/uhid%s", dev);
+ else
+ sprintf(devname, "/dev/%s", dev);
+ dev = devname;
+ }
+
init_hid(table);
f = open(dev, O_RDWR);