Skip to content

Commit 543b142

Browse files
committed
pybricksdev.dfu: Add SPIKE Essential USB product ID.
This adds the SPIKE Essential USB product ID for both DFU mode and FS mode.
1 parent 14568a9 commit 543b142

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
### Added
1010
- Added `VOLUME` to `ble.lwp3.bytecodes.HubProperty` enum.
11+
- Added SPIKE Essential hub device IDs.
1112

1213
## [1.0.0-alpha.14] - 2021-08-27
1314

pybricksdev/dfu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
FIRMWARE_SIZE = 1 * 1024 * 1024 - 32 * 1024 # 1MiB - 32KiB
2222
LEGO_VID = 0x0694
2323
SPIKE_PRIME_PID = 0x0008
24+
SPIKE_ESSENTIAL_PID = 0x000C
2425
MINDSTORMS_INVENTOR_PID = 0x0011
2526

2627

27-
SPIKE_PRIME_DEVICE = f"{LEGO_VID:04x}:{SPIKE_PRIME_PID:04x}"
28-
MINDSTORMS_INVENTOR_DEVICE = f"{LEGO_VID:04x}:{MINDSTORMS_INVENTOR_PID:04x}"
29-
ALL_DEVICES = [SPIKE_PRIME_DEVICE, MINDSTORMS_INVENTOR_DEVICE]
28+
ALL_PIDS = [SPIKE_PRIME_PID, SPIKE_ESSENTIAL_PID, MINDSTORMS_INVENTOR_PID]
29+
ALL_DEVICES = [f"{LEGO_VID:04x}:{pid:04x}" for pid in ALL_PIDS]
3030

3131

3232
def _get_dfu_util() -> ContextManager[os.PathLike]:
@@ -178,7 +178,7 @@ def flash_dfu(firmware_bin: bytes, metadata: dict) -> None:
178178
exit(1)
179179

180180
product_id = devices[0].idProduct
181-
if product_id != SPIKE_PRIME_PID and product_id != MINDSTORMS_INVENTOR_PID:
181+
if product_id not in ALL_PIDS:
182182
print(f"Unknown USB product ID: {product_id:04X}", file=sys.stderr)
183183
exit(1)
184184

pybricksdev/resources/99-pybricksdev.rules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0008", TAG+="uacce
2020
# SPIKE Prime hub
2121
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0009", TAG+="uaccess"
2222

23+
# SPIKE Essential hub in firmware update mode (DFU mode)
24+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="000C", TAG+="uaccess"
25+
26+
# SPIKE Essential hub
27+
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="000D", TAG+="uaccess"
28+
2329
# MINDSTORMS Inventor hub
2430
SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", ATTRS{idProduct}=="0010", TAG+="uaccess"
2531

pybricksdev/usbconnection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ async def connect(self, product):
6363
or (dev.pid == 0x5740 and dev.vid == 0x0483)
6464
or (dev.vid == 0x0694 and dev.pid == 0x0010)
6565
or (dev.vid == 0x0694 and dev.pid == 0x0009)
66+
or (dev.vid == 0x0694 and dev.pid == 0x000D)
6667
):
6768
port = dev.device
6869
break

0 commit comments

Comments
 (0)