Skip to content
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

Input Report Mode 0x30 Only On One Joy-Con At A Time? (SOLVED) #78

Closed
AlexCouch opened this issue Mar 12, 2019 · 1 comment
Closed

Input Report Mode 0x30 Only On One Joy-Con At A Time? (SOLVED) #78

AlexCouch opened this issue Mar 12, 2019 · 1 comment

Comments

@AlexCouch
Copy link

So I'm working on a library for handling Joy-Con I/O and I'm trying to change the input mode to 0x30 for both so that I have a continuous stream of input reports. Since the default is 0x3F, or for me it's 0x3F, it only sends input reports when there's input from buttons or analog sticks. I'm able to send an output report for the 0x03 subcommand and change the input report mode to 0x30 on one joy-con, but when I have two joy-con's connected (one left, and one right) I am only able to have one of them be in input report mode 0x30. I have a Joy-Con constructor that sends that subcommand output report every time a Joycon object is constructed:

    public Joycon(HidDevice device) {
        this.device = device;
        this.setPlayerLED();
        this.setInputReportMode(); //Output report sent here
        device.setInputReportListener(new JoyconHIDInputHandler(this));
        device.setDeviceRemovalListener(HidDevice::close);
    }

And the Joycon#setInputReportMode:

    private void setInputReportMode(){
        byte[] buf = new byte[50];
        buf[0] = 0x01;
        buf[10] = 0x03;
        buf[11] = 0x30;
        this.device.setOutputReport(buf[0], buf, buf.length);
    }

I am also setting the HID input report listener for every joycon device that is constructed into a Joycon object as a class implementation of an InputReportListener (purejavahidapi) here:
https://github.com/AlexCouch/JoyCouch/blob/master/src/main/java/couch/joycouch/joycon/JoyconHIDInputHandler.java

However, when I set 0x30, and set a breakpoint inside my onInputReport method, it shows that I'm continuously receiving full standard input reports that I can then take data from. But when I try to have two joycons connected, only one of them has the input mode 0x30, regardless. I first tested with the right joycon, and the right joycon works. I have a right joycon input handler test here:

https://github.com/AlexCouch/JoyCouch/blob/master/src/main/java/couch/joycouch/JoyconTest.java#L19-L31

Where JoyconInputReportHandler is an interface I created, which is invoked in the HID input report listener attached to the joycons. However, upon connecting a left joycon with the right, only the right sends full standard input reports. I also have a left input report handler in the same class as the right (linked above). When I disconnect the right and only have the left, the left has the input mode 0x30.

I'm just curious of whether this is an issue on my end or if this is just how the joycons work? And if there's a way to enable both joycons to be in the same input mode, or if I have to do some kind of output report first and turn something on or off? But I haven't seen anything regarding this. I'm gonna keep digging. If you have any questions my repo is linked but feel free to request more information if anything is missing. If I find a solution I'll be sure to update!

@AlexCouch AlexCouch changed the title Input Report Mode 0x30 Only On One Joy-Con At A Time? Input Report Mode 0x30 Only On One Joy-Con At A Time? (SOLVED) Mar 12, 2019
@AlexCouch
Copy link
Author

I have seen the errors in my ways. My tired ass brain totally forgot that during testing I stopped input from continuing on one of the joycons so I can focus on just one device at a time. In my onInputReport I had at the very top if(this.getSide() == 0) return; which returns if the side (which is an offset used to get the button info in the input report, just 3 + side to get the button status data) is 0. So just 3 + 0 which is the right joycon. Right now only my left joycon works. Removing it lets both take continuous input. Silly me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant