summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-14 20:36:48 (UTC)
committer zecke <zecke>2002-10-14 20:36:48 (UTC)
commit8140420efa133ea59310d3f8de721950fd1d13af (patch) (unidiff)
tree9279c8e786f1a4476b598f112fd0a8541355d1ba
parent0547ecc794209a0824fd7662e434706ac625dbb2 (diff)
downloadopie-8140420efa133ea59310d3f8de721950fd1d13af.zip
opie-8140420efa133ea59310d3f8de721950fd1d13af.tar.gz
opie-8140420efa133ea59310d3f8de721950fd1d13af.tar.bz2
the BAud Value is called Speed not baud
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/io_serial.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index 4129d64..03f1b1a 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -84,101 +84,102 @@ bool IOSerial::open() {
84 if (m_sbits == 2) { 84 if (m_sbits == 2) {
85 tty.c_cflag |= CSTOPB; 85 tty.c_cflag |= CSTOPB;
86 } else { 86 } else {
87 tty.c_cflag &= ~CSTOPB; 87 tty.c_cflag &= ~CSTOPB;
88 } 88 }
89 89
90 tty.c_cc[VMIN] = 1; 90 tty.c_cc[VMIN] = 1;
91 tty.c_cc[VTIME] = 5; 91 tty.c_cc[VTIME] = 5;
92 92
93 /* Flow control */ 93 /* Flow control */
94 if (m_flow & FlowSW) 94 if (m_flow & FlowSW)
95 tty.c_iflag |= IXON | IXOFF; 95 tty.c_iflag |= IXON | IXOFF;
96 else 96 else
97 tty.c_iflag &= ~(IXON|IXOFF|IXANY); 97 tty.c_iflag &= ~(IXON|IXOFF|IXANY);
98 98
99 if (m_flow & FlowHW) 99 if (m_flow & FlowHW)
100 tty.c_cflag |= CRTSCTS; 100 tty.c_cflag |= CRTSCTS;
101 else 101 else
102 tty.c_cflag &= ~CRTSCTS; 102 tty.c_cflag &= ~CRTSCTS;
103 103
104 /* Parity */ 104 /* Parity */
105 tty.c_cflag &= ~(PARENB | PARODD); 105 tty.c_cflag &= ~(PARENB | PARODD);
106 if (m_parity & ParityEven) 106 if (m_parity & ParityEven)
107 tty.c_cflag |= PARENB; 107 tty.c_cflag |= PARENB;
108 else if (m_parity & ParityOdd) 108 else if (m_parity & ParityOdd)
109 tty.c_cflag |= (PARENB | PARODD); 109 tty.c_cflag |= (PARENB | PARODD);
110 110
111 /* Set the changes */ 111 /* Set the changes */
112 tcsetattr(m_fd, TCSANOW, &tty); 112 tcsetattr(m_fd, TCSANOW, &tty);
113 113
114 /* Notifications on read & errors */ 114 /* Notifications on read & errors */
115 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this); 115 m_read = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
116 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this); 116 m_error = new QSocketNotifier(m_fd, QSocketNotifier::Exception, this);
117 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); 117 connect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
118 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); 118 connect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
119 return TRUE; 119 return TRUE;
120 } else { 120 } else {
121 qWarning(" already opened"); 121 qWarning(" already opened");
122 emit error(Refuse, tr("Device is already connected")); 122 emit error(Refuse, tr("Device is already connected"));
123 m_fd = 0; 123 m_fd = 0;
124 return FALSE; 124 return FALSE;
125 } 125 }
126} 126}
127 127
128void IOSerial::reload(const Profile &config) { 128void IOSerial::reload(const Profile &config) {
129 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); 129 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
130 qWarning( "Dev" +m_device ); 130 qWarning( "Dev" +m_device );
131 qWarning( "Conf:" +config.readEntry("Device") ); 131 qWarning( "Conf:" +config.readEntry("Device") );
132 m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD); 132 m_baud = config.readNumEntry("Speed", SERIAL_DEFAULT_BAUD);
133 m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY); 133 m_parity = config.readNumEntry("Parity", SERIAL_DEFAULT_PARITY);
134 m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS); 134 m_dbits = config.readNumEntry("DataBits", SERIAL_DEFAULT_DBITS);
135 m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS); 135 m_sbits = config.readNumEntry("StopBits", SERIAL_DEFAULT_SBITS);
136 m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW); 136 m_flow = config.readNumEntry("Flow", SERIAL_DEFAULT_FLOW);
137
137} 138}
138 139
139int IOSerial::baud(int baud) const { 140int IOSerial::baud(int baud) const {
140 switch (baud) { 141 switch (baud) {
141 case 300: return B300; break; 142 case 300: return B300; break;
142 case 600: return B600; break; 143 case 600: return B600; break;
143 case 1200: return B1200; break; 144 case 1200: return B1200; break;
144 case 2400: return B2400; break; 145 case 2400: return B2400; break;
145 case 4800: return B4800; break; 146 case 4800: return B4800; break;
146 case 9600: return B9600; break; 147 case 9600: return B9600; break;
147 case 19200: return B19200; break; 148 case 19200: return B19200; break;
148 case 38400: return B38400; break; 149 case 38400: return B38400; break;
149 case 57600: return B57600; break; 150 case 57600: return B57600; break;
150 case 115200: return B115200; break; 151 case 115200: return B115200; break;
151 } 152 }
152 return -1; 153 return -1;
153} 154}
154 155
155void IOSerial::errorOccured() { 156void IOSerial::errorOccured() {
156 emit error(ClosedUnexpected, strerror(errno)); 157 emit error(ClosedUnexpected, strerror(errno));
157 close(); 158 close();
158} 159}
159 160
160void IOSerial::dataArrived() { 161void IOSerial::dataArrived() {
161 QByteArray array(4097); 162 QByteArray array(4097);
162 163
163 int len = read(m_fd, array.data(), 4096); 164 int len = read(m_fd, array.data(), 4096);
164 if (len == 0) 165 if (len == 0)
165 close(); 166 close();
166 if (len < 0) 167 if (len < 0)
167 return; 168 return;
168 array.resize( len ); 169 array.resize( len );
169 emit received(array); 170 emit received(array);
170} 171}
171 172
172QString IOSerial::identifier() const { 173QString IOSerial::identifier() const {
173 return "serial"; 174 return "serial";
174} 175}
175 176
176QString IOSerial::name() const { 177QString IOSerial::name() const {
177 return "RS232 Serial IO Layer"; 178 return "RS232 Serial IO Layer";
178} 179}
179int IOSerial::rawIO()const { 180int IOSerial::rawIO()const {
180 if (m_read ) 181 if (m_read )
181 disconnect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived())); 182 disconnect(m_read, SIGNAL(activated(int)), this, SLOT(dataArrived()));
182 if (m_error ) 183 if (m_error )
183 disconnect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured())); 184 disconnect(m_error, SIGNAL(activated(int)), this, SLOT(errorOccured()));
184 185