Skip to content

Commit fe93797

Browse files
committed
fix dfu with changes suggested by @enrikb
1 parent 863c84a commit fe93797

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

solo/cli/program.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,12 @@ def enter_dfu(serial):
245245
"""
246246

247247
p = solo.client.find(serial)
248-
p.enter_st_dfu()
249-
# this doesn't really work yet ;)
250-
# p.reboot()
251-
252-
print("Please powercycle the device (pull out, plug in again)")
248+
try:
249+
p.enter_st_dfu()
250+
print("Please powercycle the device (pull out, plug in again)")
251+
except Exception as e:
252+
if "wrong channel" in str(e).lower():
253+
print("Command wasn't accepted by Solo. It must be in bootloader mode first and be a 'hacker' device.")
253254

254255

255256
aux.add_command(enter_dfu)

solo/devices/solo_v1.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import tempfile
66
import time
7+
from threading import Event
78

89
from fido2.client import Fido2Client
910
from fido2.ctap import CtapError
@@ -105,7 +106,13 @@ def use_hid(
105106
def send_only_hid(self, cmd, data):
106107
if not isinstance(data, bytes):
107108
data = struct.pack("%dB" % len(data), *[ord(x) for x in data])
108-
self.dev._dev.InternalSend(0x80 | cmd, bytearray(data))
109+
110+
no_reply = Event()
111+
no_reply.set()
112+
try:
113+
self.dev.call(0x80 | cmd, bytearray(data), no_reply)
114+
except IOError:
115+
pass
109116

110117
def exchange_hid(self, cmd, addr=0, data=b"A" * 16):
111118
req = Client.format_request(cmd, addr, data)

0 commit comments

Comments
 (0)