diff --git a/src/ioctl-rs/debian/changelog b/src/ioctl-rs/debian/changelog index a513875..9de9ded 100644 --- a/src/ioctl-rs/debian/changelog +++ b/src/ioctl-rs/debian/changelog @@ -2,4 +2,4 @@ * Package ioctl-rs 0.2.0 from crates.io using debcargo 2.4.4 - -- Henry-Nicolas Tourneur Fri, 23 Apr 2021 19:32:54 +0000 + -- Henry-Nicolas Tourneur Fri, 07 May 2021 12:30:54 +0000 diff --git a/src/ioctl-rs/debian/patches/series b/src/ioctl-rs/debian/patches/series new file mode 100644 index 0000000..cf0332a --- /dev/null +++ b/src/ioctl-rs/debian/patches/series @@ -0,0 +1 @@ +tiocm_type.patch diff --git a/src/ioctl-rs/debian/patches/tiocm_type.patch b/src/ioctl-rs/debian/patches/tiocm_type.patch new file mode 100644 index 0000000..8afeed8 --- /dev/null +++ b/src/ioctl-rs/debian/patches/tiocm_type.patch @@ -0,0 +1,119 @@ +Author: Dorota Czaplejewicz +Forwarded: https://github.com/dcuddeback/ioctl-rs/pull/6 +Description: Use a dedicated type for TIOCM requests +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -41,8 +41,8 @@ pub fn tiocnxcl(fd: RawFd) -> io::Result + } + + /// Get the status of modem bits. +-pub fn tiocmget(fd: RawFd) -> io::Result { +- let mut bits: c_int = unsafe { mem::uninitialized() }; ++pub fn tiocmget(fd: RawFd) -> io::Result { ++ let mut bits: BitsInt = unsafe { mem::uninitialized() }; + + match unsafe { ioctl(fd, TIOCMGET, &mut bits) } { + 0 => Ok(bits), +@@ -51,7 +51,7 @@ pub fn tiocmget(fd: RawFd) -> io::Result + } + + /// Set the status of modem bits. +-pub fn tiocmset(fd: RawFd, bits: c_int) -> io::Result<()> { ++pub fn tiocmset(fd: RawFd, bits: BitsInt) -> io::Result<()> { + match unsafe { ioctl(fd, TIOCMSET, &bits) } { + 0 => Ok(()), + _ => Err(io::Error::last_os_error()) +@@ -59,7 +59,7 @@ pub fn tiocmset(fd: RawFd, bits: c_int) + } + + /// Set the indicated modem bits. +-pub fn tiocmbis(fd: RawFd, bits: c_int) -> io::Result<()> { ++pub fn tiocmbis(fd: RawFd, bits: BitsInt) -> io::Result<()> { + match unsafe { ioctl(fd, TIOCMBIS, &bits) } { + 0 => Ok(()), + _ => Err(io::Error::last_os_error()) +@@ -67,9 +67,26 @@ pub fn tiocmbis(fd: RawFd, bits: c_int) + } + + /// Clear the indicated modem bits. +-pub fn tiocmbic(fd: RawFd, bits: c_int) -> io::Result<()> { ++pub fn tiocmbic(fd: RawFd, bits: BitsInt) -> io::Result<()> { + match unsafe { ioctl(fd, TIOCMBIC, &bits) } { + 0 => Ok(()), + _ => Err(io::Error::last_os_error()) + } + } ++ ++#[cfg(test)] ++mod tests { ++ use super::*; ++ /// ++ /// Will fail to compile if types don't match. ++ #[allow(dead_code)] ++ fn compile_bits() { ++ tiocmbic(0, TIOCM_RTS).unwrap(); ++ } ++ ++ #[allow(dead_code)] ++ fn compile_get_bits() { ++ let bits = tiocmget(0).unwrap(); ++ tiocmset(0, bits).unwrap(); ++ } ++} +--- a/src/os/dragonfly.rs ++++ b/src/os/dragonfly.rs +@@ -67,6 +67,8 @@ pub const TIOCM_RNG: c_int = 0x00000080; + pub const TIOCM_RI: c_int = 0x00000080; + pub const TIOCM_DSR: c_int = 0x00000100; + ++pub type BitsInt = c_int; ++ + extern "C" { + pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; + } +--- a/src/os/freebsd.rs ++++ b/src/os/freebsd.rs +@@ -67,6 +67,8 @@ pub const TIOCM_RNG: c_int = 0x00000080; + pub const TIOCM_RI: c_int = 0x00000080; + pub const TIOCM_DSR: c_int = 0x00000100; + ++pub type BitsInt = c_int; ++ + extern "C" { + pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; + } +--- a/src/os/linux.rs ++++ b/src/os/linux.rs +@@ -115,6 +115,8 @@ pub const TIOCM_RNG: c_uint = 0x00000080 + pub const TIOCM_RI: c_uint = 0x00000080; + pub const TIOCM_DSR: c_uint = 0x00000100; + ++pub type BitsInt = c_uint; ++ + extern "C" { + pub fn ioctl(fd: c_int, request: c_uint, ...) -> c_int; + } +--- a/src/os/macos.rs ++++ b/src/os/macos.rs +@@ -76,6 +76,8 @@ pub const TIOCM_RNG: c_int = 0x00000080; + pub const TIOCM_RI: c_int = 0x00000080; + pub const TIOCM_DSR: c_int = 0x00000100; + ++pub type BitsInt = c_int; ++ + extern "C" { + pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; + } +--- a/src/os/openbsd.rs ++++ b/src/os/openbsd.rs +@@ -67,6 +67,8 @@ pub const TIOCM_RNG: c_int = 0x00000080; + pub const TIOCM_RI: c_int = 0x00000080; + pub const TIOCM_DSR: c_int = 0x00000100; + ++pub type BitsInt = c_int; ++ + extern "C" { + pub fn ioctl(fildes: c_int, request: c_ulong, ...) -> c_int; + } diff --git a/src/serial/debian/RFS b/src/serial/debian/RFS new file mode 100644 index 0000000..ccaa22e --- /dev/null +++ b/src/serial/debian/RFS @@ -0,0 +1,6 @@ +deps tree: +serial (NEW) +- serial-core (NEW) +- serial-unix (NEW) + - termios (update, no rdeps) + - ioctl-rs (NEW) diff --git a/src/serial-unix/debian/changelog b/src/serial-unix/debian/changelog index e910eb0..23c5434 100644 --- a/src/serial-unix/debian/changelog +++ b/src/serial-unix/debian/changelog @@ -2,4 +2,4 @@ * Package serial-unix 0.4.0 from crates.io using debcargo 2.4.4 - -- Henry-Nicolas Tourneur Fri, 23 Apr 2021 19:45:54 +0000 + -- Henry-Nicolas Tourneur Fri, 07 May 2021 12:47:38 +0000 diff --git a/src/serial-unix/debian/patches/fix_compile-errors.patch b/src/serial-unix/debian/patches/fix_compile-errors.patch new file mode 100644 index 0000000..2169191 --- /dev/null +++ b/src/serial-unix/debian/patches/fix_compile-errors.patch @@ -0,0 +1,34 @@ +Author: Henry-Nicolas Tourneur +Forwarded: not-needed +Description: Fix compilation errors with c_int / c_uint type incompatibilities +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/tty.rs ++++ b/src/tty.rs +@@ -10,7 +10,7 @@ use std::time::Duration; + + use std::os::unix::prelude::*; + +-use libc::{c_int, c_void, size_t}; ++use libc::{c_int, c_uint, c_void, size_t}; + + use core::{SerialDevice, SerialPortSettings}; + +@@ -85,7 +85,7 @@ impl TTYPort { + Ok(port) + } + +- fn set_pin(&mut self, pin: c_int, level: bool) -> core::Result<()> { ++ fn set_pin(&mut self, pin: c_uint, level: bool) -> core::Result<()> { + let retval = if level { + ioctl::tiocmbis(self.fd, pin) + } +@@ -99,7 +99,7 @@ impl TTYPort { + } + } + +- fn read_pin(&mut self, pin: c_int) -> core::Result { ++ fn read_pin(&mut self, pin: c_uint) -> core::Result { + match ioctl::tiocmget(self.fd) { + Ok(pins) => Ok(pins & pin != 0), + Err(err) => Err(super::error::from_io_error(err)), diff --git a/src/serial-unix/debian/patches/series b/src/serial-unix/debian/patches/series index bdddf05..81311d8 100644 --- a/src/serial-unix/debian/patches/series +++ b/src/serial-unix/debian/patches/series @@ -1 +1,2 @@ +fix_compile-errors.patch relax-deps.patch