From a160aa2f4d9d2df95e051e49de2a0235efa62c3b Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 22 Sep 2009 15:57:55 +0200 Subject: [PATCH] usb_{s,g}et_configuration doing it wrong :/ --- usb/Makefile | 2 +- usb/core/core.c | 8 +++++--- usb/core/usb.c | 7 +++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/usb/Makefile b/usb/Makefile index 0171494..ddd11fb 100644 --- a/usb/Makefile +++ b/usb/Makefile @@ -3,7 +3,7 @@ CFLAGS += -Wno-unused-parameter #debug flags; DU = Debug USB #CFLAGS += -D _DU_OHCI_F #fire @ u/h/ohci.c -#CFLAGS += -D _DU_OHCI_F_HALT #halted @ u/h/ohci.c +CFLAGS += -D _DU_OHCI_F_HALT #halted @ u/h/ohci.c #CFLAGS += -D _DU_OHCI_Q #enqueue @ u/h/ohci.c #CFLAGS += -D _DU_OHCI_RH #roothub @ u/h/ohci.c CFLAGS += -D _DU_CORE #@ u/c/core.c diff --git a/usb/core/core.c b/usb/core/core.c index 5a7c45e..0f30731 100644 --- a/usb/core/core.c +++ b/usb/core/core.c @@ -108,7 +108,6 @@ struct usb_device *usb_add_device() return (void*) -1; } - u8 buf[8]; //#define WTF #ifdef WTF printf("lololololool PADDING WTF :O lolololololo \n"); @@ -162,15 +161,18 @@ struct usb_device *usb_add_device() printf("=============\nusb_set_configuration(ret: %d) %d\n", ret, dev->conf->bConfigurationValue); printf("=============\nusb_get_configuration: %d\n", usb_get_configuration(dev)); +#if 0 + u8 buf[8]; memset(buf, 0, 8); - usb_control_msg(dev, 0x00, SET_INTERFACE, 0, dev->conf->intf->bInterfaceNumber, 8, buf, 0); + usb_control_msg(dev, 0x00, SET_INTERFACE, 0, dev->conf->intf->bInterfaceNumber, 0, buf, 0); printf("=============\nusb_set_interface: %d\n", dev->conf->intf->bInterfaceNumber); hexdump((void*)buf, 8); memset(buf, 0, 8); - usb_control_msg(dev, 0x80, GET_INTERFACE, 0, 0, 8, buf, 0); + usb_control_msg(dev, 0x81, GET_INTERFACE, 0, dev->conf->intf->bInterfaceNumber, 8, buf, 0); printf("=============\nusb_get_interface: %d\n", buf[0]); hexdump((void*)buf, 8); +#endif #if 0 /* add device to device list */ diff --git a/usb/core/usb.c b/usb/core/usb.c index 35460a5..c0ff3fb 100644 --- a/usb/core/usb.c +++ b/usb/core/usb.c @@ -286,9 +286,6 @@ s8 usb_get_desc_config_ext(struct usb_device *dev, u8 index, struct usb_conf *co off += 7; } } - - printf("=============\nafter usb_get_desc_config_ext:\n"); - hexdump((void*) gbuf, dev->conf->wTotalLength); return 0; } @@ -303,7 +300,9 @@ s8 usb_set_address(struct usb_device *dev, u8 address) u8 usb_get_configuration(struct usb_device *dev) { cleargbuf(); - usb_control_msg(dev, 0x80, GET_CONFIGURATION, 0, 0, 8, gbuf, 0); + usb_control_msg(dev, 0x80, GET_CONFIGURATION, 0, 0, 4, gbuf, 0); + printf("=============\nafter usb_get_configuration:\n"); + hexdump((void*) gbuf, 1); return gbuf[0]; } -- 2.25.1