Ticket #31 (closed defect: fixed)

Opened 2 years ago

Last modified 13 months ago

Darwin: interrupt and isochronous transfers don't timeout

Reported by: mikef Owned by: hjelmn
Component: libusb-1.0 Keywords:
Cc: Blocked By:
Blocks:

Attachments

0001-Fixed-io.c-and-sync.c-so-that-libusb-timeouts-are-ha.patch (1.5 KB) - added by mikef 2 years ago.
Patch to io.c and sync.c
0001-Removed-the-USBI_OS_HANDLES_TIMEOUT-assumption-and-c.patch (2.5 KB) - added by mikef 2 years ago.
Removes the USBI_OS_HANDLES_TIMEOUT for Mac OS X

Change History

Changed 2 years ago by mikef

Patch to io.c and sync.c

Changed 2 years ago by mikef

Removes the USBI_OS_HANDLES_TIMEOUT for Mac OS X

comment:1 Changed 2 years ago by mikef

Original patch (0001-Fixed-io.c-and-sync.c-so-that-libusb-timeouts-are-ha.patch) had the possibilty of affecting the external API.

Developed alternate patch: 0001-Removed-the-USBI_OS_HANDLES_TIMEOUT-assumption-and-c.patch

comment:2 Changed 18 months ago by hjelmn

  • Owner set to hjelmn
  • Status changed from new to accepted

This bug should be fixed in the next release. I didn't want to remove the USBI_OS_HANDLES_TIMEOUT assumption so I changed the granularity so libusb will known to abort interrupt and isochronous timeouts since the os does not support timeouts on these endpoints.

comment:3 Changed 18 months ago by hjelmn

  • Summary changed from [Patch] Darwin: Interrupt transfers don't timeout to Darwin: interrupt and isochronous transfers don't timeout

comment:4 Changed 16 months ago by ludovicrousseau

Is the bug (supposed to be) fixed in git now?

I tried with a version up-to-date (latest commit 116d34f608b02f4e14668450b158acf5db726f95) and libusb_handle_events() does not handle/report a timeout on Mac OS X for an interrupt end point.

comment:5 Changed 16 months ago by ludovicrousseau

In fact libusb_handle_events() does timeout but every 60 seconds only. This is the default timeout defined in libusb_handle_events().

So the timeout set in libusb_fill_bulk_transfer() is not used :-(

comment:6 Changed 16 months ago by ludovicrousseau

Simple (temporary) patch:

-10-13 16:02:34.000000000 +0200
+++ configure.ac    2010-10-13 15:55:44.000000000 +0200
@@ -54,7 +54,7 @@ case $host in
    AC_DEFINE(OS_DARWIN, [], [Darwin backend])
    AC_SUBST(OS_DARWIN)
    AC_DEFINE([THREADS_POSIX], [], [Use Posix Threads])
-   AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout])
+   #AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout])
    AC_MSG_RESULT([Darwin/MacOS X])
    backend="darwin"
    threads="posix"

comment:7 Changed 16 months ago by hjelmn

The fix has been sent in to the mailing list but not applied. Take a look and give them a try.

comment:8 Changed 16 months ago by ludovicrousseau

comment:9 Changed 13 months ago by Nathan Hjelm <hjelmn@…>

  • Status changed from accepted to closed
  • Resolution set to fixed

In [67d9ef7b6877e17f2deec81cd41dc0948f6bed4b/libusb]:

Remove USBI_OS_HANDLES_TIMEOUT and fix int/isoc timeouts on Darwin

Backends set USBI_TRANSFER_OS_HANDLES_TIMEOUT for transfers instead.
Darwin only handles timeouts for bulk and control transfers, so the
backend now sets that flag accordingly, making libusb core handle
timeouts for interrupt and isochronous transfers. Fixes #31.

Signed-off-by: Nathan Hjelm <hjelmn@…>

[stuge: rework libusb_get_next_timeout() and enum usbi_transfer_flags]
[stuge: fix typo; set USBI_TRANSFER_TIMED_OUT flag correctly]

Note: See TracTickets for help on using tickets.