Skip to content

Instantly share code, notes, and snippets.

@Gadgetoid
Last active May 15, 2024 00:57
Show Gist options
  • Select an option

  • Save Gadgetoid/94ff13b782828c6aaa3ef2102a40310c to your computer and use it in GitHub Desktop.

Select an option

Save Gadgetoid/94ff13b782828c6aaa3ef2102a40310c to your computer and use it in GitHub Desktop.
Janky Python script to set the clock on an epomaker shadow S
from usb.core import Device
import usb
from datetime import datetime
VID = 0x320f
PID = 0x5055
dev = usb.core.find(idVendor=VID, idProduct=PID)
if dev.is_kernel_driver_active(3):
dev.detach_kernel_driver(3)
dev.set_configuration()
#print(dev)
# THESE ARE IN HEXADECIMAL FOR NO REASON YYY THOOO!???
DAAY = 0x06
MNTH = 0x09
YEAR = 0x48
HOUR = 0x12
MINU = 0x12
SCND = 0x12
dt = datetime.now()
# NO REALLY, WTF!?
DAAY = int(f"{dt.day}", 16)
MNTH = int(f"{dt.month}", 16)
year = f"{dt.year:04d}"[2:4]
YEAR = int(f"{year}", 16)
HOUR = int(f"{dt.hour}", 16)
MINU = int(f"{dt.minute}", 16)
SCND = int(f"{dt.second}", 16)
payload = [
0x04, 0x02, 0x05, 0x06, 0x30,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x09, 0x04, 0x00, 0x00, 0xff, 0x00, 0x9e, 0x29, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x06,
0x09, 0x02, 0x00, 0x01, 0x00, 0x01, SCND, MINU, HOUR, 0x03, DAAY, MNTH, YEAR, 0x00, 0x64, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
]
payload2 = [
0x04, 0x02, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
]
print(len(payload))
dev.write(0x5, payload)
print(dev.read(0x05, 0))
print(dev.read(0x83, 8))
#dev.write(0x83, [])
dev.write(0x5, payload2)
print(dev.read(0x05, 0))
print(dev.read(0x83, 8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment