Commit 36bb9aad authored by ROOL's avatar ROOL 🤖
Browse files

Fix asynchronous endpoint stall function and tidy up

Detail:
  Add missing brace which otherwise meant only the line
    req.bmRequestType = UT_WRITE_ENDPOINT;
  was conditional, rather than the following 6 lines.
  The confusing set of #ifdef __riscos/#endif was masking a missed call to cleartoggle() which would leave the controller and device out of sync.
  Tidy this up, and apply similar to usbd_clear_endpoint_stall() for clarity.
Admin:
  usbdi.c - as detailed above, based on a submission from Colin Granville, with edits.
  usbmodule.c - delete unused DEVICEFSISBROKEN switch, the bug to which it refers was fixed in DeviceFS-0_63 in 2003.

Version 1.26. Tagged as 'USBDriver-1_26'
parent d84d00b5
/* (1.25)
/* (1.26)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.25
#define Module_MajorVersion_CMHG 1.26
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Nov 2017
#define Module_Date_CMHG 13 Jan 2018
#define Module_MajorVersion "1.25"
#define Module_Version 125
#define Module_MajorVersion "1.26"
#define Module_Version 126
#define Module_MinorVersion ""
#define Module_Date "18 Nov 2017"
#define Module_Date "13 Jan 2018"
#define Module_ApplicationDate "18-Nov-17"
#define Module_ApplicationDate "13-Jan-18"
#define Module_ComponentName "USBDriver"
#define Module_ComponentPath "mixed/RiscOS/Sources/HWSupport/USB/USBDriver"
#define Module_FullVersion "1.25"
#define Module_HelpVersion "1.25 (18 Nov 2017)"
#define Module_LibraryVersionInfo "1:25"
#define Module_FullVersion "1.26"
#define Module_HelpVersion "1.26 (13 Jan 2018)"
#define Module_LibraryVersionInfo "1:26"
......@@ -418,13 +418,8 @@ static _kernel_oserror* RegisterNewDevice(struct ugen_softc * softc,int no)
softc,
private_word,
"endpoint/Ninterface/Nalternate/Nreport/Ncontrol,isochronous,bulk,interrupt/Susbtimeout/Nsize/Nnopad/Sshort/S",
#ifdef DEVICEFSISBROKEN
INT_MAX, // should be -1, but that doesn't seem to work
INT_MAX,
#else
-1,
-1,
#endif
&softc->sc_devfs);
return e;
}
......
......@@ -613,11 +613,13 @@ usbd_abort_pipe(usbd_pipe_handle pipe)
usbd_status
usbd_clear_endpoint_stall(usbd_pipe_handle pipe)
{
#ifndef __riscos
#ifdef __riscos
usbd_device_handle dev;
#else
usbd_device_handle dev = pipe->device;
#endif
usb_device_request_t req;
usbd_status err = USBD_NORMAL_COMPLETION;
usbd_status err;
DPRINTFN(8, ("usbd_clear_endpoint_stall\n"));
......@@ -626,9 +628,10 @@ usbd_clear_endpoint_stall(usbd_pipe_handle pipe)
* do the same to the HC toggle.
*/
#ifdef __riscos
usbd_device_handle dev ;
if(pipe && (dev=pipe->device))
{
err = USBD_NORMAL_COMPLETION;
if (pipe && pipe->device && pipe->endpoint && pipe->methods && pipe->methods->cleartoggle)
{
dev = pipe->device;
#endif
pipe->methods->cleartoggle(pipe);
......@@ -638,15 +641,15 @@ usbd_clear_endpoint_stall(usbd_pipe_handle pipe)
USETW(req.wIndex, pipe->endpoint->edesc->bEndpointAddress);
USETW(req.wLength, 0);
err = usbd_do_request(dev, &req, 0);
#ifdef __riscos
}
#endif
#if 0
XXX should we do this?
if (!err) {
pipe->state = USBD_PIPE_ACTIVE;
/* XXX activate pipe */
}
#endif
#ifdef __riscos
}
#endif
return (err);
}
......@@ -655,25 +658,20 @@ usbd_status
usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe)
{
#ifdef __riscos
usb_device_request_t req;
usbd_status err = USBD_NORMAL_COMPLETION;
if(pipe && pipe->device)
{
usbd_device_handle dev = pipe->device;
usbd_device_handle dev;
#else
usbd_device_handle dev = pipe->device;
#endif
usb_device_request_t req;
usbd_status err;
#endif
#ifdef __riscos
if(pipe->methods)
if(pipe->methods->cleartoggle)
#else
pipe->methods->cleartoggle(pipe);
#endif
#ifdef __riscos
if(pipe->endpoint)
err = USBD_NORMAL_COMPLETION;
if (pipe && pipe->device && pipe->endpoint && pipe->methods && pipe->methods->cleartoggle)
{
dev = pipe->device;
#endif
pipe->methods->cleartoggle(pipe);
req.bmRequestType = UT_WRITE_ENDPOINT;
req.bRequest = UR_CLEAR_FEATURE;
......@@ -682,7 +680,7 @@ usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe)
USETW(req.wLength, 0);
err = usbd_do_request_async(dev, &req, 0);
#ifdef __riscos
}
}
#endif
return (err);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment