cec: moved some logic to the cec_packet struct. fix package output
[deb_libcec.git] / src / lib / platform / linux / serialport.cpp
index 0bb4e2cf6c419ad0980fea55ecab2033664015f4..4e4ac4627d8f109dc722a80f5991a0a6df30827b 100644 (file)
 #include "../baudrate.h"
 #include "../timeutils.h"
 
+#if defined(__APPLE__)
+#ifndef XCASE
+#define XCASE  0
+#endif
+#ifndef OLCUC
+#define OLCUC  0
+#endif
+#ifndef IUCLC
+#define IUCLC  0
+#endif
+#endif
 using namespace std;
 using namespace CEC;
 
@@ -48,7 +59,7 @@ int8_t CSerialPort::Write(const cec_frame &data)
 
   int32_t byteswritten = 0;
 
-  while (byteswritten < (int32_t) data.size)
+  while (byteswritten < (int32_t) data.size())
   {
     FD_ZERO(&port);
     FD_SET(m_fd, &port);
@@ -59,7 +70,7 @@ int8_t CSerialPort::Write(const cec_frame &data)
       return -1;
     }
 
-    returnv = write(m_fd, data.data + byteswritten, data.size - byteswritten);
+    returnv = write(m_fd, data.packet.data + byteswritten, data.size() - byteswritten);
     if (returnv == -1)
     {
       m_error = strerror(errno);