Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0f730e4
unix: nativeOpen: always close the port on errors
jes Feb 11, 2024
c414e4f
windows: Avoid double-set of communication parameters on Open
cmaglie Feb 16, 2024
1d3c009
Merge pull request #173 from jes/master
cmaglie Feb 16, 2024
9aae282
Improved error messages
cmaglie Feb 16, 2024
8b563a8
Merge pull request #175 from cmaglie/improve_error_messages
cmaglie Feb 16, 2024
9a2045a
Merge pull request #174 from bugst/windows-multi-set-rtscts
cmaglie Feb 16, 2024
7f490f2
Added issues templates
cmaglie Feb 18, 2024
2aa105e
Improved issue template message
cmaglie Feb 20, 2024
674fbae
Upgraded dependencies
cmaglie Feb 20, 2024
92703ec
Improved issue template message
cmaglie Feb 20, 2024
bcd8695
Removed deprecated package io/ioutil
cmaglie Feb 20, 2024
14e5ea6
Precompile port-filter regexp
cmaglie Feb 20, 2024
572f392
Updated license year
cmaglie Feb 20, 2024
259bdeb
Fixed typo
cmaglie Feb 20, 2024
42bc112
fix: add shims for GOARCH=wasm with GOOS=js and GOOS=wasip1
paralin Feb 20, 2024
0925f99
Merge pull request #176 from paralin/fix-wasm
cmaglie Mar 11, 2024
bac809c
Fixed minor documentation typos
twpayne Mar 18, 2024
671075c
Go-format source code
deining Apr 1, 2024
03c961b
Workflows: Use CGO_ENABLED=1 for MacOS
AndreRenaud May 27, 2024
4f7d935
Merge pull request #186 from AndreRenaud/enumerator-build
cmaglie Jun 24, 2024
1282f62
Bump GitHub workflow actions to latest versions (#185)
deining Jun 24, 2024
c768d77
Merge pull request #188 from twpayne/doc-fixes
cmaglie Jun 24, 2024
c18d387
Merge pull request #184 from deining/gofmt
cmaglie Jun 24, 2024
0b78485
Fix typos (#183)
deining Jun 24, 2024
45e996e
Use Windows serial comm functions from golang.org/x/sys/windows
twpayne Apr 9, 2024
1c72447
Fix typos
twpayne Jun 25, 2024
56ac2d4
Restore check for no detected serial ports on Windows
twpayne Jun 25, 2024
f5a4685
Fixed examples for docs
cmaglie Jun 25, 2024
0996f84
Merge pull request #187 from twpayne/sys-windows
cmaglie Jun 25, 2024
b7483e3
Report the actual error instead of nil
Dirk007 Sep 7, 2024
fb4b111
Hack for CH340 support
cmaglie Mar 12, 2025
7dc6297
Merge pull request #195 from Dirk007/fix/nilErrorReport
cmaglie Mar 13, 2025
1ff9b6f
If the timeout is set to NoTimeout, make Read wait forever.
cmaglie Mar 12, 2025
3449d2e
Merge pull request #200 from cmaglie/CH340_hack
cmaglie Mar 17, 2025
5069d66
Windows: fixed port enumeration
ctarsjp Mar 28, 2025
bcb0408
Windows: added a check for \\.\ prefix
ctarsjp Mar 28, 2025
f0e4a45
Merge pull request #202 from ctarsjp/win-port-enum
cmaglie Mar 28, 2025
9710c81
fix: incorrect masks for modem status bits on Windows
WarningImHack3r May 7, 2025
20a4794
refactor: rename variables to match docs
WarningImHack3r May 8, 2025
8f447eb
Make win32 internal constants private.
cmaglie May 19, 2025
f12391c
Merge pull request #205 from WarningImHack3r/fix-serial-getters
cmaglie May 19, 2025
4568452
modify change import path (to refer to self-package
aetl-ksanagi Nov 30, 2023
86c53fd
modify enable RS485 settings (only linux)
aetl-ksanagi Nov 30, 2023
1ba2fd8
update import path and env files
aetl-ksanagi Dec 1, 2023
b0c4f4b
Merge branch 'master' into feat/upstream
gkuga Aug 31, 2025
4032581
update go.sum
gkuga Aug 31, 2025
53f15d4
update test.yml
gkuga Aug 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/platform-dependent/bug-report.yml
# See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

name: Bug report
description: Report a problem with the code or documentation in this repository.
labels:
- bug
body:
- type: textarea
id: description
attributes:
label: Describe the problem
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: To reproduce
description: |
Provide the specific set of steps we can follow to reproduce the
problem in particular the exact golang source code you used.
validations:
required: true
- type: checkboxes
id: checklist-reproduce
attributes:
label: |
Please double-check that you have reported each of the following
before submitting the issue.
options:
- label: I've provided the FULL source code that causes the problem
required: true
- label: I've provided all the actions required to reproduce the problem
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: |
What would you expect to happen after following those instructions?
validations:
required: true
- type: input
id: os
attributes:
label: Operating system and version
description: |
Which operating system(s) version are you using on your computer?
validations:
required: true
- type: textarea
id: boards
attributes:
label: Please describe your hardware setup
description: |
Arduino boards, USB dongles, hubs or embedded devices you are using and how they
are connected together.
- type: textarea
id: additional
attributes:
label: Additional context
description: |
Add here any additional information that you think might be relevant to
the problem.
validations:
required: false
- type: checkboxes
id: checklist
attributes:
label: Issue checklist
description: |
Please double-check that you have done each of the following things before
submitting the issue.
options:
- label: I searched for previous requests in [the issue tracker](https://github.com/bugst/go-serial/issues)
required: true
- label: My request contains all necessary details
required: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/issue-templates/forms/platform-dependent/feature-request.yml
# See: https://docs.github.com/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

name: Feature request
description: Suggest an enhancement to this project.
labels:
- "type: enhancement"
body:
- type: textarea
id: description
attributes:
label: Describe the new feature or change suggestion
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional context
description: Add any additional information about the feature request here.
- type: checkboxes
id: checklist
attributes:
label: Issue checklist
description: Please double-check that you have done each of the following things before submitting the issue.
options:
- label: I searched for previous requests in [the issue tracker](https://github.com/bugst/go-serial/issues)
required: true
- label: My request contains all necessary details
required: true
34 changes: 22 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ jobs:
native-os-build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.17"
- name: Build native
go-version: "1.22"
- name: Setup CGO Environment
run: |
if [ ${{ matrix.os }} == 'macOS-latest' ] ; then
echo "CGO_ENABLED=1" >> "$GITHUB_ENV"
fi
shell: bash
- name: Build AMD64
run: GOARCH=amd64 go build -v ./...
shell: bash
- name: Build ARM64
run: GOARCH=arm64 go build -v ./...
shell: bash
- name: Install socat
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install socat
Expand All @@ -42,19 +52,19 @@ jobs:
strategy:
matrix:
go-os-pairs:
- "freebsd amd64"
- "openbsd amd64"
- "openbsd 386"
- "openbsd arm"
# - "freebsd amd64"
# - "openbsd amd64"
# - "openbsd 386"
# - "openbsd arm"
- "linux ppc64le"

runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.17"
go-version: "1.22"
- name: Cross-build
run: |
set ${{ matrix.go-os-pairs }}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Copyright (c) 2014-2023, Cristian Maglie.
Copyright (c) 2014-2024, Cristian Maglie.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

# go.bug.st/serial

A cross-platform serial library for go-lang.
A cross-platform serial port library for Go.

## Documentation and examples

See the godoc here: https://godoc.org/go.bug.st/serial
See the package documentation here: https://pkg.go.dev/go.bug.st/serial

## go.mod transition

This library now support `go.mod` with the import `go.bug.st/serial`.
This library supports `go.mod` with the import `go.bug.st/serial`.

If you came from the pre-`go.mod` era please update your import paths from `go.bug.st/serial.v1` to `go.bug.st/serial` to receive new updates. Anyway, the latest `v1` release should still be avaiable using the old import.
If you came from the pre-`go.mod` era please update your import paths from `go.bug.st/serial.v1` to `go.bug.st/serial` to receive updates. The latest `v1` release is still available using the old import path.

## Credits

:sparkles: Thanks to all awesome [contributors]! :sparkles:

## License

The software is release under a [BSD 3-clause license]
This software is released under the [BSD 3-clause license].

[contributors]: https://github.com/bugst/go-serial/graphs/contributors
[BSD 3-clause license]: https://github.com/bugst/go-serial/blob/master/LICENSE
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/enumerator.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/example_getdetailedportlist_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/usb_darwin.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/usb_freebsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/usb_linux.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion enumerator/usb_openbsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
11 changes: 11 additions & 0 deletions enumerator/usb_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

package enumerator

func nativeGetDetailedPortsList() ([]*PortDetails, error) {
return nil, &PortEnumerationError{}
}
4 changes: 2 additions & 2 deletions enumerator/usb_windows.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down Expand Up @@ -98,7 +98,7 @@ const (
spdrpUpperFilters = 0x00000011 // UpperFilters = R/W
spdrpLowerFilters = 0x00000012 // LowerFilters = R/W
spdrpBusTypeGUID = 0x00000013 // BusTypeGUID = R
spdrpLegactBusType = 0x00000014 // LegacyBusType = R
spdrpLegacyBusType = 0x00000014 // LegacyBusType = R
spdrpBusNumber = 0x00000015 // BusNumber = R
spdrpEnumeratorName = 0x00000016 // Enumerator Name = R
spdrpSecurity = 0x00000017 // Security = R/W, binary form
Expand Down
2 changes: 1 addition & 1 deletion enumerator/usb_windows_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
15 changes: 15 additions & 0 deletions enumerator_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

package serial

import (
"errors"
)

func nativeGetPortsList() ([]string, error) {
return nil, errors.New("nativeGetPortsList is not supported on wasm")
}
2 changes: 1 addition & 1 deletion example_getportlist_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
4 changes: 2 additions & 2 deletions example_modem_bits_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand All @@ -14,7 +14,7 @@ import (
"github.com/aeterlink-dev/serial"
)

func ExampleGetSetModemBits() {
func ExamplePort_GetModemStatusBits() {
// Open the first serial port detected at 9600bps N81
mode := &serial.Mode{
BaudRate: 9600,
Expand Down
4 changes: 2 additions & 2 deletions example_serialport_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand All @@ -13,7 +13,7 @@ import (
"github.com/aeterlink-dev/serial"
)

func ExampleSerialPort_SetMode() {
func ExamplePort_SetMode() {
port, err := serial.Open("/dev/ttyACM0", &serial.Mode{})
if err != nil {
log.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
2 changes: 1 addition & 1 deletion portlist/portlist.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
4 changes: 2 additions & 2 deletions serial.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down Expand Up @@ -164,7 +164,7 @@ const (
PortNotFound
// InvalidSerialPort the requested port is not a serial port
InvalidSerialPort
// PermissionDenied the user doesn't have enough priviledges
// PermissionDenied the user doesn't have enough privileges
PermissionDenied
// InvalidSpeed the requested speed is not valid or not supported
InvalidSpeed
Expand Down
2 changes: 1 addition & 1 deletion serial_bsd.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2014-2023 Cristian Maglie. All rights reserved.
// Copyright 2014-2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
Expand Down
Loading