usb: fix wrong interface numbering (+ comments)

This worked previously because the only interface (number 0) had its
interface descriptor in first position (position 0).
This commit is contained in:
Lephe 2023-02-18 15:26:18 +01:00
parent 6910714c2c
commit 53c67af52d
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
3 changed files with 4 additions and 6 deletions

View File

@ -15,7 +15,6 @@
// Operations on pipes
//---
/* usb_pipe_configure(): Configure a pipe when opening the connection */
void usb_pipe_configure(int address, endpoint_t const *ep)
{
/* Maps USB 2.0 transfer types to SH7305 USB module transfer types */
@ -57,7 +56,6 @@ void usb_pipe_configure(int address, endpoint_t const *ep)
}
}
/* usb_pipe_clear(): Clear all data in the pipe */
void usb_pipe_clear(int pipe)
{
if(pipe <= 0 || pipe > 9) return;

View File

@ -106,7 +106,7 @@ static void write_configuration_descriptor(int wLength)
if(dc[1] == USB_DC_INTERFACE)
{
usb_dc_interface_t idc = *(usb_dc_interface_t *)dc;
idc.bInterfaceNumber = k;
idc.bInterfaceNumber = i;
dcp_write(&idc, idc.bLength);
}
/* Edit endpoint numbers on-the-fly */

View File

@ -141,8 +141,8 @@ int usb_open(usb_interface_t const **interfaces, gint_call_t callback)
USB.REG_C2 = 0x0020;
/* Disconnect (DPRPU=0) if we were previously connected as a function. Also
drive down DRPR, since both are required for setting DCFM. */
/* Disconnect (DPRPU=0) if we were previously connected as a function.
Also drive down DRPD, since both are required for setting DCFM. */
USB.SYSCFG.DPRPU = 0;
USB.SYSCFG.DRPD = 0;
@ -151,7 +151,7 @@ int usb_open(usb_interface_t const **interfaces, gint_call_t callback)
USB.SYSCFG.DCFM = 1;
/* Clear registers to prepare for host operation */
USB.SYSCFG.USBE = 0;
/* Do not require high-speed operation; also accept full-speed */
/* Accept both high-speed and full-speed devices */
USB.SYSCFG.HSE = 0;
/* Pull DPRD and eliminate chattering */