-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alternative way to match Joy-Cons devices #27
Comments
Based on https://github.com/DanielOgorchock/joycond/blob/778a7270ec403a23af02117b1da764fa0122dc23/src/phys_ctlr.cpp#L31 I noticed there are files in (Ubuntu) Edit: found a path following symlinks that goes |
I think I figured out where the random-looking hex part of the path comes from.
where
since the folder in |
I'm looking through joycond's source code and I think we need an edit right around here: https://github.com/DanielOgorchock/joycond/blob/778a7270ec403a23af02117b1da764fa0122dc23/src/virt_ctlr_combined.cpp#L259 |
This is my initial go at it just for reference, open to any different approach https://github.com/joaorb64/joycond-cemuhook/tree/led-status |
I tried multiple things but I'm unable to make joycond register either one of the controller's uniq or LED status, I'm a linux driver newbie and don't really know where to learn how to do this.
|
Detecting the leds is possible with pyudev (#28). However, the combined controller doesn't have leds, so we can't automatically match if there is more than one combined controller. The other virtual devices joycond creates do have leds though. If joycond could create leds for the combined device as well, we could use that to match the devices more easily |
I just thought of another way of solving this issue. Solution:
Logic:
So if I have a Combined device, I'd have slots 1 and 2 assigned to Joycon R and Joycon L, each reporting its own motion but also reporting the same button inputs. We'd have to check how emulators have been dealing with cemuhook, but maybe having a whole cemuhook server for each device could also mean unlimited devices, as combined joycons take 2 slots. Yuzu for example has an option to connect to multiple servers so I'm guessing it would work well with it. |
I'm not sure what you mean here. What information does root permission gives us that we can't get with normal user? We can already detect the led status of the individual Joy-Cons in a combined pair. |
I meant that the evdev device is still accessible to root. Joycond hides left and right joycons when it creates a combined joycons device. |
This is the output if run as root: Notice that we have both individual controllers and something that indicates they're combined! This is what I meant. When reading inputs from the Left Joycon, we can check if there's a Right Joycon with matching LEDs and apply these inputs to that device too. So we're not directly using Combined Joycons. |
This isn't necessary, though. The IMU devices have LEDs as well, so this doesn't add any new information. With DanielOgorchock/joycond#49, we will be able to match the LEDs of the IMUs with the LEDs of the combined device. I've pushed a new branch as a proof-of-concept: auto_detection |
I tested it and it works great! Now the only thing that I think would be even better to close it out is to:
Then if Dolphin had an option to select from which motion device the Nunchuck motion is coming from, configuration would be possible in a matter of seconds... |
This line does exactly this: |
Sorry, the hype for testing made me overlook it, haha. Nice work! Now if my PR gets merged we're ready to have a system service as proposed in #6 ! |
Continuing the discussion from #26.
I figured out another way we might be able to auto-detect the Joy-Cons in a combined device. The paired Joy-Cons have the same leds turned on, and it is unique - other Joy-Cons will have different leds turned on. If we could find the led status of each device, we could match the identical ones. I don't think joycond currently exposes this info - I tried using
device.leds()
for the evdev devices, but it always returns an empty list.If joycond is able to expose the led information, we could use that to find out which devices are paired.
The text was updated successfully, but these errors were encountered: