summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/io_serial.cpp
Unidiff
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.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp
index 77ced85..929aeff 100644
--- a/noncore/apps/opie-console/io_serial.cpp
+++ b/noncore/apps/opie-console/io_serial.cpp
@@ -40,3 +40,5 @@ void IOSerial::close() {
40bool IOSerial::open() { 40bool IOSerial::open() {
41 qWarning("open");
41 if (!m_fd) { 42 if (!m_fd) {
43 qWarning("going to open %s", m_device.latin1());
42 struct termios tty; 44 struct termios tty;
@@ -44,2 +46,3 @@ bool IOSerial::open() {
44 if (m_fd < 0) { 46 if (m_fd < 0) {
47 qWarning(" fd < 0 ");
45 emit error(CouldNotOpen, strerror(errno)); 48 emit error(CouldNotOpen, strerror(errno));
@@ -52,2 +55,3 @@ bool IOSerial::open() {
52 if (speed == -1) { 55 if (speed == -1) {
56 qWarning("speed -1");
53 emit error(Refuse, tr("Invalid baud rate")); 57 emit error(Refuse, tr("Invalid baud rate"));
@@ -115,2 +119,3 @@ bool IOSerial::open() {
115 } else { 119 } else {
120 qWarning("opened");
116 emit error(Refuse, tr("Device is already connected")); 121 emit error(Refuse, tr("Device is already connected"));
@@ -123,2 +128,4 @@ void IOSerial::reload(const Profile &config) {
123 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE); 128 m_device = config.readEntry("Device", SERIAL_DEFAULT_DEVICE);
129 qWarning( "Dev" +m_device );
130 qWarning( "Conf:" +config.readEntry("Device") );
124 m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD); 131 m_baud = config.readNumEntry("Baud", SERIAL_DEFAULT_BAUD);
@@ -152,6 +159,5 @@ void IOSerial::errorOccured() {
152void IOSerial::dataArrived() { 159void IOSerial::dataArrived() {
153 QByteArray array; 160 QByteArray array(4096);
154 char buf[4096];
155 161
156 int len = read(m_fd, buf, 4096); 162 int len = read(m_fd, array.data(), 4096);
157 if (len == 0) 163 if (len == 0)
@@ -160,3 +166,3 @@ void IOSerial::dataArrived() {
160 return; 166 return;
161 array.setRawData(buf, len); 167 array.resize( len );
162 emit received(array); 168 emit received(array);