Re: [PATCH 1/2] HID: wiimote: Initialize the controller LEDs with a device ID value
From: David Korth
Date: Wed Jun 24 2020 - 18:09:40 EST
On Wednesday, June 24, 2020 6:04:55 AM EDT David Rheinsberg wrote:
> Hi
>
> On Tue, Jun 23, 2020 at 12:57 AM David Korth <gerbilsoft@xxxxxxxxxxxxxx>
wrote:
> > Based on a similar commit for Sony Sixaxis and DualShock 4 controllers:
> > HID: sony: Initialize the controller LEDs with a device ID value
> >
> > Wii remotes have the same player LED layout as Sixaxis controllers,
> > so the wiimote setup is based on the Sixaxis code.
>
> Please include a description of the patch in the commit-message. It
> took me quite a while to understand what the intention of this patch
> is.
Will do.
> So what you are trying is to allocate a unique ID to each connected
> wiimote, so they automatically display unique IDs, right?
>
> Can you explain why this has to be done in the kernel driver? Why
> isn't user-space assigning the right ID? User-space needs to attach
> controllers to their respective engine anyway, in which case the IDs
> the kernel assigns would be wrong, right? How does user-space display
> the matching ID in their UI (e.g., for configuration use-cases)? The
> way you set them does not allow user-space to query the ID, does it?
> Lastly, wouldn't a device-reconnect want the same ID to be assigned
> again? With the logic you apply, user-space would have to override
> every ID for that to work.
>
> Is there an actual use-case for this? Or is this just to align the
> driver with the other gamepads?
Most userspace programs aren't aware of controller LEDs. The only one I know
of that is, Steam, has its own input layer and bypasses the HID drivers
entirely.
As far as I know, there's no simple "set player ID" API that could be used to
set a device-independent player number, so every program would need to support
each type of controller in order to set the LEDs.
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.
>
> Thanks
> David
>
Attachment:
signature.asc
Description: This is a digitally signed message part.