Nintendo_Switch_Reverse_Engineering icon indicating copy to clipboard operation
Nintendo_Switch_Reverse_Engineering copied to clipboard

Output from ring-con?

Open maffe03 opened this issue 4 years ago • 28 comments

Are there any plans to find out how to read the output from the ring-con when it's attached? I'm guessing it's an axis, but I don't even know where to start looking. Does anyone know?

maffe03 avatar Apr 10 '20 14:04 maffe03

I made some progress following https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/issues/98. After configuration, the ringcon flex is sent instead of the accelerometer in the third IMU packet in the standard input report. The gyro and 2/3 of the accelerometersstays the same. I'm looking to replicate it in https://github.com/Yamakaky/joy, will post when it works.

Yamakaky avatar Feb 08 '21 15:02 Yamakaky

It works, you can run cargo run --bin joytk ringcon with a paired joycon. It shows the raw hex value from the ringcon. I can also read the number of offline flex (when you press the stick with the switch off), there is what seem to be a crc but I can't find how it works. I can only write a flex count if I already know the CRC. Here are some values I measured: https://0bin.net/paste/t6RlxsgX#YR4iCrD-sO/UB1RWx2VY9cPBmJUP/Ira1S6QtrRpmg0. At 0x1f3/500, the ringcon auto turns off.

Yamakaky avatar Feb 12 '21 16:02 Yamakaky

The setup process is as follow: https://github.com/Yamakaky/joy/blob/master/joycon/src/hid.rs#L443. I don't know what most of these commands do XD.

Yamakaky avatar Feb 12 '21 16:02 Yamakaky

Oh nice good to hear you got progress. I also wanted to try to make sense how to get the flex sensor data etc. maybe i find some time this weekend to play around with the ringcon myself and hopefully get figure out something useful 😄.

Kurainu avatar Feb 12 '21 16:02 Kurainu

I recorded some traces, you can use my tool cargo run --bin joytk decode < trace/x.log. It filters out the rumbleonly output and full input reports, basically only subcommands.

Yamakaky avatar Feb 12 '21 17:02 Yamakaky

I think i use your Tool and i try to get the relay/proxy thingy up and running that i can get a look at the packets in realtime or do my own trace.

Kurainu avatar Feb 12 '21 17:02 Kurainu

I have to do a readme XD

Yamakaky avatar Feb 12 '21 17:02 Yamakaky

Yeah do it or i try and error my way Through it xD. or i try to use the python script from the repo in the #98

Kurainu avatar Feb 12 '21 17:02 Kurainu

You have to use the python script for capture, my tool only does the decoding part using my parsing lib.

Yamakaky avatar Feb 12 '21 17:02 Yamakaky

I added some doc for the cli and libraries.

Yamakaky avatar Feb 13 '21 11:02 Yamakaky

And I added a subcommand to proxy and record, all in rust! It's pretty raw so testing would be appreciated ;)

Yamakaky avatar Feb 14 '21 22:02 Yamakaky

I tried the python script but i dont get the relay to send the packets from the Joycon/Ringcon through my Linux Laptop to my Switch. Its mostly Stuck at the SDP Adverstising but if it goes past it co conection to my Switch is made. Is it intended to work or i'm missing something? . But i can Capture the packets from the Joycon to a log file and use your Rust Script to decode them. And i Test the proxy and record Thingy when i get home

The rest of my Remaining free Weekend i tried first to understand what your rust script sends to activate the ringcon but its a slow progress because i dont know rust that well. Because when i have those i can tinker with it in a language that i know better than rust :D. If you could send me those commands as bytes if would be Great and saves my quiet some time getting those @Yamakaky :)

Kurainu avatar Feb 15 '21 07:02 Kurainu

Sure, I wanted to add logging anyway XD

I did my joycon lib will structs everywhere which makes it very convenient to use, but can make it hard to figure out the exact bytes sent.

Yamakaky avatar Feb 15 '21 08:02 Yamakaky

I added full logging support, env RUST_LOG=debug cargo run --bin joytk ringcon monitor now show the raw reports \o/

Yamakaky avatar Feb 15 '21 19:02 Yamakaky

I have just made public a working implementation of the Ringcon to PC software - https://github.com/ringrunnermg/Ringcon-Driver. Any feedback would be great.

Also, good work Yamakaky, it took me months to get the data and it wasn't as complete as what you have got.

ringrunnermg avatar Feb 19 '21 08:02 ringrunnermg

