Re: Handling controllers that can be used separately and together

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Billy,

On Tue, Dec 18, 2018 at 11:16 AM Billy Laws <blaws05@xxxxxxxxx> wrote:
>
> Hi,
> I'm looking into making a driver for the Nintendo switches joycon, they are two separate controllers that can be used together or separately but most of the time they are used together as one controller.
> Each of them is presented as a separate Bluetooth hid device so I'm not sure the best way to represent them to user space. Should I have a new input device for each separate joycon or create a new input device for every pair of l+r joycon?

I'd say if they are 2 distincts bluetooth devices, it makes sense to
have them separated. However, in the same way we have touch panels
that are doing pen and touch and that are exported as 2 separate
device nodes, you should be able to provide the info to the user space
that those 2 devices are supposed to be used together.
For pen/touch devices, userspace (udev) relies on the physical path
and assign LIBINPUT_DEVICE_GROUP to group those 2 devices altogether.

So I think if you provide a way from the serial to be able to match
those 2, user space should be OK.

However, please note that I am not in the SDL community (I am more a
regular input devices developer) so their advice might differ.

>
> Another question I have is that they can be docked to the switch where they swap from using Bluetooth hid to using UART. Is it okay for me to add support for that in hid driver? I was thinking of adding a DT compatible that will make the driver register a serdev and when it receives a packet saying the joycon is connected it will register the input devices and in the serdev receive buffer function it'll call a common function that handles packet for both hid and UART. Does that sound okay?

Few questions here:
- you are talking about DT and UART, so this would be a driver used in
the switch itself?
- can this UART connection be used in a different system than the switch?
- is the UART communication protocol similar-ish to the HID one or is
it entirely different?
- do you need the HID (bluetooth) connection/information from the UART driver?

If the UART connection is not HID and can only be used on the switch,
I'd rather have a separate driver in the input tree.

>
> I'll send an rfc driver in a few weeks based of comments to this?

Sure, please do :)

Cheers,
Benjamin




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux