aqhome apps: sending a message via aqhome-nodes to nodes now works.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
#define AQH_TTYOBJECT_BAUDRATE B19200
|
||||
@@ -35,6 +37,7 @@ static void _endMsg(AQH_OBJECT *o);
|
||||
static int _getAttn(int fd);
|
||||
static int _setAttn(int fd, int val);
|
||||
static int _fdSetBlocking(int sk, int fl);
|
||||
//static int _msleep(long int msec);
|
||||
|
||||
|
||||
|
||||
@@ -70,6 +73,7 @@ int _startMsg(AQH_OBJECT *o)
|
||||
return rv;
|
||||
}
|
||||
else if (rv==0) {
|
||||
DBG_ERROR(NULL, "Line busy");
|
||||
return GWEN_ERROR_TRY_AGAIN; /* line busy */
|
||||
}
|
||||
else {
|
||||
@@ -89,8 +93,9 @@ void _endMsg(AQH_OBJECT *o)
|
||||
int fd;
|
||||
|
||||
fd=AQH_FdObject_GetFd(o);
|
||||
if (fd>=0)
|
||||
if (fd>=0) {
|
||||
_setAttn(fd, 1); /* set ATTN high */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +137,7 @@ int _setAttn(int fd, int val)
|
||||
DBG_ERROR(AQH_LOGDOMAIN, "Error on ioctl: %s (%d)", strerror(errno), errno);
|
||||
return GWEN_ERROR_IO;
|
||||
}
|
||||
DBG_ERROR(NULL, "Set ATTN to %d", val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -187,6 +193,12 @@ int AQH_TtyObject_OpenAndInitDevice(const char *device, struct termios *initialT
|
||||
return GWEN_ERROR_IO;
|
||||
}
|
||||
|
||||
rv=_setAttn(fd, 1);
|
||||
if (rv<0) {
|
||||
DBG_ERROR(AQH_LOGDOMAIN, "Error on setAttn(%s): %s (%d)", device, strerror(errno), errno);
|
||||
return GWEN_ERROR_IO;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -225,6 +237,26 @@ int _fdSetBlocking(int fd, int fl)
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
int _msleep(long int msec)
|
||||
{
|
||||
struct timespec ts;
|
||||
int rv;
|
||||
|
||||
if (msec<0) {
|
||||
errno=EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ts.tv_sec=msec/1000;
|
||||
ts.tv_nsec=(msec%1000)*1000000;
|
||||
|
||||
do {
|
||||
rv=nanosleep(&ts, &ts);
|
||||
} while (rv && errno==EINTR);
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user