While developing the usb redirector for qemu on FreeBSD I ran into the fact that the interrupt transaction process in ugen.c:ugen_do_read() does not allow for a timeout value (hangs process without O_NONBLOCK and no data). The man page for ugen also does not mention that USB_SET_TIMEOUT ioctl has no effect for interrupt IN transaction so I'm led to believe this is a bug/feature not yet fixed: USB_SET_TIMEOUT (int) Set the timeout on the device operations, the time is specified in milliseconds. The value 0 is used to indicate that there is no timeout. The patch below I believe corrects for this by using the timeout value that can be set from USB_SET_TIMEOUT ioctl in the tsleep call. With this patch the redirector can maintain the KISS principle while functioning properly.
Looking at it again, it seems (sce->timeout*hz)/1000 would suffice. The other part is simply lost to integer truncation. My mail client eats patches, linked here: http://gnome.dnsalias.net/patches/ugen-interrupt-timeout.patch
imp 2007-06-28 06:22:40 UTC FreeBSD src repository Modified files: sys/dev/usb ugen.c Log: The timeout is in milliseconds, not in hz. Only the portion of the patch that converts ms to ticks was used. Another PR states that a return code of 0 is the right one for libusb. Submitted by: Lonnie Mendez PR: 94311 Approved by: re (blanket) Revision Changes Path 1.111 +2 -2 src/sys/dev/usb/ugen.c _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched This has been updated in -current.
Responsible Changed From-To: freebsd-usb->imp imp committed the patch.
State Changed From-To: patched->closed These have been in a release...