oooh, you found the crc table for the ringcon? nice! Out of curiosity, how did you find it?

And yeah, I see everyone using raw buffer manipulation and copy pasted 20 lines loops while I'm like https://github.com/Yamakaky/joy/blob/master/joycon/src/hid.rs#L477 ^^

BTW you can detect if the ringcon is plugged by reading the Connection Info field in the standard input report. See https://github.com/Yamakaky/joy/blob/master/joycon-sys/src/input.rs#L225 for the additional values. It seems there is only one accessory that plugs to the ringcon so a lot of it is guess work. See also https://github.com/Yamakaky/joy/blob/master/joycon-sys/src/accessory.rs for what I could find about the protocol.

I still have to do some testing on which subcommands are required. I have a tight schedule for now so it may take some time ^^

Yamakaky avatar Feb 19 '21 10:02 Yamakaky

Do you guys think we could get this as a "raspberry pi zero w" USB-connected device? Aka. presents itself as keyboard + mouse or controller? Of course, some kind of desktop app would be needed to make a setup, select output type, bind actions, etc...

I kind of want to make that but all the buffer shenanigans are too much my front-end developer brain. (I may do it but it may take forever to fully understand the whole buffer stuff)

aka. joycons - (bluetooth) -> pi -> (usb) -> pc/console.

WitoTV avatar Feb 21 '21 01:02 WitoTV

Actually, that seem very doable:

  • I already have a WIP gamepad to mouse/keyboard mapper, you just need to update https://github.com/Yamakaky/joy/blob/master/gyromouse/src/main.rs#L113-L131 for the key presses. It also supports the dualshock, and https://docs.rs/gilrs could be used to add other gamepads. It doesn't support the ringcon which is very joycon specific, so that would need to be added.
  • The virtual keyboard part seems easy, for example https://randomnerdtutorials.com/raspberry-pi-zero-usb-keyboard-hid/

I can guide you through it at https://github.com/Yamakaky/joy/discussions.

Yamakaky avatar Feb 21 '21 10:02 Yamakaky

Amazing work @Yamakaky and @ringrunnermg, I've been trying to get at this data (off and on, I'm no hardware hacker) for over a year with very little success... so excited y'all have really cracked this! 👏👏👏👏👏👏

hoverbird avatar Mar 13 '21 05:03 hoverbird

@Yamakaky I feel that gyroscope and timestamp are fused,

xinzhuwei avatar Nov 05 '21 02:11 xinzhuwei

What do you mean by that?

Yamakaky avatar Dec 05 '21 16:12 Yamakaky

 the RING CON is enabled  ,joy con Gyro data protocol?

------------------ 原始邮件 ------------------ 发件人: "dekuNukem/Nintendo_Switch_Reverse_Engineering" @.>; 发送时间: 2021年12月6日(星期一) 凌晨0:11 @.>; @.@.>; 主题: Re: [dekuNukem/Nintendo_Switch_Reverse_Engineering] Output from ring-con? (#97)

What do you mean by that?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

xinzhuwei avatar Dec 06 '21 06:12 xinzhuwei

Enable IMU (6-Axis sensor) JOY CON FW 4.17 subcmd 40 03 Gyro ?

xinzhuwei avatar Dec 15 '21 07:12 xinzhuwei

@Yamakaky

xinzhuwei avatar Dec 15 '21 07:12 xinzhuwei

I'm sorry @xinzhuwei but I'm not sure what you mean by that? You indeed have to call subcommand 40 with parameter 03, which I called MaybeRingcon here https://github.com/Yamakaky/joy/blob/2691f8c655213672eb385adaae5a073353a0177c/crates/joycon/src/hid.rs#L487.

Yamakaky avatar Dec 15 '21 09:12 Yamakaky

@Yamakaky Yes, in mayberingcon mode, the data and timestamp of the gyroscope change. I don't know the change protocol. It seems to be related to subcommand 5C

xinzhuwei avatar Dec 20 '21 06:12 xinzhuwei

@Yamakaky Yes, in MaybeRingcon ; In the Bluetooth data report, is the gyroscope data related to the time stamp? but ,I don’t know the protocol of gyroscope data and time stamp

a1306440000000ec877bde67790a8dfd3e0212101700f6ff0c006dfd7e010f101200fcfff0ff55fd5900191011000000e4ff

xinzhuwei avatar Jan 07 '22 02:01 xinzhuwei

Anyone has been able to pull calibration and step data from the ring?

german77 avatar Dec 04 '22 15:12 german77