[moserial] Fix hardware handshake.
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [moserial] Fix hardware handshake.
- Date: Sat, 16 Jan 2021 13:47:24 +0000 (UTC)
commit e3d933831c42b379db0b39fc2a45795fe0d0587b
Author: Mictronics <github mictronics de>
Date: Tue Apr 28 20:58:24 2020 +0200
Fix hardware handshake.
src/MainWindow.vala | 14 ++++++++------
src/SerialConnection.vala | 16 ++++++++--------
2 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 1bae248..7460f64 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -478,7 +478,6 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
string s;
s = entry.get_text ();
profile.setInputString (s);
- warning ("test");
if (!ensureConnected ()) {
return;
}
@@ -782,6 +781,10 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
incomingAsciiTextBuffer.set_text ("", 0);
outgoingHexTextBuffer.clear ();
outgoingAsciiTextBuffer.set_text ("", 0);
+ // Feedback signal status back to button.
+ bool[] state = serialConnection.getStatus ();
+ rtsButton.set_active (state[4]);
+ dtrButton.set_active (state[5]);
settingsButton.set_sensitive (false);
statusbar.pop (statusbarContext);
@@ -815,15 +818,14 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
private bool showSerialStatus () {
if (!serialConnection.isConnected ()) {
-
return true;
}
bool[] state = serialConnection.getStatus ();
- serialStatusSignals[0].set_sensitive (state[0]);
- serialStatusSignals[1].set_sensitive (state[1]);
- serialStatusSignals[2].set_sensitive (state[2]);
- serialStatusSignals[3].set_sensitive (state[3]);
+ serialStatusSignals[0].set_sensitive (state[0]); // RI
+ serialStatusSignals[1].set_sensitive (state[1]); // DSR
+ serialStatusSignals[2].set_sensitive (state[2]); // CD
+ serialStatusSignals[3].set_sensitive (state[3]); // CTS
return true;
}
diff --git a/src/SerialConnection.vala b/src/SerialConnection.vala
index 04e5af1..963b1a7 100644
--- a/src/SerialConnection.vala
+++ b/src/SerialConnection.vala
@@ -278,15 +278,15 @@ public class moserial.SerialConnection : GLib.Object {
// newtio.c_cflag |= CREAD;
// newtio.c_cc[VTIME] = 5;
- int mcs = 0;
- Posix.ioctl (m_fd, Linux.Termios.TIOCMGET, out mcs);
- mcs |= Linux.Termios.TIOCM_RTS;
- Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, out mcs);
-
if (settings.handshake == Settings.Handshake.HARDWARE || settings.handshake ==
Settings.Handshake.BOTH)
newtio.c_cflag |= Linux.Termios.CRTSCTS;
else
newtio.c_cflag &= ~Linux.Termios.CRTSCTS;
+
+ int mcs = 0;
+ Posix.ioctl (m_fd, Linux.Termios.TIOCMGET, out mcs);
+ mcs |= Linux.Termios.TIOCM_RTS | Linux.Termios.TIOCM_DTR;
+ Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, ref mcs);
}
public void controlDTR (bool y) {
@@ -297,7 +297,7 @@ public class moserial.SerialConnection : GLib.Object {
} else {
mcs &= ~Linux.Termios.TIOCM_DTR;
}
- Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, out mcs);
+ Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, ref mcs);
}
public void controlRTS (bool y) {
@@ -308,14 +308,14 @@ public class moserial.SerialConnection : GLib.Object {
} else {
mcs &= ~Linux.Termios.TIOCM_RTS;
}
- Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, out mcs);
+ Posix.ioctl (m_fd, Linux.Termios.TIOCMSET, ref mcs);
}
public bool[] getStatus () {
bool mcs[6];
int stat;
Posix.ioctl (m_fd, Linux.Termios.TIOCMGET, out stat);
- // GLib.print("stat%x\r\n",stat);
+ // GLib.print("stat %x\r\n",stat);
if ((stat & 0x080) == 0) // Linux.Termios.TIOCM_RI=0x080
mcs[0] = false;
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]