ChrisW
10
PS If you use uqmi for monitoring as well as interface control, you’ll probably also hit a bug where two uqmi instances access the /dev/cdc-wdm0 interface at once, and one of them deadlocks waiting for a response that was delivered to the other instead. If so, you can fix this by arranging for uqmi to flock() the device node to serialise access:
diff --git a/dev.c b/dev.c
index bd10207..d14255a 100644
--- a/dev.c
+++ b/dev.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <sys/file.h>
#include "uqmi.h"
#include "qmi-errors.h"
#include "qmi-errors.c"
@@ -359,6 +360,9 @@ int qmi_device_open(struct qmi_dev *qmi, const char *path)
if (fd < 0)
return -1;
+ if (flock(fd, LOCK_EX) < 0)
+ return -1;
+
us->notify_read = qmi_notify_read;
ustream_fd_init(&qmi->sf, fd);
INIT_LIST_HEAD(&qmi->req);
This is on my to-do list to send upstream at some point.