SVN maintenance:
Set svn:eol-style and svn:keywords for files
Set svn:ignore for directories
Modified: trunk/reactos/drivers/usb/cromwell/Makefile
Modified: trunk/reactos/drivers/usb/cromwell/core/buffer_simple.c
Modified: trunk/reactos/drivers/usb/cromwell/core/config.c
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd.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/hub.h
Modified: trunk/reactos/drivers/usb/cromwell/core/makefile
Modified: trunk/reactos/drivers/usb/cromwell/core/makefile.crom
Modified: trunk/reactos/drivers/usb/cromwell/core/message.c
Modified: trunk/reactos/drivers/usb/cromwell/core/urb.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/core/usb.h
Modified: trunk/reactos/drivers/usb/cromwell/core/usbcore.c
Modified: trunk/reactos/drivers/usb/cromwell/core/usbcore.def
Modified: trunk/reactos/drivers/usb/cromwell/core/usbcore.rc
Modified: trunk/reactos/drivers/usb/cromwell/host/makefile
Modified: trunk/reactos/drivers/usb/cromwell/host/makefile.crom
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-dbg.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-hcd.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-hub.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-mem.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-pci.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci-q.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci.def
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci.h
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci.rc
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci_config.h
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci_main.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci_main.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/asm/bitops.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/bitops.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/boot.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/consts.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/cromwell_types.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/errno.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/list.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_hal.c
Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_ids.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/usb.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/usb_ch9.h
Modified: trunk/reactos/drivers/usb/cromwell/sys/BootUSB.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/Makefile
Modified: trunk/reactos/drivers/usb/cromwell/sys/linuxwrapper.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/risefall.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/ros_wrapper.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/usbkey.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/usbwrapper.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/xpad.c
Modified: trunk/reactos/drivers/usb/cromwell/sys/xremote.c
Modified: trunk/reactos/drivers/usb/cromwell/uhci/makefile
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci.def
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci.rc
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci_config.h
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci_main.c
Modified: trunk/reactos/drivers/usb/cromwell/usb_wrapper.h
Property changes on: trunk/reactos/drivers/usb/cromwell
___________________________________________________________________
Name: svn:ignore
+ *.coff
*.sym
*.o
*.a
*.dll
*.map
*.tmp
.*.d
_____
Modified: trunk/reactos/drivers/usb/cromwell/Makefile
--- trunk/reactos/drivers/usb/cromwell/Makefile 2005-05-20 21:43:57 UTC
(rev 15439)
+++ trunk/reactos/drivers/usb/cromwell/Makefile 2005-05-20 21:53:08 UTC
(rev 15440)
@@ -1,50 +1,50 @@
-#
-# ReactOS USB-Cromwell Drivers
-#
-
-PATH_TO_TOP = ../../..
-
-include $(PATH_TO_TOP)/rules.mak
-
-DRIVERS = core host uhci
-
-all: $(DRIVERS)
-
-depends:
-
-implib: $(DRIVERS:%=%_implib)
-
-clean: $(DRIVERS:%=%_clean)
-
-install: $(DRIVERS:%=%_install)
-
-bootcd: $(DRIVERS:%=%_bootcd)
-
-.PHONY: all depends implib clean install bootcd
-
-
-#
-# USB DRIVERS
-#
-$(DRIVERS): %:
- $(MAKE) -C $*
-
-$(DRIVERS:%=%_implib): %_implib:
- $(MAKE) -C $* implib
-
-$(DRIVERS:%=%_clean): %_clean:
- $(MAKE) -C $* clean
-
-$(DRIVERS:%=%_install): %_install:
- $(MAKE) -C $* install
-
-$(DRIVERS:%=%_bootcd): %_bootcd:
- $(MAKE) -C $* bootcd
-
-.PHONY: $(DRIVERS) $(DRIVERS:%=%_implib) $(DRIVERS:%=%_clean)
$(DRIVERS:%=%_install) $(DRIVERS:%=%_bootcd)
-
-
-etags:
- find . -name "*.[ch]" -print | etags --language=c -
-
-# EOF
+#
+# ReactOS USB-Cromwell Drivers
+#
+
+PATH_TO_TOP = ../../..
+
+include $(PATH_TO_TOP)/rules.mak
+
+DRIVERS = core host uhci
+
+all: $(DRIVERS)
+
+depends:
+
+implib: $(DRIVERS:%=%_implib)
+
+clean: $(DRIVERS:%=%_clean)
+
+install: $(DRIVERS:%=%_install)
+
+bootcd: $(DRIVERS:%=%_bootcd)
+
+.PHONY: all depends implib clean install bootcd
+
+
+#
+# USB DRIVERS
+#
+$(DRIVERS): %:
+ $(MAKE) -C $*
+
+$(DRIVERS:%=%_implib): %_implib:
+ $(MAKE) -C $* implib
+
+$(DRIVERS:%=%_clean): %_clean:
+ $(MAKE) -C $* clean
+
+$(DRIVERS:%=%_install): %_install:
+ $(MAKE) -C $* install
+
+$(DRIVERS:%=%_bootcd): %_bootcd:
+ $(MAKE) -C $* bootcd
+
+.PHONY: $(DRIVERS) $(DRIVERS:%=%_implib) $(DRIVERS:%=%_clean)
$(DRIVERS:%=%_install) $(DRIVERS:%=%_bootcd)
+
+
+etags:
+ find . -name "*.[ch]" -print | etags --language=c -
+
+# EOF
Property changes on: trunk/reactos/drivers/usb/cromwell/Makefile
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native
Property changes on: trunk/reactos/drivers/usb/cromwell/core
___________________________________________________________________
Name: svn:ignore
- *.coff
*.a
*.d
*.o
*.sym
*.sys
*.map
*.tmp
+ *.coff
*.sym
*.o
*.a
*.dll
*.map
*.tmp
.*.d
_____
Modified: trunk/reactos/drivers/usb/cromwell/core/buffer_simple.c
--- trunk/reactos/drivers/usb/cromwell/core/buffer_simple.c
2005-05-20 21:43:57 UTC (rev 15439)
+++ trunk/reactos/drivers/usb/cromwell/core/buffer_simple.c
2005-05-20 21:53:08 UTC (rev 15440)
@@ -1,42 +1,42 @@
-/*
- * buffer_simple.c -- replacement for usb/core/buffer.c
- *
- * (c) Georg Acher, georg(a)acher.org
- *
- */
-
-#include "../usb_wrapper.h"
-#define __KERNEL__
-#define CONFIG_PCI
-#include "hcd.h"
-
-/*---------------------------------------------------------------------
---*/
-int hcd_buffer_create (struct usb_hcd *hcd)
-{
- return 0;
-}
-/*---------------------------------------------------------------------
---*/
-void hcd_buffer_destroy (struct usb_hcd *hcd)
-{
-}
-/*---------------------------------------------------------------------
---*/
-void *hcd_buffer_alloc (
- struct usb_bus *bus,
- size_t size,
- int mem_flags,
- dma_addr_t *dma
-)
-{
- return kmalloc(size,0);
-}
-/*---------------------------------------------------------------------
---*/
-void hcd_buffer_free (
- struct usb_bus *bus,
- size_t size,
- void *addr,
- dma_addr_t dma
-)
-{
- kfree(addr);
-}
-
+/*
+ * buffer_simple.c -- replacement for usb/core/buffer.c
+ *
+ * (c) Georg Acher, georg(a)acher.org
+ *
+ */
+
+#include "../usb_wrapper.h"
+#define __KERNEL__
+#define CONFIG_PCI
+#include "hcd.h"
+
+/*---------------------------------------------------------------------
---*/
+int hcd_buffer_create (struct usb_hcd *hcd)
+{
+ return 0;
+}
+/*---------------------------------------------------------------------
---*/
+void hcd_buffer_destroy (struct usb_hcd *hcd)
+{
+}
+/*---------------------------------------------------------------------
---*/
+void *hcd_buffer_alloc (
+ struct usb_bus *bus,
+ size_t size,
+ int mem_flags,
+ dma_addr_t *dma
+)
+{
+ return kmalloc(size,0);
+}
+/*---------------------------------------------------------------------
---*/
+void hcd_buffer_free (
+ struct usb_bus *bus,
+ size_t size,
+ void *addr,
+ dma_addr_t dma
+)
+{
+ kfree(addr);
+}
+
Property changes on:
trunk/reactos/drivers/usb/cromwell/core/buffer_simple.c
___________________________________________________________________
Name: svn:keywords
+ author date id revision
Name: svn:eol-style
+ native
_____
Modified: trunk/reactos/drivers/usb/cromwell/core/config.c
--- trunk/reactos/drivers/usb/cromwell/core/config.c 2005-05-20
21:43:57 UTC (rev 15439)
+++ trunk/reactos/drivers/usb/cromwell/core/config.c 2005-05-20
21:53:08 UTC (rev 15440)
@@ -1,508 +1,508 @@
-#if 0
-#include <linux/usb.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-#include <asm/byteorder.h>
-#else
-#include "../usb_wrapper.h"
-#endif
-
-#define USB_MAXALTSETTING 128 /* Hard limit */
-#define USB_MAXENDPOINTS 30 /* Hard limit */
-
-/* these maximums are arbitrary */
-#define USB_MAXCONFIG 8
-#define USB_ALTSETTINGALLOC 4
-#define USB_MAXINTERFACES 32
-
-static int usb_parse_endpoint(struct usb_host_endpoint *endpoint,
unsigned char *buffer, int size)
-{
- struct usb_descriptor_header *header;
- unsigned char *begin;
- int parsed = 0, len, numskipped;
-
- header = (struct usb_descriptor_header *)buffer;
-
- /* Everything should be fine being passed into here, but we
sanity */
- /* check JIC */
- if (header->bLength > size) {
- err("ran out of descriptors parsing");
- return -1;
- }
-
- if (header->bDescriptorType != USB_DT_ENDPOINT) {
- warn("unexpected descriptor 0x%X, expecting endpoint,
0x%X",
- header->bDescriptorType, USB_DT_ENDPOINT);
- return parsed;
- }
-
- if (header->bLength == USB_DT_ENDPOINT_AUDIO_SIZE)
- memcpy(&endpoint->desc, buffer,
USB_DT_ENDPOINT_AUDIO_SIZE);
- else
- memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_SIZE);
-
- le16_to_cpus(&endpoint->desc.wMaxPacketSize);
-
- buffer += header->bLength;
- size -= header->bLength;
- parsed += header->bLength;
-
- /* Skip over the rest of the Class Specific or Vendor Specific
*/
- /* descriptors */
- begin = buffer;
- numskipped = 0;
- while (size >= sizeof(struct usb_descriptor_header)) {
- header = (struct usb_descriptor_header *)buffer;
-
- if (header->bLength < 2) {
- err("invalid descriptor length of %d",
header->bLength);
- return -1;
- }
-
- /* If we find another "proper" descriptor then we're
done */
- if ((header->bDescriptorType == USB_DT_ENDPOINT) ||
- (header->bDescriptorType == USB_DT_INTERFACE) ||
- (header->bDescriptorType == USB_DT_CONFIG) ||
- (header->bDescriptorType == USB_DT_DEVICE))
- break;
-
- dbg("skipping descriptor 0x%X",
- header->bDescriptorType);
- numskipped++;
-
- buffer += header->bLength;
- size -= header->bLength;
- parsed += header->bLength;
- }
- if (numskipped)
- dbg("skipped %d class/vendor specific endpoint
descriptors", numskipped);
-
- /* Copy any unknown descriptors into a storage area for drivers
*/
- /* to later parse */
- len = (int)(buffer - begin);
- if (!len) {
- endpoint->extra = NULL;
- endpoint->extralen = 0;
- return parsed;
- }
-
- endpoint->extra = kmalloc(len, GFP_KERNEL);
-
- if (!endpoint->extra) {
- err("couldn't allocate memory for endpoint extra
descriptors");
- endpoint->extralen = 0;
- return parsed;
- }
-
- memcpy(endpoint->extra, begin, len);
- endpoint->extralen = len;
-
- return parsed;
-}
-
-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;
-
- interface->act_altsetting = 0;
- interface->num_altsetting = 0;
- interface->max_altsetting = USB_ALTSETTINGALLOC;
- device_initialize(&interface->dev);
-
- interface->altsetting = kmalloc(sizeof(*interface->altsetting) *
interface->max_altsetting,
- GFP_KERNEL);
-
- if (!interface->altsetting) {
- err("couldn't kmalloc interface->altsetting");
- return -1;
- }
-
- while (size > 0) {
- struct usb_interface_descriptor *d;
-
- if (interface->num_altsetting >=
interface->max_altsetting) {
- struct usb_host_interface *ptr;
- int oldmas;
-
- 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) *
interface->max_altsetting, GFP_KERNEL);
- if (ptr == NULL) {
- err("couldn't kmalloc
interface->altsetting");
- return -1;
- }
- memcpy(ptr, interface->altsetting,
sizeof(*interface->altsetting) * oldmas);
- kfree(interface->altsetting);
- interface->altsetting = ptr;
- }
-
- ifp = interface->altsetting + interface->num_altsetting;
- ifp->endpoint = NULL;
- ifp->extra = NULL;
- ifp->extralen = 0;
- interface->num_altsetting++;
-
- memcpy(ifp, buffer, USB_DT_INTERFACE_SIZE);
-
- /* Skip over the interface */
- buffer += ifp->desc.bLength;
- parsed += ifp->desc.bLength;
- size -= ifp->desc.bLength;
-
- begin = buffer;
- numskipped = 0;
-
- /* Skip over any interface, class or vendor descriptors
*/
- while (size >= sizeof(struct usb_descriptor_header)) {
- header = (struct usb_descriptor_header *)buffer;
-
- if (header->bLength < 2) {
- err("invalid descriptor length of %d",
header->bLength);
- return -1;
- }
-
- /* If we find another "proper" descriptor then
we're done */
- if ((header->bDescriptorType ==
USB_DT_INTERFACE) ||
- (header->bDescriptorType == USB_DT_ENDPOINT)
||
- (header->bDescriptorType == USB_DT_CONFIG)
||
- (header->bDescriptorType == USB_DT_DEVICE))
- break;
-
- numskipped++;
-
- buffer += header->bLength;
- parsed += header->bLength;
- size -= header->bLength;
- }
-
- if (numskipped)
- dbg("skipped %d class/vendor specific interface
descriptors", numskipped);
-
- /* Copy any unknown descriptors into a storage area for
*/
- /* drivers to later parse */
- len = (int)(buffer - begin);
- if (len) {
- ifp->extra = kmalloc(len, GFP_KERNEL);
-
- if (!ifp->extra) {
- err("couldn't allocate memory for
interface extra descriptors");
- ifp->extralen = 0;
- return -1;
- }
- memcpy(ifp->extra, begin, len);
- ifp->extralen = len;
- }
-
- /* Did we hit an unexpected descriptor? */
- header = (struct usb_descriptor_header *)buffer;
- if ((size >= sizeof(struct usb_descriptor_header)) &&
- ((header->bDescriptorType == USB_DT_CONFIG) ||
- (header->bDescriptorType == USB_DT_DEVICE)))
- return parsed;
-
- if (ifp->desc.bNumEndpoints > USB_MAXENDPOINTS) {
- warn("too many endpoints");
- return -1;
- }
-
- ifp->endpoint = (struct usb_host_endpoint *)
- kmalloc(ifp->desc.bNumEndpoints *
- sizeof(struct usb_host_endpoint), GFP_KERNEL);
- if (!ifp->endpoint) {
- err("out of memory");
- return -1;
- }
-
- memset(ifp->endpoint, 0, ifp->desc.bNumEndpoints *
- sizeof(struct usb_host_endpoint));
-
- for (i = 0; i < ifp->desc.bNumEndpoints; i++) {
- header = (struct usb_descriptor_header *)buffer;
-
- if (header->bLength > size) {
- err("ran out of descriptors parsing");
- return -1;
- }
-
- retval = usb_parse_endpoint(ifp->endpoint + i,
buffer, size);
- if (retval < 0)
- return retval;
-
- buffer += retval;
- parsed += retval;
- size -= retval;
- }
-
- /* We check to see if it's an alternate to this one */
- d = (struct usb_interface_descriptor *)buffer;
- if (size < USB_DT_INTERFACE_SIZE
- || d->bDescriptorType !=
USB_DT_INTERFACE
- || !d->bAlternateSetting)
- return parsed;
- }
-
- return parsed;
-}
-
-int usb_parse_configuration(struct usb_host_config *config, char
*buffer)
-{
- int i, retval, size;
- struct usb_descriptor_header *header;
-
- memcpy(&config->desc, buffer, USB_DT_CONFIG_SIZE);
- le16_to_cpus(&config->desc.wTotalLength);
- size = config->desc.wTotalLength;
-
- if (config->desc.bNumInterfaces > USB_MAXINTERFACES) {
- warn("too many interfaces");
- return -1;
- }
-
- config->interface = (struct usb_interface *)
- kmalloc(config->desc.bNumInterfaces *
- sizeof(struct usb_interface), GFP_KERNEL);
- dbg("kmalloc IF %p, numif %i", config->interface,
config->desc.bNumInterfaces);
- if (!config->interface) {
- err("out of memory");
- return -1;
- }
-
- memset(config->interface, 0,
- config->desc.bNumInterfaces * sizeof(struct
usb_interface));
-
- buffer += config->desc.bLength;
- size -= config->desc.bLength;
-
- config->extra = NULL;
- config->extralen = 0;
-
- for (i = 0; i < config->desc.bNumInterfaces; i++) {
- int numskipped, len;
- char *begin;
-
- /* Skip over the rest of the Class Specific or Vendor */
- /* Specific descriptors */
- begin = buffer;
- numskipped = 0;
- while (size >= sizeof(struct usb_descriptor_header)) {
- header = (struct usb_descriptor_header *)buffer;
-
- if ((header->bLength > size) || (header->bLength
< 2)) {
- err("invalid descriptor length of %d",
header->bLength);
- return -1;
- }
-
- /* If we find another "proper" descriptor then
we're done */
- if ((header->bDescriptorType == USB_DT_ENDPOINT)
||
- (header->bDescriptorType ==
USB_DT_INTERFACE) ||
- (header->bDescriptorType == USB_DT_CONFIG)
||
- (header->bDescriptorType == USB_DT_DEVICE))
- break;
-
- dbg("skipping descriptor 0x%X",
header->bDescriptorType);
- numskipped++;
-
- buffer += header->bLength;
- size -= header->bLength;
- }
- if (numskipped)
- dbg("skipped %d class/vendor specific endpoint
descriptors", numskipped);
-
- /* Copy any unknown descriptors into a storage area for
*/
- /* drivers to later parse */
- len = (int)(buffer - begin);
- if (len) {
- if (config->extralen) {
- warn("extra config descriptor");
- } else {
- config->extra = kmalloc(len,
GFP_KERNEL);
- if (!config->extra) {
- err("couldn't allocate memory
for config extra descriptors");
- config->extralen = 0;
- return -1;
- }
-
- memcpy(config->extra, begin, len);
- config->extralen = len;
- }
- }
-
- retval = usb_parse_interface(config->interface + i,
buffer, size);
- if (retval < 0)
- return retval;
-
- buffer += retval;
- size -= retval;
- }
-
- return size;
-}
-
-// hub-only!! ... and only exported for reset/reinit path.
-// otherwise used internally on disconnect/destroy path
-void usb_destroy_configuration(struct usb_device *dev)
-{
- int c, i, j, k;
-
- if (!dev->config)
- return;
-
- if (dev->rawdescriptors) {
- for (i = 0; i < dev->descriptor.bNumConfigurations; i++)
- kfree(dev->rawdescriptors[i]);
-
- kfree(dev->rawdescriptors);
- }
-
- for (c = 0; c < dev->descriptor.bNumConfigurations; c++) {
- struct usb_host_config *cf = &dev->config[c];
-
- if (!cf->interface)
- break;
-
- for (i = 0; i < cf->desc.bNumInterfaces; i++) {
- struct usb_interface *ifp =
- &cf->interface[i];
-
- if (!ifp->altsetting)
- break;
-
- for (j = 0; j < ifp->num_altsetting; j++) {
- struct usb_host_interface *as =
- &ifp->altsetting[j];
-
- if(as->extra) {
- kfree(as->extra);
- }
-
- if (!as->endpoint)
- break;
-
- for(k = 0; k < as->desc.bNumEndpoints;
k++) {
- if(as->endpoint[k].extra) {
-
kfree(as->endpoint[k].extra);
- }
- }
- kfree(as->endpoint);
- }
-
- kfree(ifp->altsetting);
- }
- kfree(cf->interface);
- }
- kfree(dev->config);
-}
-
-
-// hub-only!! ... and only in reset path, or usb_new_device()
-// (used by real hubs and virtual root hubs)
-int usb_get_configuration(struct usb_device *dev)
-{
- int result;
- unsigned int cfgno, length;
- unsigned char *buffer;
- unsigned char *bigbuffer;
- struct usb_config_descriptor *desc;
-
- if (dev->descriptor.bNumConfigurations > USB_MAXCONFIG) {
- warn("too many configurations");
- return -EINVAL;
- }
-
- if (dev->descriptor.bNumConfigurations < 1) {
- warn("not enough configurations");
- return -EINVAL;
- }
-
- dev->config = (struct usb_host_config *)
- kmalloc(dev->descriptor.bNumConfigurations *
- sizeof(struct usb_host_config), GFP_KERNEL);
- if (!dev->config) {
- err("out of memory");
- return -ENOMEM;
- }
- memset(dev->config, 0, dev->descriptor.bNumConfigurations *
- sizeof(struct usb_host_config));
-
- dev->rawdescriptors = (char **)kmalloc(sizeof(char *) *
- dev->descriptor.bNumConfigurations, GFP_KERNEL);
- if (!dev->rawdescriptors) {
- err("out of memory");
- return -ENOMEM;
- }
-
- buffer = kmalloc(8, GFP_KERNEL);
- if (!buffer) {
- err("unable to allocate memory for configuration
descriptors");
- return -ENOMEM;
- }
- desc = (struct usb_config_descriptor *)buffer;
-
- for (cfgno = 0; cfgno < dev->descriptor.bNumConfigurations;
cfgno++) {
- /* We grab the first 8 bytes so we know how long the
whole */
- /* configuration is */
- result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
buffer, 8);
- if (result < 8) {
- if (result < 0)
- err("unable to get descriptor");
- else {
- err("config descriptor too short
(expected %i, got %i)", 8, result);
- result = -EINVAL;
- }
- goto err;
- }
-
- /* Get the full buffer */
- length = le16_to_cpu(desc->wTotalLength);
-
- bigbuffer = kmalloc(length, GFP_KERNEL);
- if (!bigbuffer) {
- err("unable to allocate memory for configuration
descriptors");
- result = -ENOMEM;
- goto err;
- }
-
- /* Now that we know the length, get the whole thing */
- result = usb_get_descriptor(dev, USB_DT_CONFIG, cfgno,
bigbuffer, length);
- if (result < 0) {
- err("couldn't get all of config descriptors");
- kfree(bigbuffer);
- goto err;
- }
-
- if (result < length) {
- err("config descriptor too short (expected %i,
got %i)", length, result);
- result = -EINVAL;
- kfree(bigbuffer);
- goto err;
- }
-
- dev->rawdescriptors[cfgno] = bigbuffer;
-
- result = usb_parse_configuration(&dev->config[cfgno],
bigbuffer);
- if (result > 0)
- dbg("descriptor data left");
- else if (result < 0) {
- result = -EINVAL;
- goto err;
- }
- }
-
- kfree(buffer);
- return 0;
-err:
- kfree(buffer);
- dev->descriptor.bNumConfigurations = cfgno;
- return result;
-}
-
+#if 0
+#include <linux/usb.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <asm/byteorder.h>
+#else
+#include "../usb_wrapper.h"
+#endif
+
+#define USB_MAXALTSETTING 128 /* Hard limit */
+#define USB_MAXENDPOINTS 30 /* Hard limit */
+
+/* these maximums are arbitrary */
+#define USB_MAXCONFIG 8
+#define USB_ALTSETTINGALLOC 4
+#define USB_MAXINTERFACES 32
+
+static int usb_parse_endpoint(struct usb_host_endpoint *endpoint,
unsigned char *buffer, int size)
+{
+ struct usb_descriptor_header *header;
+ unsigned char *begin;
+ int parsed = 0, len, numskipped;
+
+ header = (struct usb_descriptor_header *)buffer;
+
+ /* Everything should be fine being passed into here, but we
sanity */
+ /* check JIC */
+ if (header->bLength > size) {
+ err("ran out of descriptors parsing");
+ return -1;
+ }
+
+ if (header->bDescriptorType != USB_DT_ENDPOINT) {
+ warn("unexpected descriptor 0x%X, expecting endpoint,
0x%X",
+ header->bDescriptorType, USB_DT_ENDPOINT);
+ return parsed;
+ }
+
+ if (header->bLength == USB_DT_ENDPOINT_AUDIO_SIZE)
+ memcpy(&endpoint->desc, buffer,
USB_DT_ENDPOINT_AUDIO_SIZE);
+ else
+ memcpy(&endpoint->desc, buffer, USB_DT_ENDPOINT_SIZE);
+
+ le16_to_cpus(&endpoint->desc.wMaxPacketSize);
+
+ buffer += header->bLength;
+ size -= header->bLength;
+ parsed += header->bLength;
+
+ /* Skip over the rest of the Class Specific or Vendor Specific
*/
+ /* descriptors */
+ begin = buffer;
+ numskipped = 0;
+ while (size >= sizeof(struct usb_descriptor_header)) {
+ header = (struct usb_descriptor_header *)buffer;
+
+ if (header->bLength < 2) {
+ err("invalid descriptor length of %d",
header->bLength);
+ return -1;
+ }
+
+ /* If we find another "proper" descriptor then we're
done */
+ if ((header->bDescriptorType == USB_DT_ENDPOINT) ||
+ (header->bDescriptorType == USB_DT_INTERFACE) ||
+ (header->bDescriptorType == USB_DT_CONFIG) ||
+ (header->bDescriptorType == USB_DT_DEVICE))
+ break;
+
+ dbg("skipping descriptor 0x%X",
+ header->bDescriptorType);
+ numskipped++;
+
+ buffer += header->bLength;
+ size -= header->bLength;
+ parsed += header->bLength;
+ }
+ if (numskipped)
+ dbg("skipped %d class/vendor specific endpoint
descriptors", numskipped);
+
+ /* Copy any unknown descriptors into a storage area for drivers
*/
+ /* to later parse */
+ len = (int)(buffer - begin);
+ if (!len) {
+ endpoint->extra = NULL;
+ endpoint->extralen = 0;
+ return parsed;
+ }
+
+ endpoint->extra = kmalloc(len, GFP_KERNEL);
+
+ if (!endpoint->extra) {
+ err("couldn't allocate memory for endpoint extra
descriptors");
+ endpoint->extralen = 0;
+ return parsed;
+ }
+
+ memcpy(endpoint->extra, begin, len);
+ endpoint->extralen = len;
+
+ return parsed;
+}
+
+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;
+
+ interface->act_altsetting = 0;
+ interface->num_altsetting = 0;
+ interface->max_altsetting = USB_ALTSETTINGALLOC;
+ device_initialize(&interface->dev);
+
+ interface->altsetting = kmalloc(sizeof(*interface->altsetting) *
interface->max_altsetting,
+ GFP_KERNEL);
+
+ if (!interface->altsetting) {
+ err("couldn't kmalloc interface->altsetting");
+ return -1;
+ }
+
+ while (size > 0) {
+ struct usb_interface_descriptor *d;
+
+ if (interface->num_altsetting >=
interface->max_altsetting) {
+ struct usb_host_interface *ptr;
+ int oldmas;
+
+ 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) *
interface->max_altsetting, GFP_KERNEL);
+ if (ptr == NULL) {
+ err("couldn't kmalloc
interface->altsetting");
+ return -1;
+ }
+ memcpy(ptr, interface->altsetting,
sizeof(*interface->altsetting) * oldmas);
+ kfree(interface->altsetting);
+ interface->altsetting = ptr;
+ }
+
+ ifp = interface->altsetting + interface->num_altsetting;
+ ifp->endpoint = NULL;
+ ifp->extra = NULL;
+ ifp->extralen = 0;
+ interface->num_altsetting++;
+
+ memcpy(ifp, buffer, USB_DT_INTERFACE_SIZE);
+
+ /* Skip over the interface */
+ buffer += ifp->desc.bLength;
+ parsed += ifp->desc.bLength;
+ size -= ifp->desc.bLength;
+
+ begin = buffer;
+ numskipped = 0;
+
+ /* Skip over any interface, class or vendor descriptors
*/
+ while (size >= sizeof(struct usb_descriptor_header)) {
+ header = (struct usb_descriptor_header *)buffer;
+
+ if (header->bLength < 2) {
+ err("invalid descriptor length of %d",
header->bLength);
+ return -1;
+ }
+
+ /* If we find another "proper" descriptor then
we're done */
+ if ((header->bDescriptorType ==
USB_DT_INTERFACE) ||
+ (header->bDescriptorType == USB_DT_ENDPOINT)
||
+ (header->bDescriptorType == USB_DT_CONFIG)
||
+ (header->bDescriptorType == USB_DT_DEVICE))
+ break;
+
+ numskipped++;
+
+ buffer += header->bLength;
+ parsed += header->bLength;
+ size -= header->bLength;
+ }
+
+ if (numskipped)
+ dbg("skipped %d class/vendor specific interface
descriptors", numskipped);
+
+ /* Copy any unknown descriptors into a storage area for
*/
+ /* drivers to later parse */
+ len = (int)(buffer - begin);
+ if (len) {
+ ifp->extra = kmalloc(len, GFP_KERNEL);
+
+ if (!ifp->extra) {
+ err("couldn't allocate memory for
interface extra descriptors");
+ ifp->extralen = 0;
+ return -1;
+ }
+ memcpy(ifp->extra, begin, len);
+ ifp->extralen = len;
+ }
+
+ /* Did we hit an unexpected descriptor? */
+ header = (struct usb_descriptor_header *)buffer;
+ if ((size >= sizeof(struct usb_descriptor_header)) &&
+ ((header->bDescriptorType == USB_DT_CONFIG) ||
+ (header->bDescriptorType == USB_DT_DEVICE)))
+ return parsed;
+
+ if (ifp->desc.bNumEndpoints > USB_MAXENDPOINTS) {
+ warn("too many endpoints");
+ return -1;
+ }
+
+ ifp->endpoint = (struct usb_host_endpoint *)
+ kmalloc(ifp->desc.bNumEndpoints *
+ sizeof(struct usb_host_endpoint), GFP_KERNEL);
+ if (!ifp->endpoint) {
+ err("out of memory");
+ return -1;
+ }
+
+ memset(ifp->endpoint, 0, ifp->desc.bNumEndpoints *
+ sizeof(struct usb_host_endpoint));
+
+ for (i = 0; i < ifp->desc.bNumEndpoints; i++) {
+ header = (struct usb_descriptor_header *)buffer;
+
+ if (header->bLength > size) {
+ err("ran out of descriptors parsing");
+ return -1;
+ }
+
+ retval = usb_parse_endpoint(ifp->endpoint + i,
buffer, size);
+ if (retval < 0)
+ return retval;
+
+ buffer += retval;
+ parsed += retval;
+ size -= retval;
+ }
+
+ /* We check to see if it's an alternate to this one */
+ d = (struct usb_interface_descriptor *)buffer;
+ if (size < USB_DT_INTERFACE_SIZE
+ || d->bDescriptorType !=
USB_DT_INTERFACE
+ || !d->bAlternateSetting)
+ return parsed;
[truncated at 1000 lines; 33775 more skipped]