Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 01 Oct 2006 23:23:15 +0200
From:      Rene Ladan <r.c.ladan@gmail.com>
To:        usb@freebsd.org
Subject:   rfc: import usbhidctl(1) from OpenBSD
Message-ID:  <452031C3.3090805@gmail.com>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020309000006060001080400
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi,

I was thinking about the idea of sending a PR to replace our
usbhidctl(1) with that of OpenBSD/NetBSD.

It has the following advantages:
* the -w option hopefully works, the implementation of PR usb/103418
seems to be buggy
* the command 'usbhidctl -f DEV item' to display the value of a single
item actually works (our implementation returns nothing)
* in sync with OpenBSD and NetBSD
* my own PR usb/103418 and docs/103420 can be trashed.

I've sucessfully tested OpenBSD's usbhidctl(1)
(http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/usbhidctl/usbhid.c,
revision 1.7) with an Xbox 360 controller (the output report descriptor
is under development).
It compiles fine after applying the attached patch using `cc usbhid.c -o
OUTFILE -lusbhid`.

Regards,
Rene
-- 
GPG fingerprint = E738 5471 D185 7013 0EE0  4FC8 3C1D 6F83 12E1 84F6
(subkeys.pgp.net)

"It won't fit on the line."
		-- me, 2001


--------------020309000006060001080400
Content-Type: text/x-patch;
 name="openbsd-usbhid.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="openbsd-usbhid.c.diff"

--- openbsd-usbhid.c.orig	Sun Oct  1 23:06:23 2006
+++ openbsd-usbhid.c	Sun Oct  1 22:57:55 2006
@@ -46,6 +46,7 @@
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <sys/ioctl.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -932,8 +933,7 @@
 		/* NOTREACHED */
 	}
 
-	if (hid_start(table) == -1)
-		errx(1, "hid_init");
+	hid_init(table);
 
 	if (dev[0] != '/') {
 		snprintf(devnamebuf, sizeof(devnamebuf), "/dev/%s%s",

--------------020309000006060001080400--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?452031C3.3090805>