summaryrefslogtreecommitdiffstats
path: root/lib/libusbhid/usage.c
diff options
context:
space:
mode:
authornate <nate@openbsd.org>2002-05-10 00:09:17 +0000
committernate <nate@openbsd.org>2002-05-10 00:09:17 +0000
commit7517eab27d5826c1a463a3cd45d021e17e9bb423 (patch)
treec8ffa8a4d8a2766dab08a2b30c66addee732307f /lib/libusbhid/usage.c
parentprototype open_socket() (diff)
downloadwireguard-openbsd-7517eab27d5826c1a463a3cd45d021e17e9bb423.tar.xz
wireguard-openbsd-7517eab27d5826c1a463a3cd45d021e17e9bb423.zip
Update usb userland stuff to reflect hid changes in the kernel.
This adds the new program usbhidaction which can be used to assign actions to events that occur on a uhid device. For example, you can now make the volume buttons on some newer keyboards actually do something.
Diffstat (limited to 'lib/libusbhid/usage.c')
-rw-r--r--lib/libusbhid/usage.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c
index fb36769d243..e5122c1745e 100644
--- a/lib/libusbhid/usage.c
+++ b/lib/libusbhid/usage.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: usage.c,v 1.1 2001/12/30 07:04:38 pvalchev Exp $ */
-/* $NetBSD: usage.c,v 1.11 2001/01/09 15:59:47 augustss Exp $ */
+/* $OpenBSD: usage.c,v 1.2 2002/05/10 00:09:17 nate Exp $ */
+/* $NetBSD: usage.c,v 1.1 2001/12/28 17:45:27 augustss Exp $ */
/*
* Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
@@ -163,7 +163,7 @@ hid_usage_page(int i)
for (k = 0; k < npages; k++)
if (pages[k].usage == i)
return pages[k].name;
- snprintf(b, sizeof b, "0x%04x", i);
+ sprintf(b, "0x%04x", i);
return b;
}
@@ -183,7 +183,7 @@ hid_usage_in_page(unsigned int u)
for (j = 0; j < pages[k].pagesize; j++) {
us = pages[k].page_contents[j].usage;
if (us == -1) {
- snprintf(b, sizeof b, "%s %d",
+ snprintf(b, sizeof b, "%s %d",
pages[k].page_contents[j].name, i);
return b;
}
@@ -191,7 +191,7 @@ hid_usage_in_page(unsigned int u)
return pages[k].page_contents[j].name;
}
bad:
- snprintf(b, sizeof b, "0x%04x", i);
+ sprintf(b, "0x%04x", i);
return b;
}
@@ -213,10 +213,11 @@ hid_parse_usage_page(const char *name)
int
hid_parse_usage_in_page(const char *name)
{
- const char *sep = strchr(name, ':');
+ const char *sep;
int k, j;
unsigned int l;
+ sep = strchr(name, ':');
if (sep == NULL)
return -1;
l = sep - name;