Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Untested, byt now compiles
Only set fields which libc defines
  • Loading branch information
ringtailsoftware committed Dec 13, 2024
1 parent 5992b23 commit 2db3090
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/serial.zig
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,12 @@ pub fn configureSerialPort(port: std.fs.File, config: SerialConfig) !void {

// these are where they diverge
if (builtin.os.tag == .linux) {
settings.cflag.CMSPAR = config.parity == .mark;
settings.cflag.CRTSCTS = config.handshake == .hardware;
if (@hasField(std.c.tc_cflag_t, "CMSPAR")) {
settings.cflag.CMSPAR = config.parity == .mark;
}
if (@hasField(std.c.tc_cflag_t, "CRTSCTS")) {
settings.cflag.CRTSCTS = config.handshake == .hardware;
}
// settings.cflag.ADDRB = false;
// settings.iflag.IUCLC = false;

Expand Down

0 comments on commit 2db3090

Please sign in to comment.