From 7e5ba118123fc6f330fb1416d0154f39b851a843 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Wed, 16 Sep 2009 03:41:23 +0200 Subject: [PATCH] some debug stuff. let zeh ohci hack begin! \o/ --- main.c | 2 ++ usb/core/core.c | 26 ++++++++++++++++++++++---- usb/core/usb.c | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index bbb7d39..d69bb40 100644 --- a/main.c +++ b/main.c @@ -121,6 +121,8 @@ int main(void) printf("bye, world!\n"); */ + (void) usb_add_device(); + while(1) { // just to get sure we are still in this loop //_CPU_ISR_Enable() // don't know why this is needed... diff --git a/usb/core/core.c b/usb/core/core.c index a66df30..9897720 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -39,6 +39,7 @@ #include "../usbspec/usb11spec.h" #include "../lib/list.h" #include "../../malloc.h" +#include "../../bootmii_ppc.h" //printf /** * Initialize USB stack. @@ -107,7 +108,7 @@ usb_device *usb_add_device() */ usb_control_msg(dev, 0x80, GET_DESCRIPTOR, 1, 0, 64, buf, 8, 0); - dev->bMaxPacketSize0 = (u8) buf[7]; /* setup real ep0 fifo size */ + dev->bMaxPacketSize0 = (u8) buf[7] ? (u8) buf[7] : 1; //dirty? /* setup real ep0 fifo size */ devdescr_size = (u8) buf[0]; /* save real length of device descriptor */ /* define new adress */ @@ -126,6 +127,24 @@ usb_device *usb_add_device() dev->idProduct = (u16) (buf[11] << 8) | (buf[10]); dev->bcdDevice = (u16) (buf[13] << 8) | (buf[12]); + printf( "bDeviceClass 0x%02X\n" + "bDeviceSubClass 0x%02X\n" + "bDeviceProtocoll 0x%02X\n" + "idVendor 0x%04X\n" + "idProduct 0x%04X\n" + "bcdDevice 0x%04X\n", dev->bDeviceClass, + dev->bDeviceSubClass, dev->bDeviceProtocoll, + dev->idVendor, dev->idProduct, dev->bcdDevice); + /* for lewurms keyboard it should be: + * bDeviceClass 0 + * bDeviceSubClass 0 + * bDeviceClass 0 + * idVendor 0x049f + * idProduct 0x000e + * bcdDevice 1.00 + */ + + // string descriptoren werden nicht im arbeitsspeicher gehalten -> on demand mit // entprechenden funktionen // hier muss man noch mehr abholen, konfigurationene, interfaces und endpunkte @@ -215,7 +234,7 @@ u8 usb_remove_irp(usb_irp * irp) * In the usbstack they are transported with the * usb_transfer_descriptor data structure. */ -u16 usb_submit_irp(usb_irp * irp) +u16 usb_submit_irp(usb_irp *irp) { usb_transfer_descriptor *td; u8 runloop = 1; @@ -315,8 +334,6 @@ u16 usb_submit_irp(usb_irp * irp) } - - /***************** Status Stage ***********************/ /* Zero packet for end */ td = usb_create_transfer_descriptor(irp); @@ -410,3 +427,4 @@ usb_transfer_descriptor *usb_create_transfer_descriptor(usb_irp * irp) return td; } + diff --git a/usb/core/usb.c b/usb/core/usb.c index c99ba09..0b127b5 100644 --- a/usb/core/usb.c +++ b/usb/core/usb.c @@ -135,7 +135,7 @@ u8 usb_reset(usb_device *dev) */ u8 usb_control_msg(usb_device *dev, u8 requesttype, u8 request, u16 value, u16 index, u16 length,char *buf, u16 size, u16 timeout) { - usb_irp * irp = (usb_irp*)malloc(sizeof(usb_irp)); + usb_irp *irp = (usb_irp*)malloc(sizeof(usb_irp)); irp->dev = dev; //irp->devaddress = dev->address; irp->endpoint = 0; -- 2.25.1