From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 18 09:58:16 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8BDC716A415; Mon, 18 Sep 2006 09:58:16 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (palm.hoeg.nl [83.98.131.212]) by mx1.FreeBSD.org (Postfix) with ESMTP id 512D043D6E; Mon, 18 Sep 2006 09:58:15 +0000 (GMT) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 86A231CC0E; Mon, 18 Sep 2006 11:58:13 +0200 (CEST) Date: Mon, 18 Sep 2006 11:58:13 +0200 From: Ed Schouten To: Rene Ladan Message-ID: <20060918095813.GM22564@hoeg.nl> References: <450DA217.9080602@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gBMNUjqROSlRgKnE" Content-Disposition: inline In-Reply-To: <450DA217.9080602@gmail.com> User-Agent: Mutt/1.5.12-2006-07-14 X-Mailman-Approved-At: Mon, 18 Sep 2006 11:27:41 +0000 Cc: FreeBSD Hackers , freebsd-usb@freebsd.org Subject: Re: anyone working on setting output items with usbhidctl(1) ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2006 09:58:16 -0000 --gBMNUjqROSlRgKnE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Rene, * Rene Ladan wrote: > is anyone working on setting output items with usbhidctl(1) ? >=20 > I'm trying to add LED/rumbler support for the Xbox 360 Gamepad to > uhid(4), but there doesn't seem to be a userland tool to test output > items and the output report descriptor doesn't seem to be publicly > available (i.e. I must reverse-engineer it). >=20 > This device has 4 LEDs which can be controlled with the command 01 03 > xx, where xx ranges from 0 to 255. > It also has two rumble motors which can be controlled with 00 08 00 bb > ll 00 00 00, where bb and ll both range from 0 to 255. Try the following C code: | #include | #include |=20 | int | main(int argc, char *argv[]) | { | char buffer[3] =3D { 1, 3, 0 }; | int fd; |=20 | fd =3D open("/dev/ugen0.2", O_WRONLY); | if (fd < 0) { | fprintf(stderr, "Cannot open device\n"); | return (-1); | } |=20 | write(fd, buffer, sizeof buffer); | close(fd); |=20 | return (0); | } I'm currently toying around with the headset, so I've disabled the uhid(4) driver, so the LED on the gamepad keeps blinking. Running the application above turns off the LED. I guess it should also work when you write it to /dev/uhidX. --=20 Ed Schouten WWW: http://g-rave.nl/ --gBMNUjqROSlRgKnE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFDm2152SDGA2eCwURAkhXAJ9VJXQi9U49PcVy+aL4EcEQP0sO4wCfUj2g UL36uJcKFGDEJsKdAYghmG8= =WbYv -----END PGP SIGNATURE----- --gBMNUjqROSlRgKnE--