Skip to content

feat(serial-transport): USB Serial#332

Closed
hakueon wants to merge 9 commits into
scratchfoundation:developfrom
aluxrobot:feature/serial-transport
Closed

feat(serial-transport): USB Serial#332
hakueon wants to merge 9 commits into
scratchfoundation:developfrom
aluxrobot:feature/serial-transport

Conversation

@hakueon
Copy link
Copy Markdown

@hakueon hakueon commented May 22, 2026

개요

Serial Transport 기능을 구현하여 CH340 및 CDC 호환 USB 직렬 장치를 지원합니다. 동시에 Alux Scratch Link로 재브랜딩하여 기존 scratch-link와 병행 설치 가능하도록 하고, 개발 환경 문서화를 완성했습니다.


주요 변경 사항

1. Serial Transport 구현

  • /scratch/serial JSON-RPC 엔드포인트 추가 (포트 20211)
  • CH340 (VID 0x1A86 / PID 0x7523) WMI 기반 열거 및 자동 탐지
  • CDC 호환 장치도 동일 경로로 지원
  • SerialSession (공통 인터페이스), WinSerialPortEnumerator, WinSerialSession 구현
  • 동기 SerialPort.Read + 500ms ReadTimeout으로 DTR/RTS 토글 시 발생하는 ERROR_OPERATION_ABORTED 회피
  • DTR/RtsEnable을 명시적으로 낮음으로 설정 (펌웨어 리셋 신호 방지)

2. Alux Scratch Link 재브랜딩

  • 어셈블리 메타데이터, MSIX 매니페스트, 트레이 UI 업데이트
  • 아이콘 자산 전체 변경 및 brand/build_icons.py 추가
  • ScratchVersion.targets에 GitInfo 태그 부재 시 기본값 1.0.0 설정
  • 사용자가 기존 scratch-link와 구분할 수 있도록 이진 파일 명확화

3. 문서 정리 및 개발 가이드

  • Serial Transport 설계 문서를 외부 documents/ 폴더로 이관 (리포지토리 간 병행 편집 용이)
  • README.md를 Alux Scratch Link 포크용으로 재작성 (AGPL-3.0 귀속 명시, Serial transport 및 포트 20211 설명)
  • Windows Visual Studio 2026 개발 환경 설정 가이드 추가 (워크로드 이름, .NET 6 SDK / Windows App Runtime 1.3 수동 설치, 시작 프로젝트 설정)

4. 개발 환경 설정

  • Visual Studio 업그레이드 아티팩트 (UpgradeLog*.htm, _UpgradeReport_Files/, Backup*/)를 gitignore에 추가

hakueon and others added 9 commits May 22, 2026 12:36
Introduce design documents for a new USB Serial transport extension
on scratch-link 2.x. SerialTransport.md describes the server side:
a /scratch/serial JSON-RPC endpoint on ws://localhost:20111, targeting
CH340 (VID 0x1A86 / PID 0x7523) on Windows first via
System.IO.Ports.SerialPort and WMI-based VID/PID enumeration.
scratch-link-fork-plan.md is the aluxcoding-scratch client-side
counterpart aligned to the same wire contract.

Uses Serial-specific RPC vocabulary (serialDidReceiveData,
serialDidDisconnect, startReading/stopReading) so callers cannot
confuse Serial events with BLE or BT events.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors the BLE/BT session pattern with a /scratch/serial JSON-RPC
endpoint. CH340 (VID 0x1A86 / PID 0x7523) is first-class via WMI-based
VID/PID enumeration; other CDC devices work through the same path with
appropriate discovery filters.

Why a separate listener port (20211): this fork is meant to coexist
with the stock scratch-link on user machines (e.g. existing Scratch 3.0
users), so the default 20110/20111 cannot be reused.

Why sync SerialPort.Read on a Task-Run thread instead of
BaseStream.ReadAsync: .NET 6's SerialStream does not override the
async read overloads in a way that survives CH340's open-time DTR/RTS
toggling; the first ReadAsync reliably throws ERROR_OPERATION_ABORTED
even with the cancellation token unbound. Synchronous Read with a
500ms ReadTimeout + TimeoutException-as-loop-tick matches the working
test_cs reference and lets shutdown be observed via the CTS.

DtrEnable/RtsEnable are pinned low explicitly because some firmware
(codetinker on CH340) treats DTR/RTS transitions as reset signals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sets fork identity across assembly/package metadata, manifests, tray
UI, and icon assets so users can distinguish this binary from the
stock scratch-link they may have installed in parallel (see the port
20211 split in the Serial transport commit).

ScratchVersion.targets gains a floor of 1.0.0 when GitInfo finds no
semver tag, so an untagged build ships as "Alux Scratch Link 1.0.0.x"
instead of "0.0.x". Real releases are still cut by tagging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
SerialTransport.md and scratch-link-fork-plan.md moved to a sibling
documents/ folder outside this repo so the fork's design notes can be
edited alongside the related client-side work without churning this
tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
UpgradeLog*.htm, _UpgradeReport_Files/, and Backup*/ are produced by
VS's project upgrade flow and are IDE-local — they should not enter
the repo when someone happens to open the solution after a toolchain
bump.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds brand/alux-l.svg as the source of truth for app/tray/MSIX icons,
plus brand/build_icons.py to regenerate them. Generated files are
already committed; the script only needs to run when the SVG changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Rebrands the title and removes upstream-only content (macOS/Safari,
semantic-release, CFBundle notes). Adds a fork notice with the AGPL-3.0
attribution to scratchfoundation/scratch-link, documents the Serial
transport and the coexistence port (20211), and points to
brand/build_icons.py for icon regeneration. Translated to Korean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Captures the VS 2026-specific workload names, the missing .NET 6 SDK
and Windows App Runtime 1.3 manual installs, and the startup-project
gotcha (scratch-link-win, not the wapproj) that causes MddBootstrap
to fail on F5.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces brand/alux-l.svg with brand/labs-l.svg as the icon source of
truth and regenerates all derived ICO/PNG assets. Wrong source file
was committed earlier.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@hakueon hakueon closed this May 22, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
@hakueon hakueon changed the title feat(serial-transport): USB Serial 장치 지원 추가 및 포크 재브랜딩 feat(serial-transport): USB Serial May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant