Skip to content

Commit

Permalink
Handle DataBits in linux
Browse files Browse the repository at this point in the history
  • Loading branch information
rasky committed Sep 10, 2015
1 parent 1e69fff commit cd9a6de
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions serial/open_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ func makeTermios2(options OpenOptions) (*termios2, error) {
return nil, errors.New("invalid setting for ParityMode")
}

switch options.DataBits {
case 5:
t2.c_cflag |= syscall.CS5
case 6:
t2.c_cflag |= syscall.CS6
case 7:
t2.c_cflag |= syscall.CS7
case 8:
t2.c_cflag |= syscall.CS8
default:
return nil, errors.New("invalid setting for DataBits")
}

return t2, nil
}

Expand Down

0 comments on commit cd9a6de

Please sign in to comment.