Skip to content

Repository files navigation

sinowisp

crateci

(formerly sinowealth-kb-tool)

A utility for reading and writing flash contents on Sinowealth 8051-based USB HID devices (keyboards and mice) through the commonly found ISP bootloader.

Disclaimer

I offer no guarantees that using this tool won't brick your device. Use this tool at your risk.

Usage

Reading

⚠️ A read operation will set an LJMP (0x02) opcode at address <firmware_size-5> if it's not already present there. When this opcode is set, the bootloader considers the main firmware enabled and jumps to it when the device is powered on. This opcode should already be set on most devices and therefore the read operation should not cause any issues.

⚠️ During reading the ISP bootloader will redirect values in 0x0001 - 0x0002 to <firmware_size-4> - <firmware_size-3>. Because of this, the produced payload will be different from how memory is actually laid out in the MCU flash.

# reads firmware excluding isp bootloader 
sinowisp read -d nuphy-air60 foobar.hex
# reads only isp bootloader section
sinowisp read -d nuphy-air60 -s bootloader bootloader.hex
# full dump including firmware and bootloader
sinowisp read -d nuphy-air60 -s full full.hex
# custom device
sinowisp read \
--platform sh68f90 \
--vendor_id 0x05ac \
--product_id 0x024f \
--firmware_size 61440 \ # optional
--bootloader_size 4096 \ # optional
--page_size 2048 \ # optional
--isp_iface_num 1 \ # optional
--isp_report_id 5 \ # optional
--reboot false\ # optional
foobar.hex

Writing

⚠️ Same as the read operation, the ISP bootloader will write values meant for addresses 0x0001-0x0002 to <firmware_size-4> - <firmware_size-3>.

# overwrites firmware (does not touch the bootloader section)
sinowisp write -p nuphy-air60 foobar.hex
# custom device
sinowisp write \
--platform sh68f90 \
--vendor_id 0x05ac \
--product_id 0x024f \
--firmware_size 61440 \ # optional
--bootloader_size 4096 \ # optional
--page_size 2048 \ # optional
--isp_iface_num 1 \ # optional
--isp_report_id 5 \ # optional
--reboot false\ # optional
foobar.hex

Supported Hardware

Keyboards

ModelISP MD5MCUMCU LabelTested ReadTested Write
Aula F753e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Aula F873e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
CIY X7746459c31e58194fa076b8ce8fb1f3eaaSH68F88P (?)BYK816
Deltaco Gaming WK95R2d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Dierya DK68SE620f0b67a91f7f74151bc5be745b7110SH68F90ABYK903
Digital Alliance Meca Warrior X2d169670eae0d36eae8188562c1f66e8SH68F90SH68F90S
E-Yooso Z113e0ebd0c440af5236d7ff8872343f85dSH68F90?BYK901
E-Yooso Z823e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Genesis Thor 300e57490acebcaabfcff84a0ff013955d9SH68F881SH68F881W
Genesis Thor 300 RGB2d169670eae0d36eae8188562c1f66e8SH68F90SH68F90S
Hykker X Range 2017 (RE-K70-BYK800)13df4ce2933f9654ffef80d6a3c27199SH68F881BYK801
Kzzi K68Pro3e0ebd0c440af5236d7ff8872343f85dSH68F90A
Leobog Hi753e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Leobog Hi75c Pro3e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Machenike K500-B612d169670eae0d36eae8188562c1f66e8SH68F90?BYK916
MageGee MK-STAR613e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
NuPhy Air603e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
NuPhy Air753e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
NuPhy Air963e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
NuPhy Halo653e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Portronics Hydra 102d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Redragon K530 Draconic PROcfc8661da8c9d7e351b36c0a763426aaSH68F90ABYK916
Redragon K614 Anivia 60%2d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Redragon K617 FIZZ 60%2d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Redragon K6182d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Redragon K630 Single LED versioncfc8661da8c9d7e351b36c0a763426aaSH68F90ASH68F90AU
Redragon K633 RYZE2d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Redragon K641 SHACO PRO3e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Redragon K652 PRO3e0ebd0c440af5236d7ff8872343f85dSH68F90A
Redragon K658 PRO SE3e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Royal Kludge RK100cfc8661da8c9d7e351b36c0a763426aaSH68F90?BYK916
Royal Kludge RK613e0ebd0c440af5236d7ff8872343f85dSH68F90?BYK916
Royal Kludge RK68 BT Dualcfc8661da8c9d7e351b36c0a763426aaSH68F90?BYK901
Royal Kludge RK68 ISO ReturnSH68F90?BYK916
Royal Kludge RK71cfc8661da8c9d7e351b36c0a763426aaSH68F90?
Royal Kludge RK84cfc8661da8c9d7e351b36c0a763426aaSH68F90?BYK916
Royal Kludge RKG68cfc8661da8c9d7e351b36c0a763426aaSH68F90ASH68F90AS
SuperFrame Phantom3e0ebd0c440af5236d7ff8872343f85dSH68F90A
Terport TR952d169670eae0d36eae8188562c1f66e8SH68F90ABYK916
Weikav Sugar652d169670eae0d36eae8188562c1f66e8SH68F90SH68F90S
Xinmeng K916cfc8661da8c9d7e351b36c0a763426aaSH68F90
Xinmeng M663e0ebd0c440af5236d7ff8872343f85dSH68F90ASH68F90AS
Xinmeng M712d169670eae0d36eae8188562c1f66e8SH68F90ASH68F90AS
Xinmeng XM-RF682d169670eae0d36eae8188562c1f66e8SH68F90SH68F90U
Yinren R1083e0ebd0c440af5236d7ff8872343f85dSH68F90ABYK916
Yunzii AL663e0ebd0c440af5236d7ff8872343f85dSH68F90ASH68F90AS
Yunzii AL712d169670eae0d36eae8188562c1f66e8SH68F90ASH68F90AS

Mice

ModelISP MD5MCUMCU LabelTested ReadTested Write
Glorious Model O46459c31e58194fa076b8ce8fb1f3eaaSH68F89BY8948
Trust GXT 960620f0b67a91f7f74151bc5be745b7110BY8801

Bootloader Support

Platforms

ISP MD5WindowsmacOSLinux
13df4ce2933f9654ffef80d6a3c27199??ok
2d169670eae0d36eae8188562c1f66e8ok?ok
3e0ebd0c440af5236d7ff8872343f85dokokok
46459c31e58194fa076b8ce8fb1f3eaaok?ok
620f0b67a91f7f74151bc5be745b7110?fail1ok
cfc8661da8c9d7e351b36c0a763426aaokfail1ok
e57490acebcaabfcff84a0ff013955d9okfail1ok

Prerequisites

Linux

To enable running this tool without superuser privileges add the following udev rule with xxxx and yyyy replaced with your device Vendor ID and Product ID respectively.

# /etc/udev/rules.d/plugdev.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="yyyy", MODE="0660", GROUP="plugdev"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0603", ATTRS{idProduct}=="1020", MODE="0660", GROUP="plugdev"

Make sure your user is part of the plugdev group.

macOS

If you encounter errors like:

hid_open_path: failed to open IOHIDDevice from mach entry...

Ensure that your terminal application has access to input monitoring.

Acknowledgments

Thanks to @gashtaan for analyzing and explaining the inner workings of the ISP bootloaders. Without his help, this tool wouldn't be here!

Footnotes

  1. macOS does not recognize the composite device as an HID device 23

About

A utility for reading and writing flash contents on Sinowealth 8051-based HID devices through the commonly found ISP bootloader. (formerly "sinowealth-kb-tool")

Topics

Resources

Stars

156 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages