-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.py
More file actions
27 lines (24 loc) · 961 Bytes
/
boot.py
File metadata and controls
27 lines (24 loc) · 961 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
# boot.py — Initializes the USB CDC-ECM Ethernet device at boot time
# This runs BEFORE the USB subsystem starts, so the host sees the
# Ethernet adapter immediately on plug-in.
import usb.device
from ecm_interface import ECMInterface
# Create the ECM interface singleton — stored in the module so main.py
# can retrieve it via: from ecm_interface import _ecm_instance
ecm = ECMInterface()
ECMInterface._instance = ecm # stash for main.py to find
# builtin_driver=True keeps the built-in CDC serial REPL available
# alongside our ECM Ethernet interface.
#
# Explicit device class/subclass/protocol (0xEF/0x02/0x01) tells the host
# this device uses Interface Association Descriptors (IAD), which ChromeOS
# requires for CDC-ECM Ethernet adapters.
usb.device.get().init(
ecm,
builtin_driver=True,
device_class=0xEF,
device_subclass=0x02,
device_protocol=0x01,
manufacturer_str="Raspberry Pi",
product_str="Pico ECM Bridge",
)