if (ret != sizeof(req)) {
ret = -errno;
fprintf(stderr, "Failed to write request %s (%d), %s\n",
- "GPIO_V2_GET_LINE_IOCTL", ret, strerror(errno));
+ "GPIO_V2_GET_LINE_IOCTL", ret, strerror(errno));
+ }
+
+ ret = recv(fd, &req, sizeof(req), MSG_WAITALL);
+ if (ret != sizeof(req)) {
+ ret = -errno;
+ fprintf(stderr, "Failed to read request %s (%d), %s\n",
+ "GPIO_V2_GET_LINE_IOCTL", ret, strerror(errno));
}
req.fd = fd;
goto exit;
}
+ ret = write(fd, values, sizeof(*values));
+ if (ret != sizeof(*values)) {
+ ret = -errno;
+ fprintf(stderr, "Failed to write %s (%d), %s\n",
+ "GPIO_V2_LINE_GET_VALUES_IOCTL", ret, strerror(errno));
+ goto exit;
+ }
+
ret = recv(fd, &values, sizeof(*values), MSG_WAITALL);
if (ret != sizeof(*values)) {
ret = -errno;
- fprintf(stderr, "Failed to recieve %s (%d), %s\n",
+ fprintf(stderr, "Failed to read %s (%d), %s\n",
"GPIO_V2_LINE_GET_VALUES_IOCTL", ret, strerror(errno));
}