summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRALOVICH, Kristóf <tade60@freemail.hu>2013-06-26 11:33:30 +0200
committerRALOVICH, Kristóf <tade60@freemail.hu>2013-06-26 11:33:30 +0200
commitc8a1f5644d0b54dac6fddee0fc48cb5769997c40 (patch)
tree2c96d899b7d03689b24bb7900160fb6b99f4c505
parent2caab6371fe19d0d103ee82c9d93b4d929e2c1c5 (diff)
serial: add more verbosity to output
-rw-r--r--src/SerialTty.cpp12
-rw-r--r--src/SerialUsb.cpp2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/SerialTty.cpp b/src/SerialTty.cpp
index bbf8d1d..066ca92 100644
--- a/src/SerialTty.cpp
+++ b/src/SerialTty.cpp
@@ -68,6 +68,8 @@ struct SerialTtyIOThread
SerialTty::SerialTty()
: m_p(new SerialTtyPrivate())
{
+ LOG(LOG_INF) << "Using SerialTty...\n";
+
m_p->m_devName = "/dev/ttyUSB0";
m_p->m_fd = -1;
//, m_p->m_recvTh = 0;
@@ -101,16 +103,24 @@ SerialTty::open()
bool rv = false;
+ LOG(LOG_INF) << "opening " << m_p->m_devName << "\n";
m_p->m_fd = ::open(m_p->m_devName.c_str(), O_RDWR | O_NONBLOCK);
if(m_p->m_fd < 1)
{
m_p->m_devName = "/dev/ttyUSB1";
+ LOG(LOG_INF) << "opening " << m_p->m_devName << "\n";
m_p->m_fd = ::open(m_p->m_devName.c_str(), O_RDWR | O_NONBLOCK);
}
- ENSURE_OR_RETURN_FALSE(m_p->m_fd);
+ //ENSURE_OR_RETURN_FALSE(m_p->m_fd);
if(m_p->m_fd<0)
+ {
+ LOG(antpm::LOG_ERR) << "Opening serial port failed! Make sure cp210x kernel module is loaded, and either /dev/ttyUSB0 or /dev/ttyUSB1 was created by cp210x!\n";
+ char se[256];
+ strerror_r(m_p->m_fd, se, sizeof(se));
+ LOG(antpm::LOG_ERR) << "error=" << m_p->m_fd << ", strerror=" << se << "\n";
return rv;
+ }
//printf("m_fd=%d\n", m_fd);
diff --git a/src/SerialUsb.cpp b/src/SerialUsb.cpp
index 3360b62..243fda4 100644
--- a/src/SerialUsb.cpp
+++ b/src/SerialUsb.cpp
@@ -346,6 +346,8 @@ struct SerialUsbPrivate
SerialUsb::SerialUsb()
{
+ LOG(LOG_INF) << "Using SerialUsb...\n";
+
m_p.reset(new SerialUsbPrivate());
m_p->m_recvThKill = 0;
m_p->dev = 0;