Re: Handling controllers that can be used separately and together

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

 




On 23 December 2018 04:45:13 GMT, Roderick Colenbrander <thunderbird2k@xxxxxxxxx> wrote:
>On Fri, Dec 21, 2018 at 8:16 AM Billy Laws <blaws05@xxxxxxxxx> wrote:
>>
>>
>>
>> On 21 December 2018 09:56:10 GMT, Benjamin Tissoires
><benjamin.tissoires@xxxxxxxxx> wrote:
>> >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.
>> >
>> Also, what about programs that access the controller directly without
>libinput, i guess they would need to be fixed?
>> How would I tell userspace which one is left and which one is right?
>
>Do the left and the right joycon have a different product id? Ideally
>applications use vendor and product id. Worst case you can put Left /
>Right in the device string...
>
Yeah, they do.
I've been discussing with some switch Linux folks and we have come to the conclusion that doing it this way isn't really going to be good for the intended use of them. There are lots of games that will enumerate each controller as a separate player  and that would be pretty hard to change for all if them. 
Could there be a sysfs knob to unify the inputs to one? Then there can be an application in user space can switch between modes.
If not, then the only solution we could think of was to create a fake input device in userspace that joins both and somehow prevent games from using split ones, which I find really ugly.
>Thanks,
>Roderick

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.




[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