usb4java icon indicating copy to clipboard operation
usb4java copied to clipboard

Timeout and abort irp

Open akatopaz opened this issue 12 years ago • 3 comments

Hi folks, I'm a bit annoyed that I just can't abort irp when timeout has a big value (or you must may for all timeout to be exceeded, without speaking of the 0 case).

I think IRP model misses a irp.cancel() method.

What do you think ? Though it might not be the right place to talk about this, I probably shall complain onto javax.usb project page ... Cheers, Topaz.

akatopaz avatar Oct 09 '13 12:10 akatopaz

Currently the javax.usb implementation of usb4java uses synchronous transfers of libusb which can't be canceled because the thread is blocked by libusb. In future versions we should use asynchronous transfers which will be available in the low-level API of the upcoming 1.2.0 version. libusb provides a cancel function for asynchronous transfers so hopefully this will fix this issue. But unfortunately I can't tell you when this will be implemented.

kayahr avatar Mar 02 '14 21:03 kayahr

One minor update: In 1.2.0 bulk-in and interrupt-in transfers will now block indefinitely without setting the timeout to 0 but still check for pipe-abortion after each timeout interval. So there should be no reason anymore to set the timeout to 0 and the blocked synchronous (and asynchronous) transfers will be aborted a few seconds after aborting the pipe (Timeout now defaults to 5 seconds).

kayahr avatar Mar 15 '14 15:03 kayahr

Because of lack of time and knowledge I'm open for pull requests for this issue.

kayahr avatar Oct 21 '18 21:10 kayahr