From 40f764f46350385eebeafbf69215a6cf87670028 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sun, 20 Sep 2009 02:35:11 +0200 Subject: [PATCH] discoverd weird endianness bug in sauter's usport. fixed --- usb/core/core.c | 7 +++---- usb/host/ohci.c | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/usb/core/core.c b/usb/core/core.c index 789e36e..10f9e5d 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -114,10 +114,9 @@ usb_device *usb_add_device() * bRequest = GET_DESCRIPTOR * wValue = DEVICE (Descriptor Type) * wIndex = 0 - * wLength = 8 (in Bytes!?) + * wLength = 64 // in fact just 8 bytes */ - usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE << 8, 0, 8, buf, 8, 0); - //usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE, 0, 64, buf, 8, 0); + usb_control_msg(dev, 0x80, GET_DESCRIPTOR, DEVICE << 8, 0, 64, buf, 8, 0); printf("===========\nafter usb control msg:\n"); hexdump(buf, sizeof(buf)); @@ -346,7 +345,7 @@ u16 usb_submit_irp(usb_irp *irp) /* wenn device descriptor von adresse 0 angefragt wird werden nur * die ersten 8 byte abgefragt */ - if (setup->bRequest == GET_DESCRIPTOR && (setup->wValue >> 8) == 1 + if (setup->bRequest == GET_DESCRIPTOR && (setup->wValue & 0xff) == 1 && td->devaddress == 0) { runloop = 0; /* stop loop */ } diff --git a/usb/host/ohci.c b/usb/host/ohci.c index 840a27e..77a21b9 100644 --- a/usb/host/ohci.c +++ b/usb/host/ohci.c @@ -221,16 +221,28 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) { printf("pid_setup\n"); tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_SETUP); tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_0); + tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING); break; case USB_PID_OUT: printf("pid_out\n"); tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_OUT); + tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING); + + /* + * TODO: just temporary solution! + * there can be also regular PID_OUT pakets + */ tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_1); break; case USB_PID_IN: printf("pid_in\n"); tmptd->flags |= ACCESS_LE(OHCI_TD_DIRECTION_PID_IN); - /* let the endpoint do the togglestuff! */ + tmptd->flags |= ACCESS_LE(OHCI_TD_BUFFER_ROUNDING); + /* + * let the endpoint do the togglestuff! + * TODO: just temporary solution! + * there can be also inregular PID_IN pakets (@Status Stage) + */ tmptd->flags |= ACCESS_LE(OHCI_TD_TOGGLE_CARRY); #if 0 /* should be done by HC! @@ -242,7 +254,7 @@ u8 hcdi_enqueue(usb_transfer_descriptor *td) { #endif break; } - tmptd->flags |= ACCESS_LE(OHCI_TD_SET_DELAY_INTERRUPT(7) | OHCI_TD_BUFFER_ROUNDING); + tmptd->flags |= ACCESS_LE(OHCI_TD_SET_DELAY_INTERRUPT(7)); printf("tmptd hexdump (before) 0x%08X:\n", tmptd); hexdump(tmptd, sizeof(struct general_td)); -- 2.25.1