summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/ugold.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2014-12-11 18:39:27 +0000
committermpi <mpi@openbsd.org>2014-12-11 18:39:27 +0000
commite6a023832ba2ae1884cf6d10ff7a681a87a5b87f (patch)
tree323c27e58c07a5c844f1919c20c8cfb83cc997d5 /sys/dev/usb/ugold.c
parentWhen scanning backwards for the last dot in a filename, (diff)
downloadwireguard-openbsd-e6a023832ba2ae1884cf6d10ff7a681a87a5b87f.tar.xz
wireguard-openbsd-e6a023832ba2ae1884cf6d10ff7a681a87a5b87f.zip
Change uhidev(4) set/get report functions in various way.
Always pass the parent uhidev(4) descriptor corresponding to the single USB device with multiple reportIDs instead of a child. Make uhidev_get_report() aware of non NUL reportID by prepending a byte to the given buffer, just like uhidev_set_report{,async}() already do. Return the number of bytes written or read upon success and -1 otherwise. This allow callers to deal with short reads without having do mess with xfer error codes madness. Reviewed and tested by David Higgs.
Diffstat (limited to 'sys/dev/usb/ugold.c')
-rw-r--r--sys/dev/usb/ugold.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/usb/ugold.c b/sys/dev/usb/ugold.c
index 56d1d36cf92..21c55b0a428 100644
--- a/sys/dev/usb/ugold.c
+++ b/sys/dev/usb/ugold.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ugold.c,v 1.6 2014/04/29 12:53:33 mpi Exp $ */
+/* $OpenBSD: ugold.c,v 1.7 2014/12/11 18:39:27 mpi Exp $ */
/*
* Copyright (c) 2013 Takayoshi SASANO <sasano@openbsd.org>
@@ -260,6 +260,9 @@ ugold_refresh(void *arg)
int
ugold_issue_cmd(struct ugold_softc *sc, uint8_t *cmd, int len)
{
- return uhidev_set_report_async(&sc->sc_hdev, UHID_OUTPUT_REPORT,
- sc->sc_hdev.sc_report_id, cmd, len);
+ int actlen;
+
+ actlen = uhidev_set_report_async(sc->sc_hdev.sc_parent,
+ UHID_OUTPUT_REPORT, sc->sc_hdev.sc_report_id, cmd, len);
+ return (actlen != len);
}