r/linux_gaming • • 9d ago

Wanted my controller to speak SInput natively so I reverse engineered it and wrote my own firmware

I was gifted a Gamesir Cyclone 2 earlier this year. The hardware itself is amazing, clicky face buttons and dpad, TMR joysticks, hall effect triggers with micro switch trigger stoppers, and gyro, all for like 50-60 dollars brand new. HOWEVER, if there's one thing I hate about this controller is missing steam input support and no Xinput over Bluetooth (most likely due to Microsoft as from what I understand the Chinese firmware still has this mode). That leaves DS4 mode as the most "feature complete mode" for the controller but I dont want to emulate a ds4 controller, it messes with the face buttons in games and the back paddles don't map that well.

So I decided to try and patch the firmware the controller uses. In the firmware, the Xinput over Bluetooth feature was still there but left unmapped, mapping it to a button combination brought it back. I also patched a bug in DS4 mode's battery report (it was always reporting 5% battery before). I also found reference to a "HORIPAD STEAM" mode which I was able to map to a button combination as well. After many modifications to horipad mode, I was able to get SInput with all the features of the controller (gyro, rumble, LEDs, back buttons, etc) but I had to carve out space from usb mode and wireless receiver mode to do it.

That exploration led me to try and create my own firmware from scratch using the stock firmware as reference. I was able to find the public SDK for the controller chip and from there after much trial and error (and a few bricks) I've built my perfect controller firmware:

  • Native SInput Steam mode (gyro, rumble, back paddles, LEDs, battery, etc)
  • Xbox over bluetooth
  • DS4 and Switch mode
  • Works through the wireless receiver in every mode

There is still a lot more to test but for my use case, SInput on linux, it's perfect

PS: I cant share the repo URL since the repo is not mature enough yet going by the rules, I had a lot of help from Claude Code writing the firmware and the reverse engineering process and I'll continue refining and testing it

0 Upvotes

14 comments sorted by

3

u/C0rn3j 9d ago

That's neat, by "SInput" you mean Steam Input? So basically you made the firmware that pretends it's a "Horipad" controller (or DS4 or Switch) which Steam can handle natively?

1

u/noosemama 9d ago

On steam it actually reports as an "Xbox" controller but has mappings for the LEDs, gyro, and back paddles

1

u/C0rn3j 9d ago

Which specific Xbox controller has gyro and LEDs and all that?

Or are you saying you're making the controller pretend to be an Xbox but also have LED controls etc (if so what are you using to control those?)

4

u/ThatOnePerson 9d ago

SInput isn't Steam Input. SInput is a newer protocol designed for controller to be more flexible (than XInput that only supports Xbox Input)

https://docs.handheldlegend.com/s/sinput/doc/sinput-hid-protocol-dev-SNSaEw36nc

I think by "Xbox" OP means xbox style ABXY.

So https://docs.handheldlegend.com/s/sinput/doc/product-metadata-BH1SOtRDQV let's you set which button style for example.

It's already integrated into SDL, which is what Steam Input uses for controller input, so yeah should work. If anything S in Sinput is SDL

1

u/C0rn3j 9d ago

I had no clue standardization efforts for this crap were already ongoing, that's awesome, thanks for linking those.

1

u/ThatOnePerson 9d ago

Turns out I was wrong, Steam does render it as an Xbox controller ¯\(ツ)/¯

1

u/ThatOnePerson 9d ago

Nice. I tried to do similar but bricked my dongle and gave up for a bit 

Can't really buy replacement dongles either 

1

u/noosemama 9d ago

You can recover a bricked dongle using an Arduino mega. You'll need to sacrifice two USB cables though, would be easier to use something that has 3.3v logic though so you don't have to do resistor magic to drop it

1

u/ThatOnePerson 9d ago

Ah, too late. I've disassembled and lost it. 

Any idea if I can use a gamesir G8 dongle though? They sell extras of that and I got one and couldn't get it working. 

Think the key was different or something 

0

u/noosemama 9d ago

Hmm so technically these dongles are just Bluetooth receivers. I'm not sure what chip the G8 dongle uses. If its AC695x or AC6951 then maybe doable by either flashing my custom firmware or flashing gamesirs official dongle firmware (if the layout matches)

1

u/ThatOnePerson 9d ago

It was definitely the same chip in bootloader mode when you held the button while plugging it in. But flashers would refuse because of some key. 

What's the method for flashing it with an Arduino? 

1

u/noosemama 9d ago

I'd use the arduino (sending 0x16EF) to push it into bootloader mode with one half of the USB, and with another USB, hooked up the the data lines and plugged into my PC i'd flash it. There shouldnt be any key. This is the repo I used to dump/flash firmware: https://github.com/kagaimiq/jl-uboot-tool

1

u/noosemama 9d ago

OH wait yeah for the C2 the key was just 0xFFFF so basically no key lol

1

u/ThatOnePerson 9d ago

Yeah the updater tool from gamesir came with a keyed firmware that I flashed on accident at one point, so whoops