cec: handle bus scan from LG TVs
[deb_libcec.git] / src / lib / platform / linux / serialport.cpp
index 3a274fec12f35f88e9f1ec3e07b439a324fa3aa7..2e4560d56c683766bbdf876f6c360b51a2e180d8 100644 (file)
@@ -53,6 +53,7 @@ using namespace CEC;
 CSerialPort::CSerialPort()
 {
   m_fd = -1;
+  m_tostdout = false;
 }
 
 CSerialPort::~CSerialPort()
@@ -94,14 +95,14 @@ int8_t CSerialPort::Write(CCECAdapterMessage *data)
   }
 
   //print what's written to stdout for debugging
-//  if (m_tostdout)
-//  {
-//    printf("%s write:", m_name.c_str());
-//    for (int i = 0; i < byteswritten; i++)
-//      printf(" %02x", (unsigned int)data[i]);
-//
-//    printf("\n");
-//  }
+  if (m_tostdout)
+  {
+    printf("%s write:", m_name.c_str());
+    for (int i = 0; i < byteswritten; i++)
+      printf(" %02x", data->at(i));
+
+    printf("\n");
+  }
 
   return byteswritten;
 }
@@ -167,14 +168,14 @@ int32_t CSerialPort::Read(uint8_t* data, uint32_t len, uint64_t iTimeoutMs /*= 0
   }
 
   //print what's read to stdout for debugging
-//  if (m_tostdout && bytesread > 0)
-//  {
-//    printf("%s read:", m_name.c_str());
-//    for (int i = 0; i < bytesread; i++)
-//      printf(" %02x", (unsigned int)data[i]);
-//
-//    printf("\n");
-//  }
+  if (m_tostdout && bytesread > 0)
+  {
+    printf("%s read:", m_name.c_str());
+    for (int i = 0; i < bytesread; i++)
+      printf(" %02x", data[i]);
+
+    printf("\n");
+  }
 
   return bytesread;
 }