[selphy] Make sure we're using blocking I/O, and fix warnings.
This commit is contained in:
parent
91bcae25fc
commit
10485fedae
|
@ -307,8 +307,8 @@ static int find_and_enumerate(struct libusb_context *ctx,
|
||||||
libusb_get_string_descriptor_ascii(dev, desc.iSerialNumber, serial, STR_LEN_MAX);
|
libusb_get_string_descriptor_ascii(dev, desc.iSerialNumber, serial, STR_LEN_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strlen(serial))
|
if (!strlen((char*)serial))
|
||||||
strcpy(serial, "NONE");
|
strcpy((char*)serial, "NONE");
|
||||||
|
|
||||||
DEBUG("%s%sPID: %04X Product: '%s' Serial: '%s'\n",
|
DEBUG("%s%sPID: %04X Product: '%s' Serial: '%s'\n",
|
||||||
(!valid) ? "UNRECOGNIZED: " : "",
|
(!valid) ? "UNRECOGNIZED: " : "",
|
||||||
|
@ -405,6 +405,19 @@ int main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ensure we're using BLOCKING I/O */
|
||||||
|
i = fcntl(data_fd, F_GETFL, 0);
|
||||||
|
if (i < 0) {
|
||||||
|
perror("ERROR:Can't open input");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
i &= ~O_NONBLOCK;
|
||||||
|
i = fcntl(data_fd, F_SETFL, 0);
|
||||||
|
if (i < 0) {
|
||||||
|
perror("ERROR:Can't open input");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* Start parsing URI 'selphy://PID/SERIAL' */
|
/* Start parsing URI 'selphy://PID/SERIAL' */
|
||||||
if (strncmp(URI_PREFIX, uri, strlen(URI_PREFIX))) {
|
if (strncmp(URI_PREFIX, uri, strlen(URI_PREFIX))) {
|
||||||
ERROR("Invalid URI prefix (%s)\n", uri);
|
ERROR("Invalid URI prefix (%s)\n", uri);
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSION "0.43"
|
#define VERSION "0.44"
|
||||||
|
|
||||||
#define DEBUG( ... ) fprintf(stderr, "DEBUG: " __VA_ARGS__ )
|
#define DEBUG( ... ) fprintf(stderr, "DEBUG: " __VA_ARGS__ )
|
||||||
#define ERROR( ... ) fprintf(stderr, "ERROR: " __VA_ARGS__ )
|
#define ERROR( ... ) fprintf(stderr, "ERROR: " __VA_ARGS__ )
|
||||||
|
|
Loading…
Reference in New Issue