usb.h | usb.h | |||
---|---|---|---|---|
skipping to change at line 58 | skipping to change at line 58 | |||
#define USB_DT_CONFIG_SIZE 9 | #define USB_DT_CONFIG_SIZE 9 | |||
#define USB_DT_INTERFACE_SIZE 9 | #define USB_DT_INTERFACE_SIZE 9 | |||
#define USB_DT_ENDPOINT_SIZE 7 | #define USB_DT_ENDPOINT_SIZE 7 | |||
#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ | #define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ | |||
#define USB_DT_HUB_NONVAR_SIZE 7 | #define USB_DT_HUB_NONVAR_SIZE 7 | |||
/* All standard descriptors have these 2 fields in common */ | /* All standard descriptors have these 2 fields in common */ | |||
struct usb_descriptor_header { | struct usb_descriptor_header { | |||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
} __attribute__ ((packed)); | }; | |||
/* Device descriptor */ | /* String descriptor */ | |||
struct usb_device_descriptor { | struct usb_string_descriptor { | |||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
u_int16_t bcdUSB; | u_int16_t wData[1]; | |||
u_int8_t bDeviceClass; | }; | |||
u_int8_t bDeviceSubClass; | ||||
u_int8_t bDeviceProtocol; | /* HID descriptor */ | |||
u_int8_t bMaxPacketSize0; | struct usb_hid_descriptor { | |||
u_int16_t idVendor; | u_int8_t bLength; | |||
u_int16_t idProduct; | u_int8_t bDescriptorType; | |||
u_int16_t bcdDevice; | u_int16_t bcdHID; | |||
u_int8_t iManufacturer; | u_int8_t bCountryCode; | |||
u_int8_t iProduct; | u_int8_t bNumDescriptors; | |||
u_int8_t iSerialNumber; | }; | |||
u_int8_t bNumConfigurations; | ||||
} __attribute__ ((packed)); | ||||
/* Endpoint descriptor */ | /* Endpoint descriptor */ | |||
#define USB_MAXENDPOINTS 32 | ||||
struct usb_endpoint_descriptor { | struct usb_endpoint_descriptor { | |||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
u_int8_t bEndpointAddress; | u_int8_t bEndpointAddress; | |||
u_int8_t bmAttributes; | u_int8_t bmAttributes; | |||
u_int16_t wMaxPacketSize; | u_int16_t wMaxPacketSize; | |||
u_int8_t bInterval; | u_int8_t bInterval; | |||
u_int8_t bRefresh; | u_int8_t bRefresh; | |||
u_int8_t bSynchAddress; | u_int8_t bSynchAddress; | |||
} __attribute__ ((packed)); | ||||
struct usb_hid_descriptor { | unsigned char *extra; /* Extra descriptors */ | |||
u_int8_t bLength; | int extralen; | |||
u_int8_t bDescriptorType; | }; | |||
u_int16_t bcdHID; | ||||
u_int8_t bCountryCode; | #define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ | |||
u_int8_t bNumDescriptors; | #define USB_ENDPOINT_DIR_MASK 0x80 | |||
} __attribute__ ((packed)); | ||||
#define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ | ||||
#define USB_ENDPOINT_TYPE_CONTROL 0 | ||||
#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 | ||||
#define USB_ENDPOINT_TYPE_BULK 2 | ||||
#define USB_ENDPOINT_TYPE_INTERRUPT 3 | ||||
/* Interface descriptor */ | /* Interface descriptor */ | |||
#define USB_MAXINTERFACES 32 | ||||
struct usb_interface_descriptor { | struct usb_interface_descriptor { | |||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
u_int8_t bInterfaceNumber; | u_int8_t bInterfaceNumber; | |||
u_int8_t bAlternateSetting; | u_int8_t bAlternateSetting; | |||
u_int8_t bNumEndpoints; | u_int8_t bNumEndpoints; | |||
u_int8_t bInterfaceClass; | u_int8_t bInterfaceClass; | |||
u_int8_t bInterfaceSubClass; | u_int8_t bInterfaceSubClass; | |||
u_int8_t bInterfaceProtocol; | u_int8_t bInterfaceProtocol; | |||
u_int8_t iInterface; | u_int8_t iInterface; | |||
} __attribute__ ((packed)); | ||||
struct usb_endpoint_descriptor *endpoint; | ||||
unsigned char *extra; /* Extra descriptors */ | ||||
int extralen; | ||||
}; | ||||
#define USB_MAXALTSETTING 128 /* Hard limit */ | ||||
struct usb_interface { | ||||
struct usb_interface_descriptor *altsetting; | ||||
int num_altsetting; | ||||
}; | ||||
/* Configuration descriptor information.. */ | /* Configuration descriptor information.. */ | |||
#define USB_MAXCONFIG 8 | ||||
struct usb_config_descriptor { | struct usb_config_descriptor { | |||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
u_int16_t wTotalLength; | u_int16_t wTotalLength; | |||
u_int8_t bNumInterfaces; | u_int8_t bNumInterfaces; | |||
u_int8_t bConfigurationValue; | u_int8_t bConfigurationValue; | |||
u_int8_t iConfiguration; | u_int8_t iConfiguration; | |||
u_int8_t bmAttributes; | u_int8_t bmAttributes; | |||
u_int8_t MaxPower; | u_int8_t MaxPower; | |||
} __attribute__ ((packed)); | ||||
/* String descriptor */ | struct usb_interface *interface; | |||
struct usb_string_descriptor { | ||||
unsigned char *extra; /* Extra descriptors */ | ||||
int extralen; | ||||
}; | ||||
/* Device descriptor */ | ||||
struct usb_device_descriptor { | ||||
u_int8_t bLength; | u_int8_t bLength; | |||
u_int8_t bDescriptorType; | u_int8_t bDescriptorType; | |||
u_int16_t wData[1]; | u_int16_t bcdUSB; | |||
} __attribute__ ((packed)); | u_int8_t bDeviceClass; | |||
u_int8_t bDeviceSubClass; | ||||
u_int8_t bDeviceProtocol; | ||||
u_int8_t bMaxPacketSize0; | ||||
u_int16_t idVendor; | ||||
u_int16_t idProduct; | ||||
u_int16_t bcdDevice; | ||||
u_int8_t iManufacturer; | ||||
u_int8_t iProduct; | ||||
u_int8_t iSerialNumber; | ||||
u_int8_t bNumConfigurations; | ||||
}; | ||||
/* | /* | |||
* Standard requests | * Standard requests | |||
*/ | */ | |||
#define USB_REQ_GET_STATUS 0x00 | #define USB_REQ_GET_STATUS 0x00 | |||
#define USB_REQ_CLEAR_FEATURE 0x01 | #define USB_REQ_CLEAR_FEATURE 0x01 | |||
/* 0x02 is reserved */ | /* 0x02 is reserved */ | |||
#define USB_REQ_SET_FEATURE 0x03 | #define USB_REQ_SET_FEATURE 0x03 | |||
/* 0x04 is reserved */ | /* 0x04 is reserved */ | |||
#define USB_REQ_SET_ADDRESS 0x05 | #define USB_REQ_SET_ADDRESS 0x05 | |||
skipping to change at line 162 | skipping to change at line 195 | |||
#define USB_RECIP_DEVICE 0x00 | #define USB_RECIP_DEVICE 0x00 | |||
#define USB_RECIP_INTERFACE 0x01 | #define USB_RECIP_INTERFACE 0x01 | |||
#define USB_RECIP_ENDPOINT 0x02 | #define USB_RECIP_ENDPOINT 0x02 | |||
#define USB_RECIP_OTHER 0x03 | #define USB_RECIP_OTHER 0x03 | |||
/* | /* | |||
* Various libusb API related stuff | * Various libusb API related stuff | |||
*/ | */ | |||
#define USB_ENDPOINT_IN 0x80 | #define USB_ENDPOINT_IN 0x80 | |||
#define USB_ENDPOINT_OUT 0x00 | ||||
/* Error codes */ | /* Error codes */ | |||
#define USB_ERROR_BEGIN 500000 | #define USB_ERROR_BEGIN 500000 | |||
/* | ||||
* This is supposed to look weird. This file is generated from autoconf | ||||
* and I didn't want to make this too complicated. | ||||
*/ | ||||
#if 0 | ||||
#define USB_LE16_TO_CPU(x) do { x = ((x & 0xff) << 8) | ((x & 0xff00) >> 8) | ||||
; } while(0) | ||||
#else | ||||
#define USB_LE16_TO_CPU(x) | ||||
#endif | ||||
/* Data types */ | /* Data types */ | |||
struct usb_device; | struct usb_device; | |||
struct usb_bus; | struct usb_bus; | |||
struct usb_device { | struct usb_device { | |||
struct usb_device *next, *prev; | struct usb_device *next, *prev; | |||
char filename[PATH_MAX + 1]; | char filename[PATH_MAX + 1]; | |||
struct usb_bus *bus; | struct usb_bus *bus; | |||
struct usb_device_descriptor descriptor; | struct usb_device_descriptor descriptor; | |||
struct usb_config_descriptor *config; | struct usb_config_descriptor *config; | |||
void *dev; /* Darwin support */ | ||||
}; | }; | |||
struct usb_bus { | struct usb_bus { | |||
struct usb_bus *next, *prev; | struct usb_bus *next, *prev; | |||
char dirname[PATH_MAX + 1]; | char dirname[PATH_MAX + 1]; | |||
struct usb_device *devices; | struct usb_device *devices; | |||
}; | }; | |||
End of changes. 15 change blocks. | ||||
30 lines changed or deleted | 77 lines changed or added | |||