struct usbdev;
typedef struct usbdev usbdev_t;
-typedef enum { SETUP = 0x2d, IN = 0x69, OUT = 0xe1 } pid_t;
+typedef enum { SETUP, IN, OUT } direction_t;
typedef enum { CONTROL = 0, ISOCHRONOUS = 1, BULK = 2, INTERRUPT = 3
} endpoint_type;
typedef struct {
usbdev_t *dev;
int endpoint;
- pid_t direction;
+ direction_t direction;
int toggle;
int maxpacketsize;
endpoint_type type;
void (*reset) (hci_t *controller);
void (*shutdown) (hci_t *controller);
int (*bulk) (endpoint_t *ep, int size, u8 *data, int finalize);
- int (*control) (usbdev_t *dev, pid_t pid, int dr_length,
+ int (*control) (usbdev_t *dev, direction_t pid, int dr_length,
void *devreq, int data_length, u8 *data);
void* (*create_intr_queue) (endpoint_t *ep, int reqsize, int reqcount, int reqtiming);
void (*destroy_intr_queue) (endpoint_t *ep, void *queue);
#define USB_QUIRK_NONE 0
#ifdef USB_DEBUG
-#define debug(x...) printf(x);
+# define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
-#define debug(x...)
+# define debug(fmt, ...) while (0) { printf(fmt, ##__VA_ARGS__); }
#endif
void usb_fatal(const char *message) __attribute__ ((noreturn));