LeandroSQ / redragon-rgb-controller

Reverse engineering of the Redragon's peripherals LED USB command
MIT License
15 stars 5 forks source link

Redragon K631 integration #2

Closed A-Rint-A closed 5 months ago

A-Rint-A commented 6 months ago

Greetings, please help with packet analysis of my Redragon K631, I have added comments for convenience, I have never used wireshark before.

https://drive.google.com/file/d/14BxPLy_9PtannCQ9G9g6h8KW6IZ2YJjp/view?usp=sharing

A-Rint-A commented 6 months ago

@LeandroSQ Hello, please asist

LeandroSQ commented 6 months ago

Hello there :) This is somewhat of an old project now, but I'll do my best to assist you.

Here's a suggestion: Alongside capturing the packets, consider exporting them as hex dumps. Then, utilize a diff tool to meticulously compare the differences between each color. Typically, packets contain all the configuration data for your device, along with the application. This is what I've observed with my Redragon device; however, yours might operate differently.

What you're really aiming for is to identify the hexadecimal (HEX) values representing the color codes sent from the software to your device. You need to identify which RGB values are being sent to your device, a few ideas to find these:

I highly recommend capturing and saving each color application as a separate file. I was a little bit confused when navigating your packet capture.

A-Rint-A commented 6 months ago

As it turned out the program does not store configs anywhere, the config is read from the keyboard memory

A-Rint-A commented 6 months ago

I can't watch anything today, I'll continue tomorrow, if I can I'd like you to add it to the repository, it will be useful for many people, by the way e-yoosoo z686 is a remake of this keyboard, they are fully compatible, they work with each other's drivers and have the same firmware.

LeandroSQ commented 6 months ago

As it turned out the program does not store configs anywhere, the config is read from the keyboard memory

Hum, it has been a while since I tried, so that could explain it...

if I can I'd like you to add it to the repository

Sure, why not. I can't promise to code anything for you, but I can try to guide you on my spare time

e-yoosoo z686 is a remake of this keyboard, they are fully compatible, they work with each other's drivers and have the same firmware.

So it may be that you are not reversing the Redragon devices, and that's why everything seems different.. Nice find!

A-Rint-A commented 6 months ago

found a pattern in the packets, R, G, B are transposed by one hexadecimal value. for example FF 00 00 = RED 00 FF 00 = GREEN 00 00 FF = BLUE

Screenshot 2024-03-14 171318

A-Rint-A commented 6 months ago

There is also another package of the same size, which is identical in all three cases.

A-Rint-A commented 6 months ago

Keyboard idenfity VID= 0x258A PID= 0x0049

A-Rint-A commented 6 months ago

I also found out that there is no need to save anything, or that the second packet just performs this function, unfortunately I do not know how to send a single packet.

LeandroSQ commented 6 months ago

You can use this repo as an inspiration on how to send packets... This is the library I used to interface, sending one or N packets should be the same thing

LeandroSQ commented 6 months ago

For your keyboard, seems like every config is sent on a single packet... So you will either reverse engineer all the possible configs, or just settle with one predefined and just replicate the bytes changing only the color values

A-Rint-A commented 6 months ago

Attempts to slip packets so far have not been successful, mainly the problem is that the keyboard is detected as several hid devices, how can you recognize the one to which to send packets?

A-Rint-A commented 6 months ago

These hid devices have the same VID and PID, only interface and usagePage are different, but wireshark doesn't point to them and the brute force method didn't give any results, maybe packets should be sent to each of them.

A-Rint-A commented 6 months ago

C:\Users\ADM\Desktop\redragon-rgb-controller-master>node showdevices.js devices: [ { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col04#8&12eae2c7&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 1, usage: 6 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col01#8&12eae2c7&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 1, usage: 128 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col02#8&12eae2c7&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 12, usage: 1 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_00#8&261aff05&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\KBD', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 0, usagePage: 1, usage: 6 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col03#8&12eae2c7&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 65280, usage: 1 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col05#8&12eae2c7&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 65280, usage: 1 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col06#8&12eae2c7&0&0005#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 65280, usage: 1 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col07#8&12eae2c7&0&0006#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 1, usage: 2 }, { vendorId: 9610, productId: 73, path: '\\?\HID#VID_258A&PID_0049&MI_01&Col08#8&12eae2c7&0&0007#{4d1e55b2-f16f-11cf-88cb-001111000030}', serialNumber: '', manufacturer: 'BY Tech', product: 'Gaming Keyboard', release: 259, interface: 1, usagePage: 65280, usage: 1 } ]

A-Rint-A commented 6 months ago

I will be very happy if you join my repository, I will post everything I find there, when I finish if it works out I will create a fork of your repository.