aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsina <sina@snix.ir>2023-03-01 10:47:02 +0330
committersina <sina@snix.ir>2023-03-01 10:47:02 +0330
commit093b30d819ccefdfc4cee3f902828ef48b91b2ce (patch)
tree8f69f60be7e8136342db129df75a1abb245616d8
parent18c771ef6a99911570d8618db76d624ecd2a1ab0 (diff)
serial fd
-rw-r--r--ports.go3
1 files changed, 3 insertions, 0 deletions
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)

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR