Skip to content

Commit 78ce86e

Browse files
committed
Add cfmakeraw/cfsetspeed
1 parent cb1c915 commit 78ce86e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/sys/termios.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ mod ffi {
2222
extern {
2323
pub fn cfgetispeed(termios: *const Termios) -> speed_t;
2424
pub fn cfgetospeed(termios: *const Termios) -> speed_t;
25+
pub fn cfmakeraw(termios: *mut Termios);
26+
pub fn cfsetspeed(termios: *mut Termios, speed: speed_t) -> c_int;
2527
pub fn cfsetispeed(termios: *mut Termios, speed: speed_t) -> c_int;
2628
pub fn cfsetospeed(termios: *mut Termios, speed: speed_t) -> c_int;
2729
pub fn tcgetattr(fd: c_int, termios: *mut Termios) -> c_int;
@@ -599,6 +601,18 @@ pub fn cfgetospeed(termios: &Termios) -> BaudRate {
599601
}
600602
}
601603

604+
pub fn cfmakeraw(termios: &mut Termios) {
605+
unsafe {
606+
ffi::cfmakeraw(termios);
607+
}
608+
}
609+
610+
pub fn cfsetspeed(termios: &mut Termios, baud: BaudRate) -> Result<()> {
611+
Errno::result(unsafe {
612+
ffi::cfsetspeed(termios, baud as speed_t)
613+
}).map(drop)
614+
}
615+
602616
pub fn cfsetispeed(termios: &mut Termios, baud: BaudRate) -> Result<()> {
603617
Errno::result(unsafe {
604618
ffi::cfsetispeed(termios, baud as speed_t)

0 commit comments

Comments
 (0)