-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hi @jmct,
in one project, we use a hard fork of this library where we enable "raw mode" (reference to raw mode in man page of termios).
the code basically just differs at the point where setTerminalAttributes is called, like this:
openSerial device baudrate = do
-- ....
setTerminalAttributes fd (makeRaw termOpts `withSpeed` baudrate) Immediately
closeFd fd
h <- openFile device ReadWriteMode
hSetBuffering h NoBuffering
hSetEcho h False
return hand where makeRaw is defined like this:
-- | Disables all necessary flags for raw mode according to
-- http://man7.org/linux/man-pages/man3/termios.3.html
makeRaw :: TerminalAttributes -> TerminalAttributes
makeRaw termOpts = termOpts
-- input flags
`withoutMode` IgnoreBreak
`withoutMode` InterruptOnBreak
`withoutMode` MarkParityErrors
`withoutMode` StripHighBit
`withoutMode` MapLFtoCR
`withoutMode` IgnoreCR
`withoutMode` MapCRtoLF
`withoutMode` StartStopOutput
-- output flags
`withoutMode` ProcessOutput
-- local flags
`withoutMode` EnableEcho
`withoutMode` EchoLF
`withoutMode` ProcessInput
`withoutMode` KeyboardInterrupts
`withoutMode` ExtendedFunctions
-- control flags
`withoutMode` TwoStopBits
`withBits` 8
`withoutMode` EnableParityWhat do you think about a patch on this lib that adds some kind of openSerialRaw call or adds a parameter to openSerial for raw mode yes/no?
m1-s
Metadata
Metadata
Assignees
Labels
No labels