1 /* SPDX-License-Identifier: GPL-2.0+ */
4 * Gerry Hamel, geh@ti.com, Texas Instruments
6 * Based on linux/drivers/usbd/usbd.h
8 * Copyright (c) 2000, 2001, 2002 Lineo
9 * Copyright (c) 2001 Hewlett Packard
12 * Stuart Lynne <sl@lineo.com>,
13 * Tom Rushworth <tbr@lineo.com>,
14 * Bruce Balden <balden@lineo.com>
17 #ifndef __USBDCORE_H__
18 #define __USBDCORE_H__
21 #include "usbdescriptors.h"
24 #define MAX_URBS_QUEUED 5
28 #define usberr(fmt,args...) serial_printf("ERROR: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
30 #define usberr(fmt,args...) do{}while(0)
34 #define usbdbg(fmt,args...) serial_printf("debug: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
36 #define usbdbg(fmt,args...) do{}while(0)
40 #define usbinfo(fmt,args...) serial_printf("info: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
42 #define usbinfo(fmt,args...) do{}while(0)
46 #define le16_to_cpu(x) (x)
50 #define inb(p) (*(volatile u8*)(p))
54 #define outb(val,p) (*(volatile u8*)(p) = (val))
58 #define inw(p) (*(volatile u16*)(p))
62 #define outw(val,p) (*(volatile u16*)(p) = (val))
66 #define inl(p) (*(volatile u32*)(p))
70 #define outl(val,p) (*(volatile u32*)(p) = (val))
74 #define insw(p,to,len) mmio_insw(p,to,len)
78 #define outsw(p,from,len) mmio_outsw(p,from,len)
82 #define insb(p,to,len) mmio_insb(p,to,len)
86 #define mmio_insw(r,b,l) ({ int __i ; \
89 for (__i = 0; __i < l; __i++) { \
90 *(__b2 + __i) = inw(r); \
96 #define mmio_outsw(r,b,l) ({ int __i; \
99 for (__i = 0; __i < l; __i++) { \
100 outw( *(__b2 + __i), r); \
106 #define mmio_insb(r,b,l) ({ int __i ; \
109 for (__i = 0; __i < l; __i++) { \
110 *(__b2 + __i) = inb(r); \
116 * Structure member address manipulation macros.
117 * These are used by client code (code using the urb_link routines), since
118 * the urb_link structure is embedded in the client data structures.
120 * Note: a macro offsetof equivalent to member_offset is defined in stddef.h
121 * but this is kept here for the sake of portability.
123 * p2surround returns a pointer to the surrounding structure given
124 * type of the surrounding structure, the name memb of the structure
125 * member pointed at by ptr. For example, if you have:
133 * char *cp = &thingy.z;
137 * &thingy == p2surround(struct foo, z, cp)
141 #define _cv_(ptr) ((char*)(void*)(ptr))
142 #define member_offset(type,memb) (_cv_(&(((type*)0)->memb))-(char*)0)
143 #define p2surround(type,memb,ptr) ((type*)(void*)(_cv_(ptr)-member_offset(type,memb)))
147 struct usb_endpoint_instance;
148 struct usb_interface_instance;
149 struct usb_configuration_instance;
150 struct usb_device_instance;
151 struct usb_bus_instance;
154 * Device and/or Interface Class codes
156 #define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
157 #define USB_CLASS_AUDIO 1
158 #define USB_CLASS_COMM 2
159 #define USB_CLASS_HID 3
160 #define USB_CLASS_PHYSICAL 5
161 #define USB_CLASS_PRINTER 7
162 #define USB_CLASS_MASS_STORAGE 8
163 #define USB_CLASS_HUB 9
164 #define USB_CLASS_DATA 10
165 #define USB_CLASS_APP_SPEC 0xfe
166 #define USB_CLASS_VENDOR_SPEC 0xff
171 #define USB_TYPE_STANDARD (0x00 << 5)
172 #define USB_TYPE_CLASS (0x01 << 5)
173 #define USB_TYPE_VENDOR (0x02 << 5)
174 #define USB_TYPE_RESERVED (0x03 << 5)
179 #define USB_RECIP_DEVICE 0x00
180 #define USB_RECIP_INTERFACE 0x01
181 #define USB_RECIP_ENDPOINT 0x02
182 #define USB_RECIP_OTHER 0x03
187 #define USB_DIR_OUT 0
188 #define USB_DIR_IN 0x80
193 #define USB_DT_DEVICE 0x01
194 #define USB_DT_CONFIG 0x02
195 #define USB_DT_STRING 0x03
196 #define USB_DT_INTERFACE 0x04
197 #define USB_DT_ENDPOINT 0x05
199 #define USB_DT_HID (USB_TYPE_CLASS | 0x01)
200 #define USB_DT_REPORT (USB_TYPE_CLASS | 0x02)
201 #define USB_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
202 #define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
205 * Descriptor sizes per descriptor type
207 #define USB_DT_DEVICE_SIZE 18
208 #define USB_DT_CONFIG_SIZE 9
209 #define USB_DT_INTERFACE_SIZE 9
210 #define USB_DT_ENDPOINT_SIZE 7
211 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
212 #define USB_DT_HUB_NONVAR_SIZE 7
213 #define USB_DT_HID_SIZE 9
218 #define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
219 #define USB_ENDPOINT_DIR_MASK 0x80
221 #define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
222 #define USB_ENDPOINT_XFER_CONTROL 0
223 #define USB_ENDPOINT_XFER_ISOC 1
224 #define USB_ENDPOINT_XFER_BULK 2
225 #define USB_ENDPOINT_XFER_INT 3
228 * USB Packet IDs (PIDs)
230 #define USB_PID_UNDEF_0 0xf0
231 #define USB_PID_OUT 0xe1
232 #define USB_PID_ACK 0xd2
233 #define USB_PID_DATA0 0xc3
234 #define USB_PID_PING 0xb4 /* USB 2.0 */
235 #define USB_PID_SOF 0xa5
236 #define USB_PID_NYET 0x96 /* USB 2.0 */
237 #define USB_PID_DATA2 0x87 /* USB 2.0 */
238 #define USB_PID_SPLIT 0x78 /* USB 2.0 */
239 #define USB_PID_IN 0x69
240 #define USB_PID_NAK 0x5a
241 #define USB_PID_DATA1 0x4b
242 #define USB_PID_PREAMBLE 0x3c /* Token mode */
243 #define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
244 #define USB_PID_SETUP 0x2d
245 #define USB_PID_STALL 0x1e
246 #define USB_PID_MDATA 0x0f /* USB 2.0 */
251 #define USB_REQ_GET_STATUS 0x00
252 #define USB_REQ_CLEAR_FEATURE 0x01
253 #define USB_REQ_SET_FEATURE 0x03
254 #define USB_REQ_SET_ADDRESS 0x05
255 #define USB_REQ_GET_DESCRIPTOR 0x06
256 #define USB_REQ_SET_DESCRIPTOR 0x07
257 #define USB_REQ_GET_CONFIGURATION 0x08
258 #define USB_REQ_SET_CONFIGURATION 0x09
259 #define USB_REQ_GET_INTERFACE 0x0A
260 #define USB_REQ_SET_INTERFACE 0x0B
261 #define USB_REQ_SYNCH_FRAME 0x0C
266 #define USB_REQ_GET_REPORT 0x01
267 #define USB_REQ_GET_IDLE 0x02
268 #define USB_REQ_GET_PROTOCOL 0x03
269 #define USB_REQ_SET_REPORT 0x09
270 #define USB_REQ_SET_IDLE 0x0A
271 #define USB_REQ_SET_PROTOCOL 0x0B
275 * USB Spec Release number
278 #define USB_BCD_VERSION 0x0110
282 * Device Requests (c.f Table 9-2)
285 #define USB_REQ_DIRECTION_MASK 0x80
286 #define USB_REQ_TYPE_MASK 0x60
287 #define USB_REQ_RECIPIENT_MASK 0x1f
289 #define USB_REQ_DEVICE2HOST 0x80
290 #define USB_REQ_HOST2DEVICE 0x00
292 #define USB_REQ_TYPE_STANDARD 0x00
293 #define USB_REQ_TYPE_CLASS 0x20
294 #define USB_REQ_TYPE_VENDOR 0x40
296 #define USB_REQ_RECIPIENT_DEVICE 0x00
297 #define USB_REQ_RECIPIENT_INTERFACE 0x01
298 #define USB_REQ_RECIPIENT_ENDPOINT 0x02
299 #define USB_REQ_RECIPIENT_OTHER 0x03
305 #define USB_STATUS_SELFPOWERED 0x01
306 #define USB_STATUS_REMOTEWAKEUP 0x02
308 #define USB_STATUS_HALT 0x01
314 #define USB_DESCRIPTOR_TYPE_DEVICE 0x01
315 #define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02
316 #define USB_DESCRIPTOR_TYPE_STRING 0x03
317 #define USB_DESCRIPTOR_TYPE_INTERFACE 0x04
318 #define USB_DESCRIPTOR_TYPE_ENDPOINT 0x05
319 #define USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER 0x06
320 #define USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION 0x07
321 #define USB_DESCRIPTOR_TYPE_INTERFACE_POWER 0x08
322 #define USB_DESCRIPTOR_TYPE_HID 0x21
323 #define USB_DESCRIPTOR_TYPE_REPORT 0x22
326 * standard feature selectors
328 #define USB_ENDPOINT_HALT 0x00
329 #define USB_DEVICE_REMOTE_WAKEUP 0x01
330 #define USB_TEST_MODE 0x02
337 struct usb_device_request {
343 } __attribute__ ((packed));
349 typedef enum urb_send_status {
359 * Device State (c.f USB Spec 2.0 Figure 9-1)
361 * What state the usb device is in.
363 * Note the state does not change if the device is suspended, we simply set a
364 * flag to show that it is suspended.
367 typedef enum usb_device_state {
368 STATE_INIT, /* just initialized */
369 STATE_CREATED, /* just created */
370 STATE_ATTACHED, /* we are attached */
371 STATE_POWERED, /* we have seen power indication (electrical bus signal) */
372 STATE_DEFAULT, /* we been reset */
373 STATE_ADDRESSED, /* we have been addressed (in default configuration) */
374 STATE_CONFIGURED, /* we have seen a set configuration device command */
375 STATE_UNKNOWN, /* destroyed */
376 } usb_device_state_t;
383 typedef enum usb_device_status {
384 USBD_OPENING, /* we are currently opening */
385 USBD_OK, /* ok to use */
386 USBD_SUSPENDED, /* we are currently suspended */
387 USBD_CLOSING, /* we are currently closing */
388 } usb_device_status_t;
393 * These are defined in the USB Spec (c.f USB Spec 2.0 Figure 9-1).
395 * There are additional events defined to handle some extra actions we need
399 typedef enum usb_device_event {
401 DEVICE_UNKNOWN, /* bi - unknown event */
402 DEVICE_INIT, /* bi - initialize */
403 DEVICE_CREATE, /* bi - */
404 DEVICE_HUB_CONFIGURED, /* bi - bus has been plugged int */
405 DEVICE_RESET, /* bi - hub has powered our port */
407 DEVICE_ADDRESS_ASSIGNED, /* ep0 - set address setup received */
408 DEVICE_CONFIGURED, /* ep0 - set configure setup received */
409 DEVICE_SET_INTERFACE, /* ep0 - set interface setup received */
411 DEVICE_SET_FEATURE, /* ep0 - set feature setup received */
412 DEVICE_CLEAR_FEATURE, /* ep0 - clear feature setup received */
414 DEVICE_DE_CONFIGURED, /* ep0 - set configure setup received for ?? */
416 DEVICE_BUS_INACTIVE, /* bi - bus in inactive (no SOF packets) */
417 DEVICE_BUS_ACTIVITY, /* bi - bus is active again */
419 DEVICE_POWER_INTERRUPTION, /* bi - hub has depowered our port */
420 DEVICE_HUB_RESET, /* bi - bus has been unplugged */
421 DEVICE_DESTROY, /* bi - device instance should be destroyed */
423 DEVICE_HOTPLUG, /* bi - a hotplug event has occurred */
425 DEVICE_FUNCTION_PRIVATE, /* function - private */
427 } usb_device_event_t;
430 typedef struct urb_link {
431 struct urb_link *next;
432 struct urb_link *prev;
435 /* USB Data structure - for passing data around.
437 * This is used for both sending and receiving data.
439 * The callback function is used to let the function driver know when
440 * transmitted data has been sent.
442 * The callback function is set by the alloc_recv function when an urb is
443 * allocated for receiving data for an endpoint and used to call the
444 * function driver to inform it that data has arrived.
447 /* in linux we'd malloc this, but in u-boot we prefer static data */
448 #define URB_BUF_SIZE 512
452 struct usb_endpoint_instance *endpoint;
453 struct usb_device_instance *device;
455 struct usb_device_request device_request; /* contents of received SETUP packet */
457 struct urb_link link; /* embedded struct for circular doubly linked list of urbs */
460 unsigned int buffer_length;
461 unsigned int actual_length;
463 urb_send_status_t status;
466 u16 buffer_data[URB_BUF_SIZE]; /* data received (OUT) or being sent (IN) */
469 /* Endpoint configuration
471 * Per endpoint configuration data. Used to track which function driver owns
475 struct usb_endpoint_instance {
476 int endpoint_address; /* logical endpoint address */
479 int status; /* halted */
480 int state; /* available for use by bus interface driver */
483 struct urb_link rcv; /* received urbs */
484 struct urb_link rdy; /* empty urbs ready to receive */
485 struct urb *rcv_urb; /* active urb */
486 int rcv_attributes; /* copy of bmAttributes from endpoint descriptor */
487 int rcv_packetSize; /* maximum packet size from endpoint descriptor */
488 int rcv_transferSize; /* maximum transfer size from function driver */
492 struct urb_link tx; /* urbs ready to transmit */
493 struct urb_link done; /* transmitted urbs */
494 struct urb *tx_urb; /* active urb */
495 int tx_attributes; /* copy of bmAttributes from endpoint descriptor */
496 int tx_packetSize; /* maximum packet size from endpoint descriptor */
497 int tx_transferSize; /* maximum transfer size from function driver */
500 int sent; /* data already sent */
501 int last; /* data sent in last packet XXX do we need this */
504 struct usb_alternate_instance {
505 struct usb_interface_descriptor *interface_descriptor;
508 int *endpoint_transfersize_array;
509 struct usb_endpoint_descriptor **endpoints_descriptor_array;
512 struct usb_interface_instance {
514 struct usb_alternate_instance *alternates_instance_array;
517 struct usb_configuration_instance {
519 struct usb_configuration_descriptor *configuration_descriptor;
520 struct usb_interface_instance *interface_instance_array;
524 /* USB Device Instance
526 * For each physical bus interface we create a logical device structure. This
527 * tracks all of the required state to track the USB HOST's view of the device.
529 * Keep track of the device configuration for a real physical bus interface,
530 * this includes the bus interface, multiple function drivers, the current
531 * configuration and the current state.
534 * the specific bus interface driver
535 * the default endpoint 0 driver
536 * the configured function driver
542 struct usb_device_instance {
546 struct usb_device_descriptor *device_descriptor; /* per device descriptor */
548 void (*event) (struct usb_device_instance *device, usb_device_event_t event, int data);
550 /* Do cdc device specific control requests */
551 int (*cdc_recv_setup)(struct usb_device_request *request, struct urb *urb);
554 struct usb_bus_instance *bus; /* which bus interface driver */
556 /* configuration descriptors */
558 struct usb_configuration_instance *configuration_instance_array;
561 usb_device_state_t device_state; /* current USB Device state */
562 usb_device_state_t device_previous_state; /* current USB Device state */
564 u8 address; /* current address (zero is default) */
565 u8 configuration; /* current show configuration (zero is default) */
566 u8 interface; /* current interface (zero is default) */
567 u8 alternate; /* alternate flag */
569 usb_device_status_t status; /* device status */
571 int urbs_queued; /* number of submitted urbs */
573 /* Shouldn't need to make this atomic, all we need is a change indicator */
574 unsigned long usbd_rxtx_timestamp;
575 unsigned long usbd_last_rxtx_timestamp;
579 /* Bus Interface configuration structure
581 * This is allocated for each configured instance of a bus interface driver.
583 * The privdata pointer may be used by the bus interface driver to store private
584 * per instance state information.
586 struct usb_bus_instance {
588 struct usb_device_instance *device;
589 struct usb_endpoint_instance *endpoint_array; /* array of available configured endpoints */
591 int max_endpoints; /* maximimum number of rx enpoints */
592 unsigned char maxpacketsize;
594 unsigned int serial_number;
595 char *serial_number_str;
596 void *privdata; /* private data for the bus interface */
600 void urb_link_init (urb_link * ul);
601 void urb_detach (struct urb *urb);
602 urb_link *first_urb_link (urb_link * hd);
603 struct urb *first_urb (urb_link * hd);
604 struct urb *first_urb_detached (urb_link * hd);
605 void urb_append (urb_link * hd, struct urb *urb);
607 struct urb *usbd_alloc_urb (struct usb_device_instance *device, struct usb_endpoint_instance *endpoint);
608 void usbd_dealloc_urb (struct urb *urb);
611 * usbd_device_event is used by bus interface drivers to tell the higher layers that
612 * certain events have taken place.
614 void usbd_device_event_irq (struct usb_device_instance *conf, usb_device_event_t, int);
615 void usbd_device_event (struct usb_device_instance *conf, usb_device_event_t, int);
619 * Various ways of finding descriptors based on the current device and any
620 * possible configuration / interface / endpoint for it.
622 struct usb_configuration_descriptor *usbd_device_configuration_descriptor (struct usb_device_instance *, int, int);
623 struct usb_function_instance *usbd_device_function_instance (struct usb_device_instance *, unsigned int);
624 struct usb_interface_instance *usbd_device_interface_instance (struct usb_device_instance *, int, int, int);
625 struct usb_alternate_instance *usbd_device_alternate_instance (struct usb_device_instance *, int, int, int, int);
626 struct usb_interface_descriptor *usbd_device_interface_descriptor (struct usb_device_instance *, int, int, int, int);
627 struct usb_endpoint_descriptor *usbd_device_endpoint_descriptor_index (struct usb_device_instance *, int, int, int, int, int);
628 struct usb_class_descriptor *usbd_device_class_descriptor_index (struct usb_device_instance *, int, int, int, int, int);
629 struct usb_class_report_descriptor *usbd_device_class_report_descriptor_index( struct usb_device_instance *, int , int , int , int , int );
630 struct usb_endpoint_descriptor *usbd_device_endpoint_descriptor (struct usb_device_instance *, int, int, int, int, int);
631 int usbd_device_endpoint_transfersize (struct usb_device_instance *, int, int, int, int, int);
632 struct usb_string_descriptor *usbd_get_string (u8);
633 struct usb_device_descriptor *usbd_device_device_descriptor(struct
634 usb_device_instance *, int);
636 int usbd_endpoint_halted (struct usb_device_instance *device, int endpoint);
637 void usbd_rcv_complete(struct usb_endpoint_instance *endpoint, int len, int urb_bad);
638 void usbd_tx_complete (struct usb_endpoint_instance *endpoint);
640 /* These are macros used in debugging */
642 static inline void print_urb(struct urb *u)
644 serial_printf("urb %p\n", (u));
645 serial_printf("\tendpoint %p\n", u->endpoint);
646 serial_printf("\tdevice %p\n", u->device);
647 serial_printf("\tbuffer %p\n", u->buffer);
648 serial_printf("\tbuffer_length %d\n", u->buffer_length);
649 serial_printf("\tactual_length %d\n", u->actual_length);
650 serial_printf("\tstatus %d\n", u->status);
651 serial_printf("\tdata %d\n", u->data);
654 static inline void print_usb_device_request(struct usb_device_request *r)
656 serial_printf("usb request\n");
657 serial_printf("\tbmRequestType 0x%2.2x\n", r->bmRequestType);
658 if ((r->bmRequestType & USB_REQ_DIRECTION_MASK) == 0)
659 serial_printf("\t\tDirection : To device\n");
661 serial_printf("\t\tDirection : To host\n");
662 if ((r->bmRequestType & USB_TYPE_STANDARD) == USB_TYPE_STANDARD)
663 serial_printf("\t\tType : Standard\n");
664 if ((r->bmRequestType & USB_TYPE_CLASS) == USB_TYPE_CLASS)
665 serial_printf("\t\tType : Standard\n");
666 if ((r->bmRequestType & USB_TYPE_VENDOR) == USB_TYPE_VENDOR)
667 serial_printf("\t\tType : Standard\n");
668 if ((r->bmRequestType & USB_TYPE_RESERVED) == USB_TYPE_RESERVED)
669 serial_printf("\t\tType : Standard\n");
670 if ((r->bmRequestType & USB_REQ_RECIPIENT_MASK) ==
671 USB_REQ_RECIPIENT_DEVICE)
672 serial_printf("\t\tRecipient : Device\n");
673 if ((r->bmRequestType & USB_REQ_RECIPIENT_MASK) ==
674 USB_REQ_RECIPIENT_INTERFACE)
675 serial_printf("\t\tRecipient : Interface\n");
676 if ((r->bmRequestType & USB_REQ_RECIPIENT_MASK) ==
677 USB_REQ_RECIPIENT_ENDPOINT)
678 serial_printf("\t\tRecipient : Endpoint\n");
679 if ((r->bmRequestType & USB_REQ_RECIPIENT_MASK) ==
680 USB_REQ_RECIPIENT_OTHER)
681 serial_printf("\t\tRecipient : Other\n");
682 serial_printf("\tbRequest 0x%2.2x\n", r->bRequest);
683 if (r->bRequest == USB_REQ_GET_STATUS)
684 serial_printf("\t\tGET_STATUS\n");
685 else if (r->bRequest == USB_REQ_SET_ADDRESS)
686 serial_printf("\t\tSET_ADDRESS\n");
687 else if (r->bRequest == USB_REQ_SET_FEATURE)
688 serial_printf("\t\tSET_FEATURE\n");
689 else if (r->bRequest == USB_REQ_GET_DESCRIPTOR)
690 serial_printf("\t\tGET_DESCRIPTOR\n");
691 else if (r->bRequest == USB_REQ_SET_CONFIGURATION)
692 serial_printf("\t\tSET_CONFIGURATION\n");
693 else if (r->bRequest == USB_REQ_SET_INTERFACE)
694 serial_printf("\t\tUSB_REQ_SET_INTERFACE\n");
696 serial_printf("\tUNKNOWN %d\n", r->bRequest);
697 serial_printf("\twValue 0x%4.4x\n", r->wValue);
698 if (r->bRequest == USB_REQ_GET_DESCRIPTOR) {
699 switch (r->wValue >> 8) {
700 case USB_DESCRIPTOR_TYPE_DEVICE:
701 serial_printf("\tDEVICE\n");
703 case USB_DESCRIPTOR_TYPE_CONFIGURATION:
704 serial_printf("\tCONFIGURATION\n");
706 case USB_DESCRIPTOR_TYPE_STRING:
707 serial_printf("\tSTRING\n");
709 case USB_DESCRIPTOR_TYPE_INTERFACE:
710 serial_printf("\tINTERFACE\n");
712 case USB_DESCRIPTOR_TYPE_ENDPOINT:
713 serial_printf("\tENDPOINT\n");
715 case USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER:
716 serial_printf("\tDEVICE_QUALIFIER\n");
718 case USB_DESCRIPTOR_TYPE_OTHER_SPEED_CONFIGURATION:
719 serial_printf("\tOTHER_SPEED_CONFIGURATION\n");
721 case USB_DESCRIPTOR_TYPE_INTERFACE_POWER:
722 serial_printf("\tINTERFACE_POWER\n");
724 case USB_DESCRIPTOR_TYPE_HID:
725 serial_printf("\tHID\n");
727 case USB_DESCRIPTOR_TYPE_REPORT:
728 serial_printf("\tREPORT\n");
731 serial_printf("\tUNKNOWN TYPE\n");
735 serial_printf("\twIndex 0x%4.4x\n", r->wIndex);
736 serial_printf("\twLength 0x%4.4x\n", r->wLength);
741 #define print_usb_device_request(r)