From 5e163d7220489d291e636d1f77bf0ef0ee52b125 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Mon, 21 Sep 2009 11:27:17 +0200 Subject: [PATCH] @get_descriptor|String: disable control quirk *sigh* and keep in mind to do not request more data as defined in bLength otherwise the endpoint will halt --- usb/core/core.c | 7 ++++--- usb/host/ohci.c | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/usb/core/core.c b/usb/core/core.c index 9d4def5..d54b515 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -167,9 +167,9 @@ usb_device *usb_add_device() dev->bDeviceSubClass, dev->bDeviceProtocoll, dev->idVendor, dev->idProduct, dev->bcdDevice); -#if 0 +#if 1 memset(buf, 0, 64); - usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (STRING<<8)|2, 0, 0x20, buf, 8, 0); + usb_control_msg(dev, 0x80, GET_DESCRIPTOR, (STRING<<8)|2, 0, 0x1a, buf, 8, 0); hexdump(buf, sizeof(buf)); printf("String Descriptor [1]: "); u8 i; @@ -341,7 +341,8 @@ u16 usb_submit_irp(usb_irp *irp) /* check bit 7 of bmRequestType */ if (bmRequestType & 0x80) { /* schleife die die tds generiert */ - while (runloop || (restlength < 1)) { + while (runloop && (restlength > 0)) { + printf("restlength: %d\t irp->epsize: %d\n", restlength, irp->epsize); td = usb_create_transfer_descriptor(irp); td->actlen = irp->epsize; /* stop loop if all bytes are send */ diff --git a/usb/host/ohci.c b/usb/host/ohci.c index d1bc81f..3e0e78b 100644 --- a/usb/host/ohci.c +++ b/usb/host/ohci.c @@ -18,6 +18,9 @@ Copyright (C) 2009 Sebastian Falbesoner #include "host.h" #include "../usbspec/usb11spec.h" +/* activate control_quirk (from MIKE) */ +//#define _USE_C_Q + /* macro for accessing u32 variables that need to be in little endian byte order; * * whenever you read or write from an u32 field that the ohci host controller @@ -28,9 +31,7 @@ Copyright (C) 2009 Sebastian Falbesoner (((dword) & 0x0000FF00) << 8) | \ (((dword) & 0x000000FF) << 24) ) -static struct endpoint_descriptor *allocate_endpoint(); static struct general_td *allocate_general_td(); -static void control_quirk(); static void dbg_op_state(); static void configure_ports(u8 from_init); static void setup_port(u32 reg, u8 from_init); @@ -38,6 +39,7 @@ static void setup_port(u32 reg, u8 from_init); static struct ohci_hcca hcca_oh0; +#ifdef _USE_C_Q static struct endpoint_descriptor *allocate_endpoint() { struct endpoint_descriptor *ep; @@ -47,6 +49,7 @@ static struct endpoint_descriptor *allocate_endpoint() ep->headp = ep->tailp = ep->nexted = LE(0); return ep; } +#endif static struct general_td *allocate_general_td() { @@ -59,6 +62,7 @@ static struct general_td *allocate_general_td() return td; } +#ifdef _USE_C_Q static void control_quirk() { static struct endpoint_descriptor *ed = 0; /* empty ED */ @@ -132,6 +136,7 @@ static void control_quirk() printf("nohead!\n"); } } +#endif static void dbg_op_state() @@ -203,7 +208,7 @@ static void general_td_fill(struct general_td *dest, const usb_transfer_descript dest->flags |= LE(OHCI_TD_DIRECTION_PID_IN); if(src->maxp > src->actlen) { dest->flags |= LE(OHCI_TD_BUFFER_ROUNDING); - printf("round buffer!"); + printf("round buffer!\n"); } /* * let the endpoint do the togglestuff! @@ -211,14 +216,6 @@ static void general_td_fill(struct general_td *dest, const usb_transfer_descript * there can be also inregular PID_IN pakets (@Status Stage) */ dest->flags |= LE(OHCI_TD_TOGGLE_CARRY); -#if 0 - /* should be done by HC! - * first pid_in start with DATA0 */ - */ - dummyconfig.headp = LE( src->togl ? - LE(dummyconfig.headp) | OHCI_ENDPOINT_TOGGLE_CARRY : - LE(dummyconfig.headp) & ~OHCI_ENDPOINT_TOGGLE_CARRY); -#endif break; } dest->flags |= LE(OHCI_TD_SET_DELAY_INTERRUPT(7)); @@ -243,7 +240,11 @@ void hcdi_fire() if(edhead == 0) return; - control_quirk(); //required? YES! :O ... erm... or no? :/ ... in fact I have no idea +#ifdef _USE_C_Q + required? YES! :O ... erm... or no? :/ ... in fact I have no idea + control_quirk(); +#endif + write32(OHCI0_HC_CTRL_HEAD_ED, virt_to_phys(edhead)); /* sync it all */ -- 2.25.1