Re: [PATCH 1/2] HID: wiimote: Initialize the controller LEDs with a device ID value

From: David Korth
Date: Thu Jun 25 2020 - 23:57:10 EST


On Thursday, June 25, 2020 3:09:46 AM EDT David Rheinsberg wrote:
> Hi
>
> On Thu, 25 Jun 2020 at 00:09, David Korth <gerbilsoft@xxxxxxxxxxxxxx> wrote:
> > I've been manually setting the player IDs on Wii controllers when running
> > multiplayer games by writing to the /sys/class/leds/ directory. Having the
> > hid-wiimote driver do this itself significantly reduces setup time.
>
> What do you mean with "reduces setup time significantly"? Why would it
> take that long to set the LEDs?
>
> Thanks
> David

The LED setup in this case is done entirely manually by me writing to the
individual files in /sys/class/leds/. This has to be done when the controllers
are connected initially, and if a controller has to be reconnected for some
reason (e.g. it runs out of batteries). I don't know of any userspace tools
that would make this easier to automate, except maybe a shell script, and I'd
probably still need to run it manually.

Both the Sixaxis and Xpad drivers appear to implement something similar, so
perhaps a higher-level "player number" mechanism that works with all
controllers would be worth looking into. This could in theory be done with a
userspace daemon too (or a udev hook).

As it is right now, I still think implementing it in the wiimote driver is the
best method to keep it consistent with the rest of the drivers without having
to install additional userspace tools.

Thanks