-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.py
More file actions
43 lines (35 loc) · 990 Bytes
/
Copy pathcore.py
File metadata and controls
43 lines (35 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import hid
import time
def prepare_chunks(blob: bytes) -> list[bytes]:
#Making chunks from blob
#Cutting blob to chunks
chunks = []
for chunk in range (0, len(blob), 1024):
chunks.append(blob[chunk:chunk+1024])
#finishing up the last chunk
chunks[-1] = chunks[-1].ljust(1024, b"\x00")
return chunks
def send_commands() -> None:
#Opening device
dev = hid.device()
VID=0x2000
PID=0x3000
dev.open(VID,PID)
#Sending spesial commands
report = "00"
crt = "4352540000"
dis = bytes.fromhex(report + crt + "444953").ljust(1025,b"\x00")
lig = bytes.fromhex(report + crt + "4c4947000064").ljust(1025,b"\x00")
dev.write(dis)
dev.write(lig)
dev.close()
def send_image(chunks) -> None:
dev = hid.device()
VID=0x2000
PID=0x3000
dev.open(VID,PID)
#Writing data
while True:
for chunk in chunks:
dev.write(b"\x00" + chunk)
time.sleep(0.003)