You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write must return a non-nil error if it returns n < len(p).
The docs (doc.go) indicate that serial.Port implements the io.Writer interface:
The port object implements the io.ReadWriteCloser interface, so we can use
the usual Read, Write and Close functions to send and receive data from the
serial port...
However, I have seen instances where serial.Port.Write() reports success after a partial write. It seems the unix implementation forwards the data to the write syscall, but the syscall does not provide the same guarantee as io.Writer.
To reproduce
It varies by hardware/driver, but the steps would just be to open a port and write lots of data.
Please double-check that you have reported each of the following
before submitting the issue.
I've provided the FULL source code that causes the problem
I've provided all the actions required to reproduce the problem
Expected behavior
Write() should either write the entire buffer and return err=nil, or it should return an error.
Fixesbugst#191.
Change unix port.Write() implementation to match io.Writer requirement:
> Write must return a non-nil error if it returns n < len(p)
Keep executing write syscall until failure or entire buffer is written.
Fixesbugst#191.
Change unix port.Write() implementation to match io.Writer requirement:
> Write must return a non-nil error if it returns n < len(p)
Keep executing write syscall until failure or entire buffer is written.
Fixesbugst#191.
Change unix port.Write() implementation to match io.Writer requirement:
> Write must return a non-nil error if it returns n < len(p)
Keep executing write syscall until failure or entire buffer is written.
richyo-work
pushed a commit
to richyo-work/go-serial
that referenced
this issue
Sep 16, 2024
Fixesbugst#191.
Change unix port.Write() implementation to match io.Writer requirement:
> Write must return a non-nil error if it returns n < len(p)
Keep executing write syscall until failure or entire buffer is written.
Describe the problem
(see #192)
From the io.Writer GoDoc:
The docs (
doc.go
) indicate thatserial.Port
implements theio.Writer
interface:However, I have seen instances where
serial.Port.Write()
reports success after a partial write. It seems the unix implementation forwards the data to the write syscall, but the syscall does not provide the same guarantee as io.Writer.To reproduce
It varies by hardware/driver, but the steps would just be to open a port and write lots of data.
Please double-check that you have reported each of the following
before submitting the issue.
Expected behavior
Write()
should either write the entire buffer and return err=nil, or it should return an error.Operating system and version
Linux, seen on multiple versions
Please describe your hardware setup
No response
Additional context
No response
Issue checklist
The text was updated successfully, but these errors were encountered: