anyone working on setting output items with usbhidctl(1) ?
Rene Ladan
r.c.ladan at gmail.com
Mon Sep 18 03:55:08 PDT 2006
2006/9/18, Ed Schouten <ed at fxq.nl>:
> Hello Rene,
>
> * Rene Ladan <r.c.ladan at gmail.com> wrote:
> > is anyone working on setting output items with usbhidctl(1) ?
> >
> > 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).
> >
> > 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 <stdio.h>
> | #include <fcntl.h>
> |
> | int
> | main(int argc, char *argv[])
> | {
> | char buffer[3] = { 1, 3, 0 };
> | int fd;
> |
> | fd = open("/dev/ugen0.2", O_WRONLY);
> | if (fd < 0) {
> | fprintf(stderr, "Cannot open device\n");
> | return (-1);
> | }
> |
> | write(fd, buffer, sizeof buffer);
> | close(fd);
> |
> | 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.
>
I tried that too, it does not work on /dev/uhidX (my code opened the
device read/write instead of write-only).
I'll try to extend the HID descriptor to support the LED and rumblers.
> --
> Ed Schouten <ed at fxq.nl>
> WWW: http://g-rave.nl/
>
>
>
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
More information about the freebsd-hackers
mailing list