Port serial layer to pyserial; add Windows COM detection and PyInstaller spec

- serial_port.py: replace termios/fcntl/select with pyserial wrapper,
  same SerialPort interface preserved for all other modules
- workflow_serial.py: detect_serial_device() uses serial.tools.list_ports
  to enumerate COM ports; removes _fix_permissions() (not needed on Windows);
  multi-device table now shows port description
- es24n_conf.py: enable VT/ANSI colour mode on Windows 10+ via ctypes;
  update docstring for Windows edition
- requirements.txt: pyserial >= 3.5, pyinstaller >= 6.0
- es24n_conf.spec: PyInstaller single-file .exe spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 15:50:17 -04:00
parent a6a0f1b246
commit 75873dd4e0
5 changed files with 103 additions and 97 deletions

View File

@@ -1,14 +1,14 @@
#!/usr/bin/env python3
"""
ES24N IOM Network Configuration Tool
ES24N IOM Network Configuration Tool — Windows Edition
TrueNAS ES24N Expansion Shelf — Serial Configuration Utility
Based on ES24N Product Service Guide v.26011
Zero external dependencies — Python 3 standard library only.
Compatible with TrueNAS (FreeBSD) and Linux.
Requires: pyserial (pip install pyserial)
Distributed as a standalone .exe via PyInstaller.
Usage:
python3 es24n_conf.py
python3 es24n_conf.py (or run the packaged .exe)
All files in the modules/ subdirectory must be present:
ui.py, serial_port.py, models.py, redfish.py,
@@ -19,6 +19,12 @@ import os
import sys
import time
# Enable ANSI/VT colour codes on Windows 10+
if sys.platform == "win32":
import ctypes
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "modules"))
from ui import _c, C, banner, draw_box, ok, warn, prompt