Merge branch 'master' of git://github.com/yuhu-/ebusd
Conflicts: src/ebusctl/ebusctl.cpp src/ebusd/Makefile.am src/ebusd/baseloop.cpp src/ebusd/baseloop.h src/ebusd/bushandler.cpp src/ebusd/bushandler.h src/lib/ebus/message.cpp src/lib/ebus/message.h src/lib/ebus/port.cpp src/lib/ebus/symbol.cpp src/lib/ebus/symbol.h src/lib/ebus/test/test_data.cpp src/lib/ebus/test/test_message.cpp
This commit is contained in:
@@ -147,20 +147,19 @@ unsigned char Device::getByte()
|
||||
result_t DeviceSerial::openDevice(const string deviceName, const bool noDeviceCheck)
|
||||
{
|
||||
m_noDeviceCheck = noDeviceCheck;
|
||||
|
||||
termios newSettings;
|
||||
|
||||
struct termios newSettings;
|
||||
m_open = false;
|
||||
|
||||
// open file descriptor from serial device
|
||||
// open file descriptor
|
||||
m_fd = open(deviceName.c_str(), O_RDWR | O_NOCTTY);
|
||||
|
||||
if (m_fd < 0)
|
||||
if (m_fd < 0 || isatty(m_fd) == 0)
|
||||
return RESULT_ERR_NOTFOUND;
|
||||
|
||||
// save current settings of serial device
|
||||
// save current settings
|
||||
tcgetattr(m_fd, &m_oldSettings);
|
||||
|
||||
// create new settings
|
||||
memset(&newSettings, '\0', sizeof(newSettings));
|
||||
|
||||
newSettings.c_cflag |= (B2400 | CS8 | CLOCAL | CREAD);
|
||||
@@ -176,7 +175,7 @@ result_t DeviceSerial::openDevice(const string deviceName, const bool noDeviceCh
|
||||
tcflush(m_fd, TCIFLUSH);
|
||||
|
||||
// activate new settings of serial device
|
||||
tcsetattr(m_fd, TCSANOW, &newSettings);
|
||||
tcsetattr(m_fd, TCSAFLUSH, &newSettings);
|
||||
|
||||
// set serial device into blocking mode
|
||||
fcntl(m_fd, F_SETFL, fcntl(m_fd, F_GETFL) & ~O_NONBLOCK);
|
||||
|
||||
+3
-3
@@ -110,13 +110,13 @@ public:
|
||||
ssize_t sizeRecvBuffer() const { return m_recvBuffer.size(); }
|
||||
|
||||
protected:
|
||||
/** if of file descriptor */
|
||||
/** file descriptor from input device */
|
||||
int m_fd;
|
||||
|
||||
/** state of device*/
|
||||
/** true if device is opened */
|
||||
bool m_open;
|
||||
|
||||
/** state of device check */
|
||||
/** true if device check is disabled */
|
||||
bool m_noDeviceCheck;
|
||||
|
||||
/** queue for received bytes */
|
||||
|
||||
Reference in New Issue
Block a user