aqhome-nodes: allow for TTY interface without ATTN line.

This commit is contained in:
Martin Preuss
2025-03-21 20:54:19 +01:00
parent 1fa0d976d2
commit c808f8640e
6 changed files with 39 additions and 24 deletions

View File

@@ -61,24 +61,28 @@ AQH_OBJECT *AQH_TtyObject_new(AQH_EVENT_LOOP *eventLoop, int fd, int fdMode)
int _startMsg(AQH_OBJECT *o)
{
if (o) {
int fd;
int rv;
fd=AQH_FdObject_GetFd(o);
if (fd==-1)
return GWEN_ERROR_IO;
rv=_getAttn(fd);
if (rv<0) {
DBG_INFO(AQH_LOGDOMAIN, "here (%d)", rv);
return rv;
}
else if (rv==0) {
DBG_ERROR(NULL, "Line busy");
return GWEN_ERROR_TRY_AGAIN; /* line busy */
}
else {
_setAttn(fd, 0); /* set ATTN low */
if (AQH_Object_GetFlags(o) & AQH_TTYOBJECT_FLAGS_NOATTN)
return 0;
else {
int fd;
int rv;
fd=AQH_FdObject_GetFd(o);
if (fd==-1)
return GWEN_ERROR_IO;
rv=_getAttn(fd);
if (rv<0) {
DBG_INFO(AQH_LOGDOMAIN, "here (%d)", rv);
return rv;
}
else if (rv==0) {
DBG_ERROR(NULL, "Line busy");
return GWEN_ERROR_TRY_AGAIN; /* line busy */
}
else {
_setAttn(fd, 0); /* set ATTN low */
return 0;
}
}
}
else
@@ -90,11 +94,13 @@ int _startMsg(AQH_OBJECT *o)
void _endMsg(AQH_OBJECT *o)
{
if (o) {
int fd;
if (!(AQH_Object_GetFlags(o) & AQH_TTYOBJECT_FLAGS_NOATTN)) {
int fd;
fd=AQH_FdObject_GetFd(o);
if (fd>=0) {
_setAttn(fd, 1); /* set ATTN high */
fd=AQH_FdObject_GetFd(o);
if (fd>=0) {
_setAttn(fd, 1); /* set ATTN high */
}
}
}
}