Unwanted detach_client() call in UBX Super-eMode Standalone batch operation
In super-E mode operation, UBX modules such as the ZOE-M8B can operate as stand-alone and batch data internally. Batched data is then retrieved by a proper pull request UBX-LOG-RETRIEVEBATCH.
The thing is, in this mode, the GNSS modem will send no data at all (no periodic frame) This bit of code in gpsd.c causes a disconnection when entering this mode (proper configuration with ubxtool):
GPSD_LOG(LOG_PROG, &context.errout,
"checking client(%d)\n",
sub_index(sub));
if ((buflen =
(int)recv(sub->fd, buf, sizeof(buf) - 1, 0)) <= 0) {
detach_client(sub); //==> causes unwanted detach for super e-Mode devices
} else {
if (buf[buflen - 1] != '\n')
buf[buflen++] = '\n';
buf[buflen] = '\0';
GPSD_LOG(LOG_CLIENT, &context.errout,
"<= client(%d): %s\n", sub_index(sub), buf);
In this mode of operation, it is preferred to keep the device attached even without receiving periodic frames.
I ran some tests and commenting the detach_client() call after the buffer length check is performed yields the expected behavior. But I am not sure how exactly gpsd.c could be modified to account for the use case without impacting the normal operation.
Could it be supported with a gpsd option (disable detach on empty buffer reception)?