replx 1.21.4__tar.gz → 1.22.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {replx-1.21.4/replx.egg-info → replx-1.22.2}/PKG-INFO +1 -1
- {replx-1.21.4 → replx-1.22.2}/replx/__init__.py +1 -1
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/device.py +18 -1
- {replx-1.21.4 → replx-1.22.2}/replx/cli/config.py +0 -14
- {replx-1.21.4 → replx-1.22.2}/replx/cli/connection.py +4 -2
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/scanner.py +9 -3
- {replx-1.21.4 → replx-1.22.2}/replx/transport/serial.py +31 -0
- {replx-1.21.4 → replx-1.22.2/replx.egg-info}/PKG-INFO +1 -1
- {replx-1.21.4 → replx-1.22.2}/LICENSE +0 -0
- {replx-1.21.4 → replx-1.22.2}/README.md +0 -0
- {replx-1.21.4 → replx-1.22.2}/pyproject.toml +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/__main__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/client/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/client/core.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/client/session.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/protocol.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/__main__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/command_dispatcher.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/connection_manager.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/core.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/exec.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/filesystem.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/i2c.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/repl.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/session.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/spi.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/transfer.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/handlers/uart.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/session_manager.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/agent/server/udp.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/app.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/_common.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/adc.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/ble.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/exec.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/file.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/firmware.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/gpio.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/i2c.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/i2s.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/mip.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/package.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/pwm.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/spi.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/uart.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/utility.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/wifi.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/commands/ws2812.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/compiler.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/environment.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/output.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/registry.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/store.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/cli/helpers/updater.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/commands.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/protocol/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/protocol/repl.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/protocol/storage.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/terminal.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/transport/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/_thread.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/aioble/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/aioble/l2cap.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/array.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/asyncio/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/binascii.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/bluetooth.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/builtins.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/cmath.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/collections.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/cryptolib.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/deflate.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/errno.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/framebuf.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/gc.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/hashlib.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/heapq.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/io.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/json.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/lwip.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/machine.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/math.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/micropython.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/mip/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/network.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/ntptime.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/os.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/platform.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/random.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/re.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/requests/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/select.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/socket.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/ssl.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/struct.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/sys.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/time.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/tls.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/uasyncio.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/uctypes.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/ulab.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/urequests.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm/vfs.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/binascii.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/digi/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/digi/ble.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/errno.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/hashlib.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/io.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/json.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/machine.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/math.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/micropython.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/network.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/os.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/select.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/socket.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ssl.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/struct.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/sys.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/time.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ubinascii.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ucryptolib.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/uerrno.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/uhashlib.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/uio.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ujson.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/umachine.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/uos.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/uselect.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/usocket.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ussl.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/ustruct.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/utime.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/xbee/__init__.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/xbee/modem_status.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/comm_separate/EFR32MG/xbee/relay.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/ESP32/aioespnow.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/ESP32/esp.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/ESP32/esp32.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/ESP32/espnow.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/MIMXRT1062DVJ6A/mimxrt.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/typehints/core/RP2350/rp2.pyi +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/utils/__init__.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/utils/constants.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/utils/device_info.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx/utils/exceptions.py +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx.egg-info/SOURCES.txt +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx.egg-info/dependency_links.txt +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx.egg-info/entry_points.txt +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx.egg-info/requires.txt +0 -0
- {replx-1.21.4 → replx-1.22.2}/replx.egg-info/top_level.txt +0 -0
- {replx-1.21.4 → replx-1.22.2}/setup.cfg +0 -0
- {replx-1.21.4 → replx-1.22.2}/test/test_hardware_commands.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: replx
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.22.2
|
|
4
4
|
Summary: replx is a fast, modern MicroPython CLI: turbo REPL, robust file sync (put/get), project install, mpy-cross integration, and smart port discovery.
|
|
5
5
|
Author-email: "chanmin.park" <devcamp@planxlab.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -880,7 +880,7 @@ Scans all serial ports to detect MicroPython devices.
|
|
|
880
880
|
|
|
881
881
|
history_default_cmp = _serial_port_cmp_key(history_default) if history_default else None
|
|
882
882
|
|
|
883
|
-
scanned = DeviceScanner.scan_serial_ports(max_workers=10)
|
|
883
|
+
scanned, permission_denied_ports = DeviceScanner.scan_serial_ports(max_workers=10)
|
|
884
884
|
|
|
885
885
|
for port_device, board_info in scanned:
|
|
886
886
|
version, core, device, manufacturer = board_info
|
|
@@ -1034,6 +1034,23 @@ Scans all serial ports to detect MicroPython devices.
|
|
|
1034
1034
|
title_align="left"
|
|
1035
1035
|
)
|
|
1036
1036
|
|
|
1037
|
+
if permission_denied_ports:
|
|
1038
|
+
ports_list = ", ".join(_serial_port_display(p) for p in permission_denied_ports)
|
|
1039
|
+
if sys.platform.startswith("linux"):
|
|
1040
|
+
hint = (
|
|
1041
|
+
f"[yellow]Permission denied on: {ports_list}[/yellow]\n"
|
|
1042
|
+
"[dim]Add your user to the dialout group, then log out/in (or reboot):[/dim]\n"
|
|
1043
|
+
" sudo usermod -aG dialout $USER"
|
|
1044
|
+
)
|
|
1045
|
+
elif sys.platform == "darwin":
|
|
1046
|
+
hint = (
|
|
1047
|
+
f"[yellow]Permission denied on: {ports_list}[/yellow]\n"
|
|
1048
|
+
"[dim]Another process may be holding the port, or it needs access permission.[/dim]"
|
|
1049
|
+
)
|
|
1050
|
+
else:
|
|
1051
|
+
hint = f"[yellow]Permission denied on: {ports_list}[/yellow]"
|
|
1052
|
+
OutputHelper.print_panel(hint, title="Permission Issue", border_style="error")
|
|
1053
|
+
|
|
1037
1054
|
|
|
1038
1055
|
from ..helpers.output import VALID_PANEL_CATEGORIES, _CATEGORY_COLOR_KEYS
|
|
1039
1056
|
|
|
@@ -78,20 +78,6 @@ class ConfigManager:
|
|
|
78
78
|
@staticmethod
|
|
79
79
|
def find_or_create_vscode_dir() -> str:
|
|
80
80
|
current = os.path.realpath(os.getcwd())
|
|
81
|
-
root = os.path.abspath(os.sep)
|
|
82
|
-
|
|
83
|
-
search_dir = current
|
|
84
|
-
visited = set()
|
|
85
|
-
while search_dir not in visited:
|
|
86
|
-
visited.add(search_dir)
|
|
87
|
-
vscode_dir = os.path.join(search_dir, ".vscode")
|
|
88
|
-
if os.path.isdir(vscode_dir):
|
|
89
|
-
return vscode_dir
|
|
90
|
-
parent = os.path.dirname(search_dir)
|
|
91
|
-
if parent == search_dir or parent == root:
|
|
92
|
-
break
|
|
93
|
-
search_dir = parent
|
|
94
|
-
|
|
95
81
|
vscode_dir = os.path.join(current, ".vscode")
|
|
96
82
|
os.makedirs(vscode_dir, exist_ok=True)
|
|
97
83
|
return vscode_dir
|
|
@@ -193,15 +193,17 @@ def _ensure_connected(ctx: typer.Context = None) -> dict:
|
|
|
193
193
|
raise typer.Exit(1)
|
|
194
194
|
|
|
195
195
|
if conn['source'] == 'global':
|
|
196
|
-
is_first_connection = env_path is None or default_conn is None
|
|
197
196
|
if not env_path:
|
|
198
197
|
vscode_dir = _find_or_create_vscode_dir()
|
|
199
198
|
env_path = os.path.join(vscode_dir, '.replx')
|
|
199
|
+
# Only `setup` may set the workspace default; a plain connect-on-demand
|
|
200
|
+
# (e.g. `replx PORT ls` with no default configured yet) must only
|
|
201
|
+
# register this port as the session's fg, never persist it as default.
|
|
200
202
|
_update_connection_config(
|
|
201
203
|
env_path, conn['connection'],
|
|
202
204
|
version=STATE.version, core=STATE.core, device=STATE.device,
|
|
203
205
|
manufacturer=STATE.manufacturer,
|
|
204
|
-
set_default=
|
|
206
|
+
set_default=False
|
|
205
207
|
)
|
|
206
208
|
|
|
207
209
|
set_global_context(STATE.core, STATE.device, STATE.version, STATE.device_root_fs, STATE.device_path)
|
|
@@ -89,6 +89,8 @@ class DeviceScanner:
|
|
|
89
89
|
|
|
90
90
|
return parse_device_banner(response_str)
|
|
91
91
|
|
|
92
|
+
except PermissionError:
|
|
93
|
+
raise
|
|
92
94
|
except (OSError, IOError, serial.SerialException):
|
|
93
95
|
pass
|
|
94
96
|
except ImportError:
|
|
@@ -99,11 +101,12 @@ class DeviceScanner:
|
|
|
99
101
|
return None
|
|
100
102
|
|
|
101
103
|
@staticmethod
|
|
102
|
-
def scan_serial_ports(max_workers: int = 5, exclude_ports: list = None) ->
|
|
104
|
+
def scan_serial_ports(max_workers: int = 5, exclude_ports: list = None) -> tuple:
|
|
103
105
|
from serial.tools.list_ports import comports as list_ports_comports
|
|
104
106
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
105
107
|
|
|
106
108
|
results = []
|
|
109
|
+
permission_denied = []
|
|
107
110
|
|
|
108
111
|
excluded = set()
|
|
109
112
|
if exclude_ports:
|
|
@@ -137,7 +140,7 @@ class DeviceScanner:
|
|
|
137
140
|
valid_ports.append(port)
|
|
138
141
|
|
|
139
142
|
if not valid_ports:
|
|
140
|
-
return results
|
|
143
|
+
return results, permission_denied
|
|
141
144
|
|
|
142
145
|
if _plat == "darwin":
|
|
143
146
|
per_port_timeout = 2.5
|
|
@@ -162,11 +165,14 @@ class DeviceScanner:
|
|
|
162
165
|
except TimeoutError:
|
|
163
166
|
# Port scan timed out
|
|
164
167
|
pass
|
|
168
|
+
except PermissionError:
|
|
169
|
+
# OS denied access to the port (e.g. user not in dialout/uucp group on Linux)
|
|
170
|
+
permission_denied.append(port_device)
|
|
165
171
|
except (OSError, IOError):
|
|
166
172
|
# Port access error
|
|
167
173
|
pass
|
|
168
174
|
|
|
169
|
-
return results
|
|
175
|
+
return results, permission_denied
|
|
170
176
|
|
|
171
177
|
@staticmethod
|
|
172
178
|
def is_bluetooth_port(port_info) -> bool:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import gc
|
|
2
2
|
import sys
|
|
3
|
+
import time
|
|
3
4
|
from replx.utils.exceptions import TransportError
|
|
4
5
|
|
|
5
6
|
try:
|
|
@@ -8,6 +9,32 @@ except ImportError:
|
|
|
8
9
|
raise ImportError("pyserial is required. Install with: pip install pyserial")
|
|
9
10
|
|
|
10
11
|
|
|
12
|
+
_PORT_PRESENCE_TTL = 0.5
|
|
13
|
+
_port_presence_cache: dict = {"ts": 0.0, "ports": None}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _port_currently_present(port: str) -> bool | None:
|
|
17
|
+
"""Return True/False if the OS reports ``port`` present, or None if the
|
|
18
|
+
check itself failed (caller should skip/ignore in that case)."""
|
|
19
|
+
now = time.time()
|
|
20
|
+
ports = _port_presence_cache["ports"]
|
|
21
|
+
if ports is None or (now - _port_presence_cache["ts"]) > _PORT_PRESENCE_TTL:
|
|
22
|
+
try:
|
|
23
|
+
from serial.tools.list_ports import comports
|
|
24
|
+
ports = {p.device for p in comports()}
|
|
25
|
+
except Exception:
|
|
26
|
+
return None
|
|
27
|
+
_port_presence_cache["ports"] = ports
|
|
28
|
+
_port_presence_cache["ts"] = now
|
|
29
|
+
|
|
30
|
+
if port in ports:
|
|
31
|
+
return True
|
|
32
|
+
if sys.platform == "win32":
|
|
33
|
+
needle = str(port).lower()
|
|
34
|
+
return any(str(p).lower() == needle for p in ports)
|
|
35
|
+
return False
|
|
36
|
+
|
|
37
|
+
|
|
11
38
|
class SerialTransport:
|
|
12
39
|
|
|
13
40
|
def __init__(self, port: str, baudrate: int = 115200, timeout: float = 1.0):
|
|
@@ -128,6 +155,8 @@ class SerialTransport:
|
|
|
128
155
|
try:
|
|
129
156
|
if not self._serial or not self._serial.is_open:
|
|
130
157
|
return False
|
|
158
|
+
if _port_currently_present(self.port) is False:
|
|
159
|
+
return False
|
|
131
160
|
_ = self._serial.in_waiting
|
|
132
161
|
return True
|
|
133
162
|
except serial.SerialException as e:
|
|
@@ -143,6 +172,8 @@ class SerialTransport:
|
|
|
143
172
|
def keep_alive(self) -> None:
|
|
144
173
|
if not self._serial or not self._serial.is_open:
|
|
145
174
|
raise TransportError("Serial port disconnected (device removed or cable unplugged)")
|
|
175
|
+
if _port_currently_present(self.port) is False:
|
|
176
|
+
raise TransportError("Serial port disconnected (device removed or cable unplugged)")
|
|
146
177
|
try:
|
|
147
178
|
_ = self._serial.in_waiting
|
|
148
179
|
except serial.SerialException as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: replx
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.22.2
|
|
4
4
|
Summary: replx is a fast, modern MicroPython CLI: turbo REPL, robust file sync (put/get), project install, mpy-cross integration, and smart port discovery.
|
|
5
5
|
Author-email: "chanmin.park" <devcamp@planxlab.com>
|
|
6
6
|
License-Expression: MIT
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|