Fixed Interface. Modified: trunk/reactos/drivers/usb/cromwell/core/config.c Modified: trunk/reactos/drivers/usb/cromwell/core/hcd.h Modified: trunk/reactos/drivers/usb/cromwell/core/hub.c Modified: trunk/reactos/drivers/usb/cromwell/core/message.c Modified: trunk/reactos/drivers/usb/cromwell/core/usb-debug.c Modified: trunk/reactos/drivers/usb/cromwell/core/usb.c Modified: trunk/reactos/drivers/usb/cromwell/linux/usb.h Modified: trunk/reactos/drivers/usb/cromwell/usb_wrapper.h _____
Modified: trunk/reactos/drivers/usb/cromwell/core/config.c --- trunk/reactos/drivers/usb/cromwell/core/config.c 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/config.c 2005-06-05 00:40:40 UTC (rev 15798) @@ -101,56 +101,56 @@
return parsed; }
-static int usb_parse_interface(struct usb_interface *pinterface, unsigned char *buffer, int size) +static int usb_parse_interface(struct usb_interface *interface, unsigned char *buffer, int size) { int i, len, numskipped, retval, parsed = 0; struct usb_descriptor_header *header; struct usb_host_interface *ifp; unsigned char *begin;
- pinterface->act_altsetting = 0; - pinterface->num_altsetting = 0; - pinterface->max_altsetting = USB_ALTSETTINGALLOC; - device_initialize(&pinterface->dev); + interface->act_altsetting = 0; + interface->num_altsetting = 0; + interface->max_altsetting = USB_ALTSETTINGALLOC; + device_initialize(&interface->dev);
- pinterface->altsetting = kmalloc(sizeof(*pinterface->altsetting) * pinterface->max_altsetting, + interface->altsetting = kmalloc(sizeof(*interface->altsetting) * interface->max_altsetting, GFP_KERNEL); - if (!pinterface->altsetting) { - err("couldn't kmalloc pinterface->altsetting"); + if (!interface->altsetting) { + err("couldn't kmalloc interface->altsetting"); return -1; }
while (size > 0) { struct usb_interface_descriptor *d; - if (pinterface->num_altsetting >= pinterface->max_altsetting) { + if (interface->num_altsetting >= interface->max_altsetting) { struct usb_host_interface *ptr; int oldmas;
- oldmas = pinterface->max_altsetting; - pinterface->max_altsetting += USB_ALTSETTINGALLOC; - if (pinterface->max_altsetting > USB_MAXALTSETTING) { + oldmas = interface->max_altsetting; + interface->max_altsetting += USB_ALTSETTINGALLOC; + if (interface->max_altsetting > USB_MAXALTSETTING) { warn("too many alternate settings (incr %d max %d)\n", USB_ALTSETTINGALLOC, USB_MAXALTSETTING); return -1; }
- ptr = kmalloc(sizeof(*ptr) * pinterface->max_altsetting, GFP_KERNEL); + ptr = kmalloc(sizeof(*ptr) * interface->max_altsetting, GFP_KERNEL); if (ptr == NULL) { - err("couldn't kmalloc pinterface->altsetting"); + err("couldn't kmalloc interface->altsetting"); return -1; } - memcpy(ptr, pinterface->altsetting, sizeof(*pinterface->altsetting) * oldmas); - kfree(pinterface->altsetting); - pinterface->altsetting = ptr; + memcpy(ptr, interface->altsetting, sizeof(*interface->altsetting) * oldmas); + kfree(interface->altsetting); + interface->altsetting = ptr; }
- ifp = pinterface->altsetting + pinterface->num_altsetting; + ifp = interface->altsetting + interface->num_altsetting; ifp->endpoint = NULL; ifp->extra = NULL; ifp->extralen = 0; - pinterface->num_altsetting++; + interface->num_altsetting++;
memcpy(ifp, buffer, USB_DT_INTERFACE_SIZE);
@@ -268,16 +268,16 @@ return -1; }
- config->pinterface = (struct usb_interface *) + config->interface = (struct usb_interface *) kmalloc(config->desc.bNumInterfaces * sizeof(struct usb_interface), GFP_KERNEL); - dbg("kmalloc IF %p, numif %i", config->pinterface, config->desc.bNumInterfaces); - if (!config->pinterface) { + dbg("kmalloc IF %p, numif %i", config->interface, config->desc.bNumInterfaces); + if (!config->interface) { err("out of memory"); return -1; }
- memset(config->pinterface, 0, + memset(config->interface, 0, config->desc.bNumInterfaces * sizeof(struct usb_interface));
buffer += config->desc.bLength; @@ -337,7 +337,7 @@ } }
- retval = usb_parse_interface(config->pinterface + i, buffer, size); + retval = usb_parse_interface(config->interface + i, buffer, size); if (retval < 0) return retval;
@@ -367,12 +367,12 @@ for (c = 0; c < dev->descriptor.bNumConfigurations; c++) { struct usb_host_config *cf = &dev->config[c];
- if (!cf->pinterface) + if (!cf->interface) break;
for (i = 0; i < cf->desc.bNumInterfaces; i++) { struct usb_interface *ifp = - &cf->pinterface[i]; + &cf->interface[i]; if (!ifp->altsetting) break; @@ -398,7 +398,7 @@
kfree(ifp->altsetting); } - kfree(cf->pinterface); + kfree(cf->interface); } kfree(dev->config); } _____
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd.h --- trunk/reactos/drivers/usb/cromwell/core/hcd.h 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/hcd.h 2005-06-05 00:40:40 UTC (rev 15798) @@ -424,7 +424,7 @@
extern void usb_bus_put (struct usb_bus *bus);
extern int usb_find_interface_driver (struct usb_device *dev, - struct usb_interface *pinterface); + struct usb_interface *interface);
#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
_____
Modified: trunk/reactos/drivers/usb/cromwell/core/hub.c --- trunk/reactos/drivers/usb/cromwell/core/hub.c 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/hub.c 2005-06-05 00:40:40 UTC (rev 15798) @@ -67,7 +67,7 @@
/* for dev_info, dev_dbg, etc */ static inline struct device *hubdev (struct usb_device *dev) { - return &dev->actconfig->pinterface [0].dev; + return &dev->actconfig->interface [0].dev; }
/* USB 2.0 spec Section 11.24.4.5 */ @@ -700,7 +700,7 @@ static int hub_port_status(struct usb_device *dev, int port, u16 *status, u16 *change) { - struct usb_hub *hub = usb_get_intfdata (dev->actconfig->pinterface); + struct usb_hub *hub = usb_get_intfdata (dev->actconfig->interface); int ret;
ret = get_port_status(dev, port + 1, &hub->status->port); @@ -1377,7 +1377,7 @@ }
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { - struct usb_interface *intf = &dev->actconfig->pinterface[i]; + struct usb_interface *intf = &dev->actconfig->interface[i]; struct usb_interface_descriptor *as;
as = &intf->altsetting[intf->act_altsetting].desc; _____
Modified: trunk/reactos/drivers/usb/cromwell/core/message.c --- trunk/reactos/drivers/usb/cromwell/core/message.c 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/message.c 2005-06-05 00:40:40 UTC (rev 15798) @@ -683,7 +683,7 @@
/* NOTE: affects all endpoints _except_ ep0 */ for (i=0; i<dev->actconfig->desc.bNumInterfaces; i++) { - struct usb_interface *ifp = dev->actconfig->pinterface + i; + struct usb_interface *ifp = dev->actconfig->interface + i; struct usb_host_interface *as = ifp->altsetting + ifp->act_altsetting; struct usb_host_endpoint *ep = as->endpoint; int e; @@ -800,16 +800,16 @@ * Returns zero on success, or else the status code returned by the * underlying usb_control_msg() call. */ -int usb_set_interface(struct usb_device *dev, int pinterface, int alternate) +int usb_set_interface(struct usb_device *dev, int interface, int alternate) { struct usb_interface *iface; struct usb_host_interface *iface_as; int i, ret; void (*disable)(struct usb_device *, int) = dev->bus->op->disable;
- iface = usb_ifnum_to_if(dev, pinterface); + iface = usb_ifnum_to_if(dev, interface); if (!iface) { - warn("selecting invalid interface %d", pinterface); + warn("selecting invalid interface %d", interface); return -EINVAL; }
@@ -817,7 +817,7 @@ only has one alternate setting */ if (iface->num_altsetting == 1) { dbg("ignoring set_interface for dev %d, iface %d, alt %d", - dev->devnum, pinterface, alternate); + dev->devnum, interface, alternate); return 0; }
@@ -828,7 +828,7 @@ USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE, iface->altsetting[alternate] .desc.bAlternateSetting, - pinterface, NULL, 0, HZ * 5)) < 0) + interface, NULL, 0, HZ * 5)) < 0) return ret;
/* FIXME drivers shouldn't need to replicate/bugfix the logic here _____
Modified: trunk/reactos/drivers/usb/cromwell/core/usb-debug.c --- trunk/reactos/drivers/usb/cromwell/core/usb-debug.c 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/usb-debug.c 2005-06-05 00:40:40 UTC (rev 15798) @@ -42,7 +42,7 @@
usb_show_config_descriptor(&config->desc); for (i = 0; i < config->desc.bNumInterfaces; i++) { - ifp = config->pinterface + i; + ifp = config->interface + i;
if (!ifp) break; _____
Modified: trunk/reactos/drivers/usb/cromwell/core/usb.c --- trunk/reactos/drivers/usb/cromwell/core/usb.c 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/core/usb.c 2005-06-05 00:40:40 UTC (rev 15798) @@ -212,9 +212,9 @@
int i;
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) - if (dev->actconfig->pinterface[i].altsetting[0] + if (dev->actconfig->interface[i].altsetting[0] .desc.bInterfaceNumber == ifnum) - return &dev->actconfig->pinterface[i]; + return &dev->actconfig->interface[i];
return NULL; } @@ -239,13 +239,13 @@ int i, j, k;
for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) - for (j = 0; j < dev->actconfig->pinterface[i].num_altsetting; j++) - for (k = 0; k < dev->actconfig->pinterface[i] + for (j = 0; j < dev->actconfig->interface[i].num_altsetting; j++) + for (k = 0; k < dev->actconfig->interface[i] .altsetting[j].desc.bNumEndpoints; k++) - if (epnum == dev->actconfig->pinterface[i] + if (epnum == dev->actconfig->interface[i]
.altsetting[j].endpoint[k] .desc.bEndpointAddress) - return &dev->actconfig->pinterface[i] + return &dev->actconfig->interface[i]
.altsetting[j].endpoint[k] .desc;
@@ -392,7 +392,7 @@ * its associated class and subclass. */ const struct usb_device_id * -usb_match_id(struct usb_interface *pinterface, const struct usb_device_id *id) +usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) { struct usb_host_interface *intf; struct usb_device *dev; @@ -401,8 +401,8 @@ if (id == NULL) return NULL;
- intf = &pinterface->altsetting [pinterface->act_altsetting]; - dev = interface_to_usbdev(pinterface); + intf = &interface->altsetting [interface->act_altsetting]; + dev = interface_to_usbdev(interface);
/* It is important to check that id->driver_info is nonzero, since an entry that is all zeroes except for a nonzero @@ -902,11 +902,11 @@ dev_dbg (&dev->dev, "unregistering interfaces\n"); if (dev->actconfig) { for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { - struct usb_interface *pinterface; + struct usb_interface *interface;
/* remove this interface */ - pinterface = &dev->actconfig->pinterface[i]; - device_unregister(&pinterface->dev); + interface = &dev->actconfig->interface[i]; + device_unregister(&interface->dev); } }
@@ -1210,35 +1210,35 @@ /* Register all of the interfaces for this device with the driver core. * Remember, interfaces get bound to drivers, not devices. */ for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { - struct usb_interface *pinterface = &dev->actconfig->pinterface[i]; + struct usb_interface *interface = &dev->actconfig->interface[i]; struct usb_interface_descriptor *desc;
- desc = &pinterface->altsetting [pinterface->act_altsetting].desc; - pinterface->dev.parent = &dev->dev; - pinterface->dev.driver = NULL; - pinterface->dev.bus = &usb_bus_type; - pinterface->dev.dma_mask = parent->dma_mask; - sprintf (&pinterface->dev.bus_id[0], "%d-%s:%d", + desc = &interface->altsetting [interface->act_altsetting].desc; + interface->dev.parent = &dev->dev; + interface->dev.driver = NULL; + interface->dev.bus = &usb_bus_type; + interface->dev.dma_mask = parent->dma_mask; + sprintf (&interface->dev.bus_id[0], "%d-%s:%d", dev->bus->busnum, dev->devpath, desc->bInterfaceNumber); if (!desc->iInterface || usb_string (dev, desc->iInterface, - pinterface->dev.name, - sizeof pinterface->dev.name) <= 0) { + interface->dev.name, + sizeof interface->dev.name) <= 0) { /* typically devices won't bother with interface * descriptions; this is the normal case. an * interface's driver might describe it better. * (also: iInterface is per-altsetting ...) */ - sprintf (&pinterface->dev.name[0], + sprintf (&interface->dev.name[0], "usb-%s-%s interface %d", dev->bus->bus_name, dev->devpath, desc->bInterfaceNumber); - DPRINT1("usb_new_device: %s\n", pinterface->dev.name); + DPRINT1("usb_new_device: %s\n", interface->dev.name); } - dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, pinterface->dev.bus_id); - device_add (&pinterface->dev); - usb_create_driverfs_intf_files (pinterface); + dev_dbg (&dev->dev, "%s - registering interface %s\n", __FUNCTION__, interface->dev.bus_id); + device_add (&interface->dev); + usb_create_driverfs_intf_files (interface); } /* add a /proc/bus/usb entry */ usbfs_add_device(dev); _____
Modified: trunk/reactos/drivers/usb/cromwell/linux/usb.h --- trunk/reactos/drivers/usb/cromwell/linux/usb.h 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/linux/usb.h 2005-06-05 00:40:40 UTC (rev 15798) @@ -150,13 +150,13 @@
*/ struct usb_host_config { struct usb_config_descriptor desc; -// -// /* the interfaces associated with this configuration -// * these will be in numeric order, 0..desc.bNumInterfaces -// */ -// - struct usb_interface *pinterface; + + /* the interfaces associated with this configuration + * these will be in numeric order, 0..desc.bNumInterfaces + */
+ struct usb_interface *interface; + unsigned char *extra; /* Extra descriptors */ int extralen; }; @@ -292,7 +292,7 @@ extern int usb_interface_claimed(struct usb_interface *iface); extern void usb_driver_release_interface(struct usb_driver *driver, struct usb_interface *iface); -const struct usb_device_id *usb_match_id(struct usb_interface *pinterface, +const struct usb_device_id *usb_match_id(struct usb_interface *interface, const struct usb_device_id *id);
extern struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor); _____
Modified: trunk/reactos/drivers/usb/cromwell/usb_wrapper.h --- trunk/reactos/drivers/usb/cromwell/usb_wrapper.h 2005-06-04 22:53:14 UTC (rev 15797) +++ trunk/reactos/drivers/usb/cromwell/usb_wrapper.h 2005-06-05 00:40:40 UTC (rev 15798) @@ -2,7 +2,6 @@
//#include <ntos/types.h> //#include <ddk/extypes.h> #include <ddk/ntddk.h> -#define NDEBUG #include <debug.h>
void wait_ms(int mils); @@ -17,6 +16,8 @@ int swprintf(wchar_t *buf, const wchar_t *fmt, ...); #endif
+#undef interface + #include "linux/linux_wrapper.h" #define __KERNEL__ #undef CONFIG_PCI