aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
commitbc95f3669f5e6f63cf0b84fe4922c3c6dd4aa775 (patch)
tree427fcf2a7287c16d4b5aa6cbf494d59579a6a8b1 /include/linux/usb
parent3d29cdff999c37b3876082278a8134a0642a02cd (diff)
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/Makefile drivers/usb/input/gtco.c
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/cdc.h18
-rw-r--r--include/linux/usb/ch9.h57
-rw-r--r--include/linux/usb/iowarrior.h33
-rw-r--r--include/linux/usb/quirks.h11
-rw-r--r--include/linux/usb/serial.h6
5 files changed, 105 insertions, 20 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index ba617c372455..2204ae22c381 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -73,6 +73,13 @@ struct usb_cdc_acm_descriptor {
73 __u8 bmCapabilities; 73 __u8 bmCapabilities;
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
76/* capabilities from 5.2.3.3 */
77
78#define USB_CDC_COMM_FEATURE 0x01
79#define USB_CDC_CAP_LINE 0x02
80#define USB_CDC_CAP_BRK 0x04
81#define USB_CDC_CAP_NOTIFY 0x08
82
76/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 83/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
77struct usb_cdc_union_desc { 84struct usb_cdc_union_desc {
78 __u8 bLength; 85 __u8 bLength;
@@ -84,6 +91,17 @@ struct usb_cdc_union_desc {
84 /* ... and there could be other slave interfaces */ 91 /* ... and there could be other slave interfaces */
85} __attribute__ ((packed)); 92} __attribute__ ((packed));
86 93
94/* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */
95struct usb_cdc_country_functional_desc {
96 __u8 bLength;
97 __u8 bDescriptorType;
98 __u8 bDescriptorSubType;
99
100 __u8 iCountryCodeRelDate;
101 __le16 wCountyCode0;
102 /* ... and there can be a lot of country codes */
103} __attribute__ ((packed));
104
87/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */ 105/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
88struct usb_cdc_network_terminal_desc { 106struct usb_cdc_network_terminal_desc {
89 __u8 bLength; 107 __u8 bLength;
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index ae7833749fa2..6169438ec5a2 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -1,8 +1,9 @@
1/* 1/*
2 * This file holds USB constants and structures that are needed for USB 2 * This file holds USB constants and structures that are needed for
3 * device APIs. These are used by the USB device model, which is defined 3 * USB device APIs. These are used by the USB device model, which is
4 * in chapter 9 of the USB 2.0 specification. Linux has several APIs in C 4 * defined in chapter 9 of the USB 2.0 specification and in the
5 * that need these: 5 * Wireless USB 1.0 (spread around). Linux has several APIs in C that
6 * need these:
6 * 7 *
7 * - the master/host side Linux-USB kernel driver API; 8 * - the master/host side Linux-USB kernel driver API;
8 * - the "usbfs" user space API; and 9 * - the "usbfs" user space API; and
@@ -14,6 +15,19 @@
14 * 15 *
15 * There's also "Wireless USB", using low power short range radios for 16 * There's also "Wireless USB", using low power short range radios for
16 * peripheral interconnection but otherwise building on the USB framework. 17 * peripheral interconnection but otherwise building on the USB framework.
18 *
19 * Note all descriptors are declared '__attribute__((packed))' so that:
20 *
21 * [a] they never get padded, either internally (USB spec writers
22 * probably handled that) or externally;
23 *
24 * [b] so that accessing bigger-than-a-bytes fields will never
25 * generate bus errors on any platform, even when the location of
26 * its descriptor inside a bundle isn't "naturally aligned", and
27 *
28 * [c] for consistency, removing all doubt even when it appears to
29 * someone that the two other points are non-issues for that
30 * particular descriptor type.
17 */ 31 */
18 32
19#ifndef __LINUX_USB_CH9_H 33#ifndef __LINUX_USB_CH9_H
@@ -167,12 +181,15 @@ struct usb_ctrlrequest {
167#define USB_DT_WIRE_ADAPTER 0x21 181#define USB_DT_WIRE_ADAPTER 0x21
168#define USB_DT_RPIPE 0x22 182#define USB_DT_RPIPE 0x22
169 183
170/* conventional codes for class-specific descriptors */ 184/* Conventional codes for class-specific descriptors. The convention is
171#define USB_DT_CS_DEVICE 0x21 185 * defined in the USB "Common Class" Spec (3.11). Individual class specs
172#define USB_DT_CS_CONFIG 0x22 186 * are authoritative for their usage, not the "common class" writeup.
173#define USB_DT_CS_STRING 0x23 187 */
174#define USB_DT_CS_INTERFACE 0x24 188#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
175#define USB_DT_CS_ENDPOINT 0x25 189#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
190#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
191#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
192#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
176 193
177/* All standard descriptors have these 2 fields at the beginning */ 194/* All standard descriptors have these 2 fields at the beginning */
178struct usb_descriptor_header { 195struct usb_descriptor_header {
@@ -367,7 +384,7 @@ struct usb_debug_descriptor {
367 /* bulk endpoints with 8 byte maxpacket */ 384 /* bulk endpoints with 8 byte maxpacket */
368 __u8 bDebugInEndpoint; 385 __u8 bDebugInEndpoint;
369 __u8 bDebugOutEndpoint; 386 __u8 bDebugOutEndpoint;
370}; 387} __attribute__((packed));
371 388
372/*-------------------------------------------------------------------------*/ 389/*-------------------------------------------------------------------------*/
373 390
@@ -396,7 +413,7 @@ struct usb_security_descriptor {
396 413
397 __le16 wTotalLength; 414 __le16 wTotalLength;
398 __u8 bNumEncryptionTypes; 415 __u8 bNumEncryptionTypes;
399}; 416} __attribute__((packed));
400 417
401/*-------------------------------------------------------------------------*/ 418/*-------------------------------------------------------------------------*/
402 419
@@ -410,7 +427,7 @@ struct usb_key_descriptor {
410 __u8 tTKID[3]; 427 __u8 tTKID[3];
411 __u8 bReserved; 428 __u8 bReserved;
412 __u8 bKeyData[0]; 429 __u8 bKeyData[0];
413}; 430} __attribute__((packed));
414 431
415/*-------------------------------------------------------------------------*/ 432/*-------------------------------------------------------------------------*/
416 433
@@ -426,7 +443,7 @@ struct usb_encryption_descriptor {
426#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ 443#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
427 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ 444 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
428 __u8 bAuthKeyIndex; 445 __u8 bAuthKeyIndex;
429}; 446} __attribute__((packed));
430 447
431 448
432/*-------------------------------------------------------------------------*/ 449/*-------------------------------------------------------------------------*/
@@ -438,7 +455,7 @@ struct usb_bos_descriptor {
438 455
439 __le16 wTotalLength; 456 __le16 wTotalLength;
440 __u8 bNumDeviceCaps; 457 __u8 bNumDeviceCaps;
441}; 458} __attribute__((packed));
442 459
443/*-------------------------------------------------------------------------*/ 460/*-------------------------------------------------------------------------*/
444 461
@@ -447,7 +464,7 @@ struct usb_dev_cap_header {
447 __u8 bLength; 464 __u8 bLength;
448 __u8 bDescriptorType; 465 __u8 bDescriptorType;
449 __u8 bDevCapabilityType; 466 __u8 bDevCapabilityType;
450}; 467} __attribute__((packed));
451 468
452#define USB_CAP_TYPE_WIRELESS_USB 1 469#define USB_CAP_TYPE_WIRELESS_USB 1
453 470
@@ -475,7 +492,7 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
475 __u8 bmFFITXPowerInfo; /* FFI power levels */ 492 __u8 bmFFITXPowerInfo; /* FFI power levels */
476 __le16 bmBandGroup; 493 __le16 bmBandGroup;
477 __u8 bReserved; 494 __u8 bReserved;
478}; 495} __attribute__((packed));
479 496
480/*-------------------------------------------------------------------------*/ 497/*-------------------------------------------------------------------------*/
481 498
@@ -496,7 +513,7 @@ struct usb_wireless_ep_comp_descriptor {
496#define USB_ENDPOINT_SWITCH_NO 0 513#define USB_ENDPOINT_SWITCH_NO 0
497#define USB_ENDPOINT_SWITCH_SWITCH 1 514#define USB_ENDPOINT_SWITCH_SWITCH 1
498#define USB_ENDPOINT_SWITCH_SCALE 2 515#define USB_ENDPOINT_SWITCH_SCALE 2
499}; 516} __attribute__((packed));
500 517
501/*-------------------------------------------------------------------------*/ 518/*-------------------------------------------------------------------------*/
502 519
@@ -512,7 +529,7 @@ struct usb_handshake {
512 __u8 CDID[16]; 529 __u8 CDID[16];
513 __u8 nonce[16]; 530 __u8 nonce[16];
514 __u8 MIC[8]; 531 __u8 MIC[8];
515}; 532} __attribute__((packed));
516 533
517/*-------------------------------------------------------------------------*/ 534/*-------------------------------------------------------------------------*/
518 535
@@ -524,7 +541,7 @@ struct usb_connection_context {
524 __u8 CHID[16]; /* persistent host id */ 541 __u8 CHID[16]; /* persistent host id */
525 __u8 CDID[16]; /* device id (unique w/in host context) */ 542 __u8 CDID[16]; /* device id (unique w/in host context) */
526 __u8 CK[16]; /* connection key */ 543 __u8 CK[16]; /* connection key */
527}; 544} __attribute__((packed));
528 545
529/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
530 547
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
new file mode 100644
index 000000000000..cbbe020a4f5c
--- /dev/null
+++ b/include/linux/usb/iowarrior.h
@@ -0,0 +1,33 @@
1#ifndef _IOWARRIOR_H_
2#define _IOWARRIOR_H_
3
4#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */
5
6/* Define the ioctl commands for reading and writing data */
7#define IOW_WRITE _IOW(CODEMERCS_MAGIC_NUMBER, 1, __u8 *)
8#define IOW_READ _IOW(CODEMERCS_MAGIC_NUMBER, 2, __u8 *)
9
10/*
11 A struct for available device info which is read
12 with the ioctl IOW_GETINFO.
13 To be compatible with 2.4 userspace which didn't have an easy way to get
14 this information.
15*/
16struct iowarrior_info {
17 __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18 __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */
19 __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */
20 __u32 revision; /* revision number of the chip */
21 __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
22 __u32 power; /* power consumption of the device in mA */
23 __u32 if_num; /* the number of the endpoint */
24 __u32 report_size; /* size of the data-packets on this interface */
25};
26
27/*
28 Get some device-information (product-id , serial-number etc.)
29 in order to identify a chip.
30*/
31#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info)
32
33#endif /* _IOWARRIOR_H_ */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
new file mode 100644
index 000000000000..6bac8faacbc6
--- /dev/null
+++ b/include/linux/usb/quirks.h
@@ -0,0 +1,11 @@
1/*
2 * This file holds the definitions of quirks found in USB devices.
3 * Only quirks that affect the whole device, not an interface,
4 * belong here.
5 */
6
7/* device must not be autosuspended */
8#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
9
10/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000002
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 33dcd8576696..32acbae28d24 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -54,6 +54,8 @@
54 * @write_wait: a wait_queue_head_t used by the port. 54 * @write_wait: a wait_queue_head_t used by the port.
55 * @work: work queue entry for the line discipline waking up. 55 * @work: work queue entry for the line discipline waking up.
56 * @open_count: number of times this port has been opened. 56 * @open_count: number of times this port has been opened.
57 * @throttled: nonzero if the read urb is inactive to throttle the device
58 * @throttle_req: nonzero if the tty wants to throttle us
57 * 59 *
58 * This structure is used by the usb-serial core and drivers for the specific 60 * This structure is used by the usb-serial core and drivers for the specific
59 * ports of a device. 61 * ports of a device.
@@ -88,6 +90,8 @@ struct usb_serial_port {
88 wait_queue_head_t write_wait; 90 wait_queue_head_t write_wait;
89 struct work_struct work; 91 struct work_struct work;
90 int open_count; 92 int open_count;
93 char throttled;
94 char throttle_req;
91 struct device dev; 95 struct device dev;
92}; 96};
93#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 97#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
@@ -269,6 +273,8 @@ extern int usb_serial_generic_write_room (struct usb_serial_port *port);
269extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); 273extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port);
270extern void usb_serial_generic_read_bulk_callback (struct urb *urb); 274extern void usb_serial_generic_read_bulk_callback (struct urb *urb);
271extern void usb_serial_generic_write_bulk_callback (struct urb *urb); 275extern void usb_serial_generic_write_bulk_callback (struct urb *urb);
276extern void usb_serial_generic_throttle (struct usb_serial_port *port);
277extern void usb_serial_generic_unthrottle (struct usb_serial_port *port);
272extern void usb_serial_generic_shutdown (struct usb_serial *serial); 278extern void usb_serial_generic_shutdown (struct usb_serial *serial);
273extern int usb_serial_generic_register (int debug); 279extern int usb_serial_generic_register (int debug);
274extern void usb_serial_generic_deregister (void); 280extern void usb_serial_generic_deregister (void);