rangoli icon indicating copy to clipboard operation
rangoli copied to clipboard

Add support for VID 0c45 boards [RK68K/RK855 (0c45:8018), etc.]

Open rnayabed opened this issue 2 years ago • 12 comments

Software link: https://drive.google.com/file/d/1sq4vglRZ-76aPoszcGp4_uBD27Kvu7Oo/view

rnayabed avatar Mar 01 '23 07:03 rnayabed

Both keyboards are NOT RGB. Only blue backlight.

rnayabed avatar Mar 01 '23 07:03 rnayabed

Here hidapitester output for RK855 from Windows:

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe  --vidpid 0c45:8018 --list-detail
0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0x000C
  usage:         0x0001
  serial_number: (null)
  interface:     1
  path: \\?\hid#vid_0c45&pid_8018&mi_01&col01#7&e9493c3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0x0001
  usage:         0x0080
  serial_number: (null)
  interface:     1
  path: \\?\hid#vid_0c45&pid_8018&mi_01&col02#7&e9493c3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}

0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0x0001
  usage:         0x0002
  serial_number: (null)
  interface:     1
  path: \\?\hid#vid_0c45&pid_8018&mi_01&col04#7&e9493c3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}

0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0x0001
  usage:         0x0006
  serial_number: (null)
  interface:     1
  path: \\?\hid#vid_0c45&pid_8018&mi_01&col03#7&e9493c3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd

0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0xFFFF
  usage:         0x0001
  serial_number: (null)
  interface:     1
  path: \\?\hid#vid_0c45&pid_8018&mi_01&col05#7&e9493c3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}

0C45/8018: SONiX - USB DEVICE
  vendorId:      0x0C45
  productId:     0x8018
  usagePage:     0x0001
  usage:         0x0006
  serial_number: (null)
  interface:     0
  path: \\?\hid#vid_0c45&pid_8018&mi_00#7&30562c40&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd

Path output:

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_01&col01#7&e9493c3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_01&col01#7&e9493c3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
Writing 65-byte feature report...wrote -1 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_01&col02#7&e9493c3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_01&col02#7&e9493c3&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
Writing 65-byte feature report...wrote -1 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_01&col04#7&e9493c3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_01&col04#7&e9493c3&0&0003#{4d1e55b2-f16f-11cf-88cb-001111000030}
Writing 65-byte feature report...wrote -1 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_01&col03#7&e9493c3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_01&col03#7&e9493c3&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Writing 65-byte feature report...wrote -1 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_01&col05#7&e9493c3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_01&col05#7&e9493c3&0&0004#{4d1e55b2-f16f-11cf-88cb-001111000030}
Writing 65-byte feature report...wrote -1 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

PS C:\Users\abina59x\Downloads\hidapitester-windows-x86_64> .\hidapitester.exe --open-path "\\?\hid#vid_0c45&pid_8018&mi_00#7&30562c40&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd" --length 65 --send-feature 0x0a,0x01,0x01,0x02,0x29,0x01,0x03,0x03,0x03,0,0,0,0x01,0x01
Opening device. path: \\?\hid#vid_0c45&pid_8018&mi_00#7&30562c40&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}\kbd
Writing 65-byte feature report...wrote 65 bytes:
 0A 01 01 02 29 01 03 03 03 00 00 00 01 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00
Closing device

Same as linux, I don’t see any changes on the keyboard.

syfq91 avatar Mar 02 '23 01:03 syfq91

Please attach screenshots of the RK Software. Note that I should be able to see the full list of lighting modes as well. That is very important.

It looks like the protocol is also different, so please do the following

You need to record some tests and send the output (.pcap) of the tests to me. You need to use Windows for this.

Setting up:

  1. install USBPCAP from https://desowin.org/usbpcap/

How to record:

  1. launch RK Keyboard Software
  2. launch USBPcapCMD.exe from C:\Program Files\USBPcap
  3. select the hub that you have connected your RK keyboard to. Generally it shows up as "HID Keyboard Device"
  4. enter file name as test_.pcap. After you enter it will start recording.
  5. proceed with the test steps.
  6. when test is done, do Ctrl+C to exit the program. The recording will stop.
  7. send over the .pcap files over

Note: Follow all the steps AT ONCE. For example, if you are asked to set x to 2 you should set x to 2 from the previous value AT ONCE, and not stopping midway at 3 or something.

Test 1

Before Recording, do the following:

  1. Open RK Software
  2. Select the first lighting mode (Mention the name as well from the screenshot)
  3. Set brightness to 5 (max)
  4. Set animation to 5 (max)
  5. Set sleep as No Sleep (max)

== Start Recording ==

Tests:

  1. Select explode light mode
  2. Select sleep at middle (3)
  3. Select Animation Speed as 2
  4. Select Sleep Time as 10 minutes

Test 2

