-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdebug.py
More file actions
29 lines (23 loc) · 815 Bytes
/
debug.py
File metadata and controls
29 lines (23 loc) · 815 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
# noqa
from freewili import FreeWili
def send_event_cb(msg: str) -> None:
"""Temporary."""
print(f"\r[Send File Callback]: {msg}" + " " * (120 - len(msg)), end="\r")
def get_event_cb(msg: str) -> None:
"""Temporary."""
print(f"\r[Get File Callback]: {msg}" + " " * (120 - len(msg)), end="\r")
device = FreeWili.find_first().expect("Failed to find a FreeWili")
print(f"Using {device}")
# device.stay_open = True
device.open().expect("Failed to open")
ret = device.send_file("tests/assets/pip_boy.fwi", "/images/pip_boy.fwi", None, send_event_cb, 32768).expect(
"Failed to send file"
)
print()
print(ret)
print("=" * 80)
ret = device.get_file("/images/pip_boy.fwi", "pip_boy_downloaded.fwi", None, get_event_cb).expect("Failed to get file.")
print()
print(ret)
device.close()
print("Done!")