Commit Graph

283 Commits

Author SHA1 Message Date
0254cc1efa feat: 添加测试demo
Some checks failed
test / native-os-build (macOS-latest) (push) Has been cancelled
test / native-os-build (ubuntu-latest) (push) Has been cancelled
test / native-os-build (windows-latest) (push) Has been cancelled
test / cross-os-build (freebsd amd64) (push) Has been cancelled
test / cross-os-build (linux ppc64le) (push) Has been cancelled
test / cross-os-build (openbsd 386) (push) Has been cancelled
test / cross-os-build (openbsd amd64) (push) Has been cancelled
test / cross-os-build (openbsd arm) (push) Has been cancelled
2026-03-05 10:49:33 +08:00
f10848f47f fix: 修复串口 read timeout 未生效的问题
Some checks failed
test / native-os-build (macOS-latest) (push) Has been cancelled
test / native-os-build (ubuntu-latest) (push) Has been cancelled
test / native-os-build (windows-latest) (push) Has been cancelled
test / cross-os-build (freebsd amd64) (push) Has been cancelled
test / cross-os-build (linux ppc64le) (push) Has been cancelled
test / cross-os-build (openbsd 386) (push) Has been cancelled
test / cross-os-build (openbsd amd64) (push) Has been cancelled
test / cross-os-build (openbsd arm) (push) Has been cancelled
- 将串口文件描述符设置为非阻塞模式,确保 read() 不会阻塞
- 修改 VMIN 从 1 改为 0,让 select() 正确控制读取超时
- 添加 Timeout 错误代码,超时时正确返回错误而不是 (0, nil)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
v1.6.6
2026-03-05 10:47:17 +08:00
b3711b62ad 添加git提交规范:提交信息必须包含中文说明
Some checks failed
test / native-os-build (macOS-latest) (push) Has been cancelled
test / native-os-build (ubuntu-latest) (push) Has been cancelled
test / native-os-build (windows-latest) (push) Has been cancelled
test / cross-os-build (freebsd amd64) (push) Has been cancelled
test / cross-os-build (linux ppc64le) (push) Has been cancelled
test / cross-os-build (openbsd 386) (push) Has been cancelled
test / cross-os-build (openbsd amd64) (push) Has been cancelled
test / cross-os-build (openbsd arm) (push) Has been cancelled
v1.6.5
2026-03-03 10:36:03 +08:00
ff4afcdddb Update .gitignore to include .claude/settings.local.json 2026-03-03 10:33:49 +08:00
27af1097f9 Add test program to verify serial port close deadlock fix 2026-03-03 10:33:32 +08:00
80d2794531 Add .gitignore file for Go project 2026-03-03 10:30:52 +08:00
070b7685d5 Linux系统下串口Close相关实现的深度优化
1. 优化了Close方法的资源释放顺序,先释放独占访问权,再关闭实际的端口句柄
2. 添加了句柄有效性检查,避免对无效句柄进行操作
3. 确保所有资源都能正确清理,包括句柄和信号管道
4. 改进了错误处理机制,确保只返回第一个错误
5. 为所有方法添加了端口状态检查,确保在端口关闭后立即返回PortClosed错误
6. 统一了错误处理格式,使用PortError类型包装系统错误
7. 优化了Read方法的错误处理和超时逻辑
8. 为Write、Break、SetMode、SetDTR、SetRTS和GetModemStatusBits方法添加了端口状态检查
2026-03-03 10:27:03 +08:00
Cristian Maglie
f12391c01f Merge pull request #205 from WarningImHack3r/fix-serial-getters
Some checks failed
test / native-os-build (macOS-latest) (push) Has been cancelled
test / native-os-build (ubuntu-latest) (push) Has been cancelled
test / native-os-build (windows-latest) (push) Has been cancelled
test / cross-os-build (freebsd amd64) (push) Has been cancelled
test / cross-os-build (linux ppc64le) (push) Has been cancelled
test / cross-os-build (openbsd 386) (push) Has been cancelled
test / cross-os-build (openbsd amd64) (push) Has been cancelled
test / cross-os-build (openbsd arm) (push) Has been cancelled
fix: incorrect masks for modem status bits on Windows
2025-05-19 15:36:16 +02:00
Cristian Maglie
8f447ebc07 Make win32 internal constants private. 2025-05-19 15:31:36 +02:00
WarningImHack3r
20a47944cf refactor: rename variables to match docs 2025-05-08 13:17:50 +02:00
WarningImHack3r
9710c814f6 fix: incorrect masks for modem status bits on Windows 2025-05-07 20:44:25 +02:00
Cristian Maglie
f0e4a45720 Merge pull request #202 from ctarsjp/win-port-enum
Fix (non-detailed) port enumeration on Windows
v1.6.4
2025-03-28 15:54:19 +01:00
Stepan
bcb0408701 Windows: added a check for \\.\ prefix 2025-03-28 16:42:18 +09:00
Stepan
5069d66aa2 Windows: fixed port enumeration 2025-03-28 16:28:13 +09:00
Cristian Maglie
3449d2e7f6 Merge pull request #200 from cmaglie/CH340_hack
Hack to workaround misbehaving CH340 drivers on Windows
v1.6.3
2025-03-17 17:24:34 +01:00
Cristian Maglie
1ff9b6fa9a If the timeout is set to NoTimeout, make Read wait forever.
Otherwise the maximul allowed timeout is 0x7FFFFFFF milliseconds,
equivalent to about 24.85 days.
This patch will make a transparent repeated read in case this long
timeout should ever happen.
2025-03-17 10:57:21 +01:00
Cristian Maglie
7dc6297645 Merge pull request #195 from Dirk007/fix/nilErrorReport
Report the actual error instead of nil...
2025-03-13 01:00:39 +01:00
Cristian Maglie
fb4b111d50 Hack for CH340 support 2025-03-12 20:50:56 +01:00
Dirk007
b7483e31a7 Report the actual error instead of nil 2024-09-07 13:26:01 +02:00
Cristian Maglie
0996f840dd Merge pull request #187 from twpayne/sys-windows
Use Windows serial comm functions from golang.org/x/sys/windows
2024-06-25 23:56:14 +02:00
Cristian Maglie
f5a4685ea0 Fixed examples for docs 2024-06-25 23:52:38 +02:00
Tom Payne
56ac2d4e76 Restore check for no detected serial ports on Windows 2024-06-25 11:02:05 +02:00
Tom Payne
1c72447e64 Fix typos
Co-authored-by: Cristian Maglie <c.maglie@bug.st>
2024-06-25 10:48:18 +02:00
Tom Payne
45e996e1b0 Use Windows serial comm functions from golang.org/x/sys/windows 2024-06-24 18:28:26 +02:00
Andreas Deininger
0b7848559a Fix typos (#183)
Co-authored-by: Cristian Maglie <c.maglie@bug.st>
2024-06-24 17:33:18 +02:00
Cristian Maglie
c18d387887 Merge pull request #184 from deining/gofmt
Go-format source code: fix warning
2024-06-24 17:26:52 +02:00
Cristian Maglie
c768d77847 Merge pull request #188 from twpayne/doc-fixes
Fixed minor documentation typos
2024-06-24 17:25:22 +02:00
Andreas Deininger
1282f62c6e Bump GitHub workflow actions to latest versions (#185)
* Bump GitHub workflow actions to latest versions

* Fixed typo

---------

Co-authored-by: Cristian Maglie <c.maglie@bug.st>
2024-06-24 17:24:35 +02:00
Cristian Maglie
4f7d935be3 Merge pull request #186 from AndreRenaud/enumerator-build
Workflows: Use CGO_ENABLED=1 for MacOS
2024-06-24 17:13:45 +02:00
Andre Renaud
03c961bc8a Workflows: Use CGO_ENABLED=1 for MacOS
Also enable explicit ARM64 builds
2024-05-28 09:27:43 +12:00
Andreas Deininger
671075c6ac Go-format source code 2024-04-01 16:04:53 +02:00
Tom Payne
bac809c5a1 Fixed minor documentation typos 2024-03-18 22:25:55 +01:00
Cristian Maglie
0925f99089 Merge pull request #176 from paralin/fix-wasm
fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1
2024-03-11 19:03:49 +01:00
Christian Stewart
42bc112d18 fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1
Fixes build errors:

GOOS=js GOARCH=wasm go build
GOOS=wasip1 GOARCH=wasm go build

Signed-off-by: Christian Stewart <christian@aperture.us>
2024-03-01 14:26:58 -08:00
Cristian Maglie
259bdeb6c7 Fixed typo 2024-02-20 15:57:58 +01:00
Cristian Maglie
572f392ca9 Updated license year 2024-02-20 15:27:44 +01:00
Cristian Maglie
14e5ea68ce Precompile port-filter regexp 2024-02-20 15:24:37 +01:00
Cristian Maglie
bcd8695df4 Removed deprecated package io/ioutil 2024-02-20 15:13:12 +01:00
Cristian Maglie
92703ecb02 Improved issue template message 2024-02-20 09:55:49 +01:00
Cristian Maglie
674fbae95a Upgraded dependencies 2024-02-20 09:52:27 +01:00
Cristian Maglie
2aa105e32e Improved issue template message 2024-02-20 09:51:06 +01:00
Cristian Maglie
7f490f208a Added issues templates 2024-02-18 19:33:23 +01:00
Cristian Maglie
9a2045a5ff Merge pull request #174 from bugst/windows-multi-set-rtscts
windows: Avoid double-set of communication parameters on Open
v1.6.2
2024-02-16 14:29:21 +01:00
Cristian Maglie
8b563a8428 Merge pull request #175 from cmaglie/improve_error_messages
Improved error messages
2024-02-16 14:23:34 +01:00
Cristian Maglie
9aae282f09 Improved error messages 2024-02-16 14:17:53 +01:00
Cristian Maglie
1d3c0099c3 Merge pull request #173 from jes/master
unix: nativeOpen: always close the port on errors
2024-02-16 13:51:41 +01:00
Cristian Maglie
c414e4f55c windows: Avoid double-set of communication parameters on Open 2024-02-16 13:32:43 +01:00
James Stanley
0f730e491f unix: nativeOpen: always close the port on errors 2024-02-11 21:08:52 +00:00
Cristian Maglie
8a31fcbd9b Merge pull request #165 from cmaglie/fix_darwin_enumerator
Fix some rare MacOSX USB port enumerator failures
2023-09-14 15:31:58 +02:00
Cristian Maglie
f3f01227e9 Fix some rare IOServiceGetMatchingServices failure on MacOSX
We had reports of users always getting:

  IOServiceGetMatchingServices failed, data changed while iterating

The issue seems related to the function getMatchingServices that
returns an always-invalid iterator even if there are no actual services.

This is a workaround for this issue.
2023-09-14 15:24:41 +02:00