From 093b30d819ccefdfc4cee3f902828ef48b91b2ce Mon Sep 17 00:00:00 2001 From: sina Date: Wed, 1 Mar 2023 10:47:02 +0330 Subject: serial fd --- ports.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports.go b/ports.go index 2742e60..ddf2e85 100644 --- a/ports.go +++ b/ports.go @@ -84,6 +84,9 @@ func (p *Port) Buffered() (int, error) { return unix.IoctlGetInt(int(p.f.Fd()), unix.TIOCOUTQ) } +// Expose serial fd to use in some special cases, ioctl etc... +func (p *Port) File() *os.File { return p.f } + func timeout(d time.Duration) (byte, byte) { if d > 0x0 { t := math.Min(math.Max(float64(d.Nanoseconds()/1e6/100), 0x01), 0xff) -- cgit v1.2.3