summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_serial.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/io_serial.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_serial.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index c9155d1..b495f39 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -5,5 +5,5 @@
#include "io_serial.h"
-IOSerial::IOSerial(const Config &config) : IOLayer(config) {
+IOSerial::IOSerial(const Profile &config) : IOLayer(config) {
m_fd = 0;
reload(config);
@@ -47,5 +47,5 @@ bool IOSerial::open() {
/* Baud rate */
- int speed = getBaud(m_baud);
+ int speed = baud(m_baud);
if (speed == -1) {
emit error(Refuse, tr("Invalid baud rate"));
@@ -58,5 +58,5 @@ bool IOSerial::open() {
m_dbits = 8;
}
-
+
/* Data bits */
switch (m_dbits) {
@@ -65,6 +65,7 @@ bool IOSerial::open() {
case 7: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS7; break;
case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break;
+ default: break;
}
-
+
/* Raw, no echo mode */
tty.c_iflag = IGNBRK;
@@ -79,5 +80,5 @@ bool IOSerial::open() {
tty.c_cflag &= ~CSTOPB;
}
-
+
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 5;
@@ -88,10 +89,10 @@ bool IOSerial::open() {
else
tty.c_iflag &= ~(IXON|IXOFF|IXANY);
-
+
if (m_flow & FlowHW)
tty.c_cflag |= CRTSCTS;
else
tty.c_cflag &= ~CRTSCTS;
-
+
/* Parity */
tty.c_cflag &= ~(PARENB | PARODD);
@@ -100,5 +101,5 @@ bool IOSerial::open() {
else if (m_parity & ParityOdd)
tty.c_cflag |= (PARENB | PARODD);
-
+
/* Set the changes */
tcsetattr(m_fd, TCSANOW, &tty);
@@ -116,5 +117,5 @@ bool IOSerial::open() {
}
-void IOSerial::reload(const Config &config) {
+void IOSerial::reload(const Profile &config) {
m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD);
@@ -125,5 +126,5 @@ void IOSerial::reload(const Config &config) {
}
-int IOSerial::getBaud(int baud) const {
+int IOSerial::baud(int baud) const {
switch (baud) {
case 300: return B300; break;