- Fixed regression in `snprintf` emulation function (Issue #67)
- The scheduler's systemd service file now waits for the nslcd service to start
(Issue #69)
+- The libusb-based USB backend now uses a simpler read timer implementation to
+ avoid a regression in a previous change (Issue #72)
- Fixed segfault in help.cgi when searching in man pages (Issue #81)
- Root certificates were incorrectly stored in "~/.cups/ssl".
unsigned char readbuffer[512];
int rbytes;
int readstatus;
- struct timeval now,
- delay,
- end,
- timeleft;
(void)reference;
- /*
- * Read frequency: once every 250 milliseconds.
- */
-
- delay.tv_sec = 0;
- delay.tv_usec = 250000;
-
do
{
/*
- * Remember when we started so we can throttle the loop after the read
- * call...
- */
-
- gettimeofday(&now, NULL);
-
- /*
- * Calculate what 250 milliSeconds are in absolute time...
+ * Try reading from the OUT (to host) endpoint...
*/
- timeradd(&now, &delay, &end);
-
rbytes = sizeof(readbuffer);
readstatus = libusb_bulk_transfer(g.printer->handle,
g.printer->read_endp,
readbuffer, rbytes,
- &rbytes, 60000);
+ &rbytes, 250);
if (readstatus == LIBUSB_SUCCESS && rbytes > 0)
{
- fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n",
- (int)rbytes);
+ fprintf(stderr, "DEBUG: Read %d bytes of back-channel data...\n", (int)rbytes);
cupsBackChannelWrite((const char *)readbuffer, (size_t)rbytes, 1.0);
}
else if (readstatus == LIBUSB_ERROR_TIMEOUT)
*/
if ((g.wait_eof || !g.read_thread_stop))
- {
- gettimeofday(&now, NULL);
- if (timercmp(&now, &end, <))
- {
- timersub(&end, &now, &timeleft);
- usleep(1000000 * timeleft.tv_sec + timeleft.tv_usec);
- }
- }
- } while (g.wait_eof || !g.read_thread_stop);
+ usleep(250000);
+ }
+ while (g.wait_eof || !g.read_thread_stop);
/*
* Let the main thread know that we have completed the read thread...