Skip to content

Commit 56cadbb

Browse files
onlykeyonlykey
authored andcommitted
fix getkeylabels
1 parent 5d8c158 commit 56cadbb

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

onlykey/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ def prompt_pin():
155155
tmp = {}
156156
for slot in only_key.getkeylabels():
157157
tmp[slot.name] = slot
158-
slots = iter(['RSA Key 1', 'RSA Key 2', 'RSA Key 3', 'RSA Key 4', 'ECC Key 1', 'ECC Key 2', 'ECC Key 3', 'ECC Key 4', 'ECC Key 5', 'ECC Key 6', 'ECC Key 7', 'ECC Key 8', 'ECC Key 9', 'ECC Key 10', 'ECC Key 11', 'ECC Key 12', 'ECC Key 13', 'ECC Key 14', 'ECC Key 19', 'ECC Key 20', 'ECC Key 21', 'ECC Key 22', 'ECC Key 23', 'ECC Key 24', 'ECC Key 25', 'ECC Key 26', 'ECC Key 27', 'ECC Key 28', 'ECC Key 29', 'ECC Key 30', 'ECC Key 31', 'ECC Key 32'])
158+
slots = iter(['RSA Key 1', 'RSA Key 2', 'RSA Key 3', 'RSA Key 4', 'ECC Key 1', 'ECC Key 2', 'ECC Key 3', 'ECC Key 4', 'ECC Key 5', 'ECC Key 6', 'ECC Key 7', 'ECC Key 8', 'ECC Key 9', 'ECC Key 10', 'ECC Key 11', 'ECC Key 12', 'ECC Key 13', 'ECC Key 14', 'ECC Key 15', 'ECC Key 16', 'ECC Key 17', 'ECC Key 18', 'ECC Key 19', 'ECC Key 20', 'ECC Key 21', 'ECC Key 22', 'ECC Key 23', 'ECC Key 24', 'ECC Key 25', 'ECC Key 26', 'ECC Key 27', 'ECC Key 28', 'ECC Key 29', 'ECC Key 30', 'ECC Key 31', 'ECC Key 32'])
159159
for slot_name in slots:
160160
print(tmp[slot_name].to_str())
161161
print(tmp[next(slots)].to_str())
162+
print()
162163

163164
elif sys.argv[1] == 'setslot':
164165
try:

onlykey/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def read_bytes(self, n=64, to_str=False, timeout_ms=100):
340340
# Returns the raw list
341341
return out
342342

343-
def read_string(self, timeout_ms=2000):
343+
def read_string(self, timeout_ms=100):
344344
"""Read an ASCII string."""
345345
return ''.join([chr(item) for item in self.read_bytes(MAX_INPUT_REPORT_SIZE, timeout_ms=timeout_ms) if item != 0])
346346

@@ -367,12 +367,13 @@ def getkeylabels(self):
367367
No need to read messages.
368368
"""
369369
self.send_message(msg=Message.OKGETLABELS, slot_id=107)
370-
time.sleep(2)
370+
time.sleep(0)
371371
slots = []
372372
for _ in range(36):
373373
data = self.read_string().split('|')
374-
print 'Received= ', repr(data)
374+
print 'data ', repr(data)
375375
slot_number = ord(data[0])
376+
print 'slot_number ', repr(slot_number)
376377
if 25 <= slot_number <= 60:
377378
slots.append(Slot(slot_number, label=data[1]))
378379
return slots

0 commit comments

Comments
 (0)