NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/43753: write-timeout in ugen(4) cannot be set
>Number: 43753
>Category: kern
>Synopsis: write-timeout in ugen(4) cannot be set
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Aug 13 12:00:00 +0000 2010
>Originator: Wolfgang Stukenbrock
>Release: NetBSD 5.0.2
>Organization:
Dr. Nagler & Company GmbH
>Environment:
System: NetBSD test-s0 4.0 NetBSD 4.0 (NSW-WS) #1: Fri Aug 13 13:24:12 CEST
2010 wgstuken@test-s0:/usr/src/sys/arch/amd64/compile/NSW-WS amd64
Architecture: x86_64
Machine: amd64
>Description:
In the current implementation it is impossible to set a timeout on
write operations
in the ugen(4) driver.
The USB_SET_TIMEOUT sets the timeout value only for the IN pipe. The
OUT pipe is not
modified. There seems to be no way to set a value other than the
default assigned
durint openening the endpoint to the OUT pipe. I've check the most
reachend file
in the CVS repository - so this problem is in current too.
The manual to ugen(4) say: USB_SET_TIMEOUT will set the timeout on the
device operations.
This meens both IN and OUT - at least this is my understanding.
If only setting of the IN-timeout is desired, this should be clarified
in the manual.
There are at least two ways to fix this problem:
1: set the OUT-timeout to the same value as for the IN pipe in the
USB_SET_TIMEOUT.
2. add another ioctl to set the OUT-timeout seperately.
Perhaps the USB_SET_TIMEOUT should set both timeouts and two new
ioctls (e.g.
USB_SET_IN_TIMEOUT and USB_SET_OUT_TIMEOUT) should be created to
support
different timeout settings for read(2) and write(2) operations.
The fix below just does version 1, but I think the second one would be
the most flexible.
>How-To-Repeat:
Try to set a timeout and send more data as the device is actual able to
accept.
The write() call will hang forever ...
>Fix:
The following patch will set the timeout for the OUT pipe to the same
value as the
IN pipe on USB_SET_TIMEOUT ioctl.
remark: This fix will return EINVAL if the IN-pipe is invalid, even if
an OUT-pipe
is present. As far as I've seen in the code, this situation
will never happen.
--- ugen.c.orig 2010-08-13 13:38:39.000000000 +0200
+++ ugen.c 2010-08-13 13:38:17.000000000 +0200
@@ -1427,6 +1427,8 @@
)
return (EINVAL);
sce->timeout = *(int *)addr;
+ if ((sce = &sc->sc_endpoints[endpt][OUT]) != NULL)
+ sce->timeout = *(int *)addr;
return (0);
case USB_SET_BULK_RA:
#ifdef UGEN_BULK_RA_WB
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index