Nintendo_Switch_Reverse_Engineering
Nintendo_Switch_Reverse_Engineering copied to clipboard
Output from ring-con?
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?
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.
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.
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.
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 😄.
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.
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.
I have to do a readme XD
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
You have to use the python script for capture, my tool only does the decoding part using my parsing lib.
I added some doc for the cli and libraries.
And I added a subcommand to proxy and record, all in rust! It's pretty raw so testing would be appreciated ;)
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 :)
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.
I added full logging support, env RUST_LOG=debug cargo run --bin joytk ringcon monitor
now show the raw reports \o/
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.
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 ^^
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.
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.
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! 👏👏👏👏👏👏
@Yamakaky I feel that gyroscope and timestamp are fused,
What do you mean by that?
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.
Enable IMU (6-Axis sensor) JOY CON FW 4.17 subcmd 40 03 Gyro ?
@Yamakaky
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 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
@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
Anyone has been able to pull calibration and step data from the ring?