Bug 94311 - [ugen] [patch] allow interrupt IN transactions to be affected by USB_SET_TIMEOUT
Summary: [ugen] [patch] allow interrupt IN transactions to be affected by USB_SET_TIMEOUT
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 6.1-BETA2
Hardware: Any Any
: Normal Affects Only Me
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-11 05:50 UTC by Lonnie Mendez
Modified: 2009-04-13 16:48 UTC (History)
0 users

See Also:


Attachments
file.diff (565 bytes, patch)
2006-03-11 05:50 UTC, Lonnie Mendez
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lonnie Mendez 2006-03-11 05:50:20 UTC
   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.
Comment 1 Lonnie Mendez 2006-03-25 02:34:04 UTC
   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
Comment 2 dfilter service freebsd_committer freebsd_triage 2007-06-28 07:22:48 UTC
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"
Comment 3 Warner Losh freebsd_committer freebsd_triage 2007-06-29 21:26:45 UTC
State Changed
From-To: open->patched

This has been updated in -current.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2007-07-06 09:24:54 UTC
Responsible Changed
From-To: freebsd-usb->imp

imp committed the patch.
Comment 5 Warner Losh freebsd_committer freebsd_triage 2009-04-13 16:48:27 UTC
State Changed
From-To: patched->closed

These have been in a release...