Skip to content

Commit faaf6e6

Browse files
committed
copilot update
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent 3b0bac0 commit faaf6e6

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

python/qmk_hid/gui.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,17 @@ def get_numlock_state():
139139

140140
def update_type(t):
141141
types = {
142-
'ansi': 0x0012,
143-
'copilot': 0x0030,
144-
'iso': 0x0018,
145-
'jis': 0x0019,
146-
'macropad': 0x0013,
147-
'numpad': 0x0014,
142+
'ansi': [0x0012],
143+
'copilot': [0x0012, 0x0030],
144+
'iso': [0x0018],
145+
'jis': [0x0019],
146+
'macropad': [0x0013],
147+
'numpad': [0x0014],
148148
}
149149
if t not in types:
150150
print(f"Invalid type '{t}'")
151151
sys.exit(1)
152-
pid = types[t]
152+
pids = types[t]
153153

154154
#if is_pyinstaller():
155155
# print("Not bundled executable. No releases available.")
@@ -165,27 +165,28 @@ def update_type(t):
165165
devices = find_devs(show=False, verbose=False)
166166
#print("Found {} devices".format(len(devices)))
167167

168-
filtered_devs = [dev for dev in devices if dev['product_id'] == pid]
168+
for pid in pids:
169+
filtered_devs = [dev for dev in devices if dev['product_id'] == pid]
169170

170-
if len(filtered_devs) == 0:
171-
print("No USB device with VID 32AC PID {:04X} found. Aborting".format(pid))
172-
sys.exit(1)
171+
if len(filtered_devs) == 0:
172+
print("No USB device with VID 32AC PID {:04X} found. Aborting".format(pid))
173+
sys.exit(1)
173174

174-
if len(filtered_devs) > 1:
175-
print("More than 1 USB device with VID 32AC PID {:04X} found. Aborting".format(pid))
176-
sys.exit(1)
175+
if len(filtered_devs) > 1:
176+
print("More than 1 USB device with VID 32AC PID {:04X} found. Aborting".format(pid))
177+
sys.exit(1)
177178

178-
print("Flashing firmware")
179-
flash_firmware(filtered_devs[0], firmware_path)
179+
print("Flashing firmware")
180+
flash_firmware(filtered_devs[0], firmware_path)
180181

181-
print("Waiting 10 seconds for the keyboard to restart")
182-
time.sleep(10)
182+
print("Waiting 10 seconds for the keyboard to restart")
183+
time.sleep(10)
183184

184-
if t == 'copilot':
185-
print("Clearing keyboard settings for copilot keyboard")
186-
devices = find_devs(show=False, verbose=False)
187-
filtered_devs = [dev for dev in devices if dev['product_id'] == pid]
188-
eeprom_reset(filtered_devs[0])
185+
if t == 'copilot':
186+
print("Clearing keyboard settings for copilot keyboard")
187+
devices = find_devs(show=False, verbose=False)
188+
filtered_devs = [dev for dev in devices if dev['product_id'] == pid]
189+
eeprom_reset(filtered_devs[0])
189190

190191

191192
def main():

0 commit comments

Comments
 (0)