BEFORE Testing, do the following:

  1. Select "Customize" Light effect mode.
  2. Turn off EVERY KEY
  3. Set sleep as 30 minutes

== Start Recording ==

  1. Select the custom lighting mode (Mention the name as well from the screenshot)
  2. Click on Q Key.
  3. Click on Esc Key.
  4. Click on Right Arrow Key.
  5. Set sleep to 20 minutes
  6. Select "Glittering" Light effect mode
  7. Select "Ripples" Light effect mode

After your tests are done, send me the 2 .pcap files. Also, send me the exact model name, Vendor ID and product ID of your keyboard.

rnayabed avatar Mar 02 '23 04:03 rnayabed

Hi, RK855 doesn’t have red led, what should I use to test?

And where can I check the exact model name, vendor id & product id?

Below is the screenshot of the software:

1 start page

2 layout

3 macro

4 light

5 setting

syfq91 avatar Mar 02 '23 06:03 syfq91

Ignore the colour part, included it by mistake. Just set the keys ignoring specific color

rnayabed avatar Mar 02 '23 06:03 rnayabed

Updated the tests, pls check again

rnayabed avatar Mar 02 '23 06:03 rnayabed

Hi, here the requested files.

Here the USBPcap window, for select filter I choose 2: 1 pcap

Test 1

Before Recording, do the following:

Open RK Software: Done Select the first lighting mode: I choose static mode Set brightness to 5 (max): I set brightness to 15 Set animation to 5 (max): I skipped this, not available in RK software Set sleep as No Sleep (max): I skipped this, not available in RK software

t1 1

== Start Recording ==

Tests:

Select explode light mode: Done Select sleep at middle (3): I choose 7, as shown in the screenshot Select Animation Speed as 2: I skipped this, not available in RK software Select Sleep Time as 10 minutes: I skipped this, not available in RK software

t1 2

Test 2

BEFORE Testing, do the following:

Select "Customize" Light effect mode. : I skipped this, not available in RK software Turn off EVERY KEY : I skipped this, not available in RK software, but I choose “close backlight” mode, refer screenshot below Set sleep as 30 minutes : I skipped this, not available in RK software

t2 1

== Start Recording ==

Select the custom lighting mode: I skipped this, not available in RK software Click on Q Key.: Done Click on Esc Key.: Done Click on Right Arrow Key.: Done Set sleep to 20 minutes: I skipped this, not available in RK software Select "Glittering" Light effect mode : Done, refer screenshot below

t2 2

Select "Ripples" Light effect mode: Done, refer screenshot below

t2 3

Refer the pcap files below:

pcap.zip

syfq91 avatar Mar 04 '23 14:03 syfq91

It looks like these brands of keyboards use a totally different protocol 🥲

No issues, I am trying to make sense of it. Thanks for sending info, I may send some more tests (very simple), please be patient :)

rnayabed avatar Mar 04 '23 16:03 rnayabed

Hi, can you do another test with the following?

Test 3

Before recording

  1. Open RK Software

Start Recording

Steps

  1. Exit the RK Software

Stop Recording

Test 4

Before recording

Do nothing

Start Recording

Steps

  1. Start RK Software
  2. Exit the RK Software

Stop Recording

Test 5

Before recording

  1. Start RK Software

Start Recording

Steps

Do nothing

Stop Recording

Test 6

Before recording

  1. Start RK Software
  2. Exit RK Software

Start Recording

Steps

Do nothing

Stop Recording

rnayabed avatar Mar 07 '23 07:03 rnayabed

Hi, attach the test data. test_3-6.zip

syfq91 avatar Mar 11 '23 03:03 syfq91

The protocol looks very obfuscated and at the time of writing this I feel unmotivated to work on this. My initial aim was to be able to configure my keyboard on linux, which grew into a bigger project. However, it looks like there are models that totally have different vendor IDs and protocols but still are sold as royal kludge keyboards. Their official software is also different. The fact that I do not physically own a 0x0c45 board also makes it harder. Thankfully, most RK keyboard models use the 0x258a protocol.

Maybe someday I can look into it. It should not be that hard, and the .pcap files are already uploaded here. Anyone is free to examine them and report back.

rnayabed avatar Mar 26 '23 08:03 rnayabed

I have found a GitHub project which has a similar function to this one, but seems to be intended for keyboards with VID 0x0c45:

Keymeleon

Perhaps their code can be used or their approach might be able to be adapted? I haven't looked into their code/documentation properly yet but once I get a chance I will share some more details (unless you beat me to it!). Also, they cite this project as being helpful in helping them understand the protocol:

rgb_keyboard

That could also be a good (possibly better) resource.

I don't have much knowledge in this area of software dev but I do have a small amount of relevant knowledge, so if I get time over the next month or two I might see if I can contribute some code also.

rowanad avatar Aug 12 '23 22:08 rowanad