From 946b960d13c15f050a3b848987aaca79f6a459b7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Feb 2007 13:40:14 -0800 Subject: USB: add driver for iowarrior devices. The ioctl is commented out for now, until we verify some userspace application issues. Cc: Christian Lucht Cc: Robert Marquardt Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/iowarrior.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 include/linux/usb/iowarrior.h (limited to 'include') diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h new file mode 100644 index 00000000000..cbbe020a4f5 --- /dev/null +++ b/include/linux/usb/iowarrior.h @@ -0,0 +1,33 @@ +#ifndef _IOWARRIOR_H_ +#define _IOWARRIOR_H_ + +#define CODEMERCS_MAGIC_NUMBER 0xC0 /* like COde Mercenaries */ + +/* Define the ioctl commands for reading and writing data */ +#define IOW_WRITE _IOW(CODEMERCS_MAGIC_NUMBER, 1, __u8 *) +#define IOW_READ _IOW(CODEMERCS_MAGIC_NUMBER, 2, __u8 *) + +/* + A struct for available device info which is read + with the ioctl IOW_GETINFO. + To be compatible with 2.4 userspace which didn't have an easy way to get + this information. +*/ +struct iowarrior_info { + __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ + __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */ + __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */ + __u32 revision; /* revision number of the chip */ + __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ + __u32 power; /* power consumption of the device in mA */ + __u32 if_num; /* the number of the endpoint */ + __u32 report_size; /* size of the data-packets on this interface */ +}; + +/* + Get some device-information (product-id , serial-number etc.) + in order to identify a chip. +*/ +#define IOW_GETINFO _IOR(CODEMERCS_MAGIC_NUMBER, 3, struct iowarrior_info) + +#endif /* _IOWARRIOR_H_ */ -- cgit v1.2.3 From 672027a35795ec95f516fdc702ba8900d55a9eef Mon Sep 17 00:00:00 2001 From: Inaky Perez-Gonzalez Date: Thu, 22 Feb 2007 16:37:53 -0800 Subject: USB: add rationale on why usb descriptor structures have to be packed Add argumentation in defense of using __attribute__((packed)) in USB descriptors authored by Dave Brownell. Necessary as in some cases it seems superfluous. Signed-off-by: Inaky Perez-Gonzalez Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/ch9.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 245c7253122..1122a6c2c1a 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -1,8 +1,9 @@ /* - * This file holds USB constants and structures that are needed for USB - * device APIs. These are used by the USB device model, which is defined - * in chapter 9 of the USB 2.0 specification. Linux has several APIs in C - * that need these: + * This file holds USB constants and structures that are needed for + * USB device APIs. These are used by the USB device model, which is + * defined in chapter 9 of the USB 2.0 specification and in the + * Wireless USB 1.0 (spread around). Linux has several APIs in C that + * need these: * * - the master/host side Linux-USB kernel driver API; * - the "usbfs" user space API; and @@ -14,6 +15,19 @@ * * There's also "Wireless USB", using low power short range radios for * peripheral interconnection but otherwise building on the USB framework. + * + * Note all descriptors are declared '__attribute__((packed))' so that: + * + * [a] they never get padded, either internally (USB spec writers + * probably handled that) or externally; + * + * [b] so that accessing bigger-than-a-bytes fields will never + * generate bus errors on any platform, even when the location of + * its descriptor inside a bundle isn't "naturally aligned", and + * + * [c] for consistency, removing all doubt even when it appears to + * someone that the two other points are non-issues for that + * particular descriptor type. */ #ifndef __LINUX_USB_CH9_H -- cgit v1.2.3 From 7ceec1f1d26f966c0816b86a1aab1e0b3b208757 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Fri, 26 Jan 2007 14:26:21 +0100 Subject: USB: add a blacklist for devices that can't handle some things we throw at them. This adds a blacklist to the USB core to handle some autosuspend and string issues that devices have. Originally written by Oliver, but hacked up a lot by Greg. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 1 + include/linux/usb/quirks.h | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 include/linux/usb/quirks.h (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index a8e8d1ecebb..37e522eba47 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -388,6 +388,7 @@ struct usb_device { struct usb_device *children[USB_MAXCHILDREN]; int pm_usage_cnt; /* usage counter for autosuspend */ + u32 quirks; /* quirks of the whole device */ #ifdef CONFIG_PM struct delayed_work autosuspend; /* for delayed autosuspends */ struct mutex pm_mutex; /* protects PM operations */ diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h new file mode 100644 index 00000000000..6bac8faacbc --- /dev/null +++ b/include/linux/usb/quirks.h @@ -0,0 +1,11 @@ +/* + * This file holds the definitions of quirks found in USB devices. + * Only quirks that affect the whole device, not an interface, + * belong here. + */ + +/* device must not be autosuspended */ +#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001 + +/* string descriptors must not be fetched using a 255-byte read */ +#define USB_QUIRK_STRING_FETCH_255 0x00000002 -- cgit v1.2.3 From b5e795f8df42936590ba9c606edc715fe3593284 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 20 Feb 2007 15:00:53 -0500 Subject: USB: make autosuspend delay a module parameter This patch (as859) makes the default USB autosuspend delay a module parameter of usbcore. By setting the delay value at boot time, users will be able to prevent the system from autosuspending devices which for some reason can't handle it. The patch also stores the autosuspend delay as a per-device value. A later patch will allow the user to change the value, tailoring the delay for each individual device. A delay value of 0 will prevent autosuspend. Signed-off-by: Alan Stern Signed-off-by: Greg Kroah-Hartman --- include/linux/usb.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/usb.h b/include/linux/usb.h index 37e522eba47..87dc75a6cee 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -389,10 +389,13 @@ struct usb_device { int pm_usage_cnt; /* usage counter for autosuspend */ u32 quirks; /* quirks of the whole device */ + #ifdef CONFIG_PM struct delayed_work autosuspend; /* for delayed autosuspends */ struct mutex pm_mutex; /* protects PM operations */ + unsigned autosuspend_delay; /* in jiffies */ + unsigned auto_pm:1; /* autosuspend/resume in progress */ unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ #endif -- cgit v1.2.3 From dfa87c824a9a5430008acd1ed2e8111ed164fcbe Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Tue, 20 Feb 2007 15:02:44 -0500 Subject: sysfs: allow attributes to be added to groups This patch (as860) adds two new sysfs routines: sysfs_add_file_to_group() and sysfs_remove_file_from_group(). A later patch adds code that uses the new routines. Signed-off-by: Alan Stern Cc: Maneesh Soni Signed-off-by: Greg Kroah-Hartman --- include/linux/sysfs.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 192de3afa96..f45450b295c 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -126,6 +126,11 @@ void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); int __must_check sysfs_create_group(struct kobject *, const struct attribute_group *); void sysfs_remove_group(struct kobject *, const struct attribute_group *); +int sysfs_add_file_to_group(struct kobject *kobj, + const struct attribute *attr, const char *group); +void sysfs_remove_file_from_group(struct kobject *kobj, + const struct attribute *attr, const char *group); + void sysfs_notify(struct kobject * k, char *dir, char *attr); @@ -210,6 +215,18 @@ static inline void sysfs_remove_group(struct kobject * k, const struct attribute ; } +static inline int sysfs_add_file_to_group(struct kobject *kobj, + const struct attribute *attr, const char *group) +{ + return 0; +} + +static inline void sysfs_remove_file_from_group(struct kobject *kobj, + const struct attribute *attr, const char *group); +{ + ; +} + static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) { } -- cgit v1.2.3