From 3b9dfcf21e6f8aa9efd701ac38a3a594ac2fd94f Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Wed, 23 Sep 2009 13:57:46 +0200 Subject: [PATCH] w00000000000t --- usb/4u.out | 3 +++ usb/core/core.c | 57 ++++++++++++------------------------------------- usb/core/usb.c | 4 ++-- 3 files changed, 19 insertions(+), 45 deletions(-) diff --git a/usb/4u.out b/usb/4u.out index d5a8495..25e8e52 100644 --- a/usb/4u.out +++ b/usb/4u.out @@ -49,6 +49,8 @@ f4825d00 2607621751 C Ci:4:009:0 0 59 = 09023b00 020102a0 19090400 00010301 0103 f4825d00 2607621768 S Ci:4:009:0 s 80 06 0300 0000 00ff 255 < f4825d00 2607626747 C Ci:4:009:0 0 4 = 04030904 + +lang stuff f4825d00 2607626754 S Ci:4:009:0 s 80 06 0302 0409 00ff 255 < f4825d00 2607637749 C Ci:4:009:0 0 50 = 32034300 6f006d00 70006100 71002000 49006e00 74006500 72006e00 65007400 f4825d00 2607637759 S Ci:4:009:0 s 80 06 0301 0409 00ff 255 < @@ -75,6 +77,7 @@ f5abaf00 2607671758 S Ci:4:009:0 s 81 06 2200 0000 0041 65 < f5abaf00 2607683759 C Ci:4:009:0 0 65 = 05010906 a1010507 19e029e7 15002501 75019508 81027508 95018101 05081901 +usb_control_msg(dev, (1<<5)|1, SET_CONFIGURATION, 0x200, 0x0, 0x0, buf, 0); f6273300 2607684009 S Co:4:009:0 s 21 09 0200 0000 0004 4 = 00000000 f5abaf00 2607684216 S Ii:4:009:1 -115:16 8 < f6273680 2607684488 S Ci:4:009:0 s 80 06 0304 0409 00ff 255 < diff --git a/usb/core/core.c b/usb/core/core.c index d50c22b..5535bb3 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -98,7 +98,7 @@ struct usb_device *usb_add_device(u8 lowspeed, u32 reg) dev->bMaxPacketSize0 = lowspeed ? 8 : 64; dev->ohci = reg; - dev->epSize[0] = 64; + dev->epSize[0] = 8; dev->epSize[1] = 64; dev->epSize[2] = 64; @@ -112,31 +112,8 @@ struct usb_device *usb_add_device(u8 lowspeed, u32 reg) return (void*) -1; } -//#define WTF +#define WTF #ifdef WTF - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADING WTF :O lolololololo \n"); - printf("loolololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDNG WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDINGWTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :Ololololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O llololololo \n"); - printf("lololololool PADDING WTF :O loololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O loloooloo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololoolo \n"); - printf("lololololool PADDING WTF :O lololooolo \n"); - printf("lololololool PADDING WTF :O loloolololo \n"); printf("lololol PADDING WTF :O lolololololo \n"); printf("lololololool PADDING WTF :O lolololololo \n"); printf("lolololool PADDING WTF :O lololoololo \n"); @@ -144,16 +121,6 @@ struct usb_device *usb_add_device(u8 lowspeed, u32 reg) printf("lolololool PADDING WTF :O lolololololo \n"); printf("lololololool PADDING WTF :O lolololololo \n"); printf("lollllool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O loloolololo \n"); - printf("lololololool PADDING WTF lololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); - printf("lololololool PADDING WTF :O lolololololo \n"); #endif u8 address = usb_next_address(); ret = usb_set_address(dev, address); @@ -166,7 +133,7 @@ struct usb_device *usb_add_device(u8 lowspeed, u32 reg) return (void*) -1; /* print device info */ - lsusb(dev); + //lsusb(dev); //HID only! #define GET_PROTOCOL 0x03 @@ -182,32 +149,36 @@ struct usb_device *usb_add_device(u8 lowspeed, u32 reg) ret = usb_set_configuration(dev, 1); printf("=============\nusb_set_configuration(ret: %d): %d\n", ret, dev->conf->bConfigurationValue); wait_ms(500); +#if 0 + wait_ms(500); printf("=============\nusb_get_configuration: %d (should be 1 here)\n", usb_get_configuration(dev)); #endif +#endif -#if 0 +#if 1 memset(buf, 0, 0xff); - usb_control_msg(dev, 0x81, GET_DESCRIPTOR, 0x2200, 0x0, 0x41, buf, 0); + usb_control_msg(dev, (1<<5)|1, SET_CONFIGURATION, 0x200, 0x0, 0x0, buf, 0); printf("wtf request\n"); - hexdump((void*)buf, 0x41); + hexdump((void*)buf, 0x8); #endif + #if 0 /* set protocol */ /* see p48 in HID spec */ memset(buf, 0, 8); - usb_control_msg(dev, SETit, SET_PROTOCOL, 0, 0, 0, buf, 0); + usb_control_msg(dev, SETit, SET_PROTOCOL, 0 /*boot protocol*/, 0 /*interface number*/, 0 /*length*/, buf, 0); printf("=============\nhid_set_protocol %d\n", 0); hexdump((void*)buf, 8); #endif #if 0 memset(buf, 0, 8); usb_control_msg(dev, GETit, GET_PROTOCOL, 0, 0, 4, buf, 0); - printf("=============\nusb_get_interface: %d\n", buf[0]); + printf("=============\nusb_get_protocol: %d\n", buf[0]); hexdump((void*)buf, 8); #endif -#if 0 +#if 1 /* I just don't know why on some devices * {s,g}et_{configuration,interface} won't work. * may the setter works and getter are poorly implemented? @@ -570,7 +541,7 @@ u16 usb_submit_irp(struct usb_irp *irp) td->togl = togl; togl = togl ? 0 : 1; - /**** send token ****/ + /**** send token ****/ hcdi_enqueue(td, irp->dev->ohci); restlength = restlength - irp->epsize; free(td); diff --git a/usb/core/usb.c b/usb/core/usb.c index 935e36f..0a0cd7e 100644 --- a/usb/core/usb.c +++ b/usb/core/usb.c @@ -310,7 +310,7 @@ u8 usb_get_configuration(struct usb_device *dev) s8 usb_set_configuration(struct usb_device *dev, u8 configuration) { cleargbuf(); - usb_control_msg(dev, 0x00, SET_CONFIGURATION, configuration<<8, 0, 0, gbuf, 0); + usb_control_msg(dev, 0x00, SET_CONFIGURATION, configuration, 0, 0, gbuf, 0); printf("=============\nafter usb_set_configuration:\n"); hexdump((void*) gbuf, 8); wait_ms(20); @@ -389,7 +389,7 @@ s8 usb_interrupt_read(struct usb_device *dev, u8 ep, u8 *buf, u8 size, u8 timeou { struct usb_irp *irp = (struct usb_irp*)malloc(sizeof(struct usb_irp)); irp->dev = dev; - irp->endpoint = ep | 0x80; //from device to host + irp->endpoint = ep; //wtf? |80; //from device to host irp->epsize = dev->epSize[ep]; // ermitteln irp->type = USB_INTR; -- 2.25.1