aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usbdevice_fs.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-07-04 03:18:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-06 13:53:19 -0400
commit19181bc50e1b8e92a7a3b3d78637c6dc5c0b5a1b (patch)
tree347b45182dd50d1237f24579628232ca3a04de97 /include/linux/usbdevice_fs.h
parent2102e06a5f2e414694921f23591f072a5ba7db9f (diff)
usbdevfs: Add a USBDEVFS_GET_CAPABILITIES ioctl
There are a few (new) usbdevfs capabilities which an application cannot discover in any other way then checking the kernel version. There are 3 problems with this: 1) It is just not very pretty. 2) Given the tendency of enterprise distros to backport stuff it is not reliable. 3) As discussed in length on the mailinglist, USBDEVFS_URB_BULK_CONTINUATION does not work as it should when combined with USBDEVFS_URB_SHORT_NOT_OK (which is its intended use) on devices attached to an XHCI controller. So the availability of these features can be host controller dependent, making depending on them based on the kernel version not a good idea. This patch besides adding the new ioctl also adds flags for the following existing capabilities: USBDEVFS_CAP_ZERO_PACKET, available since 2.6.31 USBDEVFS_CAP_BULK_CONTINUATION, available since 2.6.32, except for XHCI USBDEVFS_CAP_NO_PACKET_SIZE_LIM, available since 3.3 Note that this patch only does not advertise the USBDEVFS_URB_BULK_CONTINUATION cap for XHCI controllers, bulk transfers with this flag set will still be accepted when submitted to XHCI controllers. Returning -EINVAL for them would break existing apps, and in most cases the troublesome scenario wrt USBDEVFS_URB_SHORT_NOT_OK urbs on XHCI controllers will never get hit, so this would break working use cases. The disadvantage of not returning -EINVAL is that cases were it is causing real trouble may go undetected / the cause of the trouble may be unclear, but this is the best we can do. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usbdevice_fs.h')
-rw-r--r--include/linux/usbdevice_fs.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 15591d2ea400..07b2ceaaad70 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -125,6 +125,11 @@ struct usbdevfs_hub_portinfo {
125 char port [127]; /* e.g. port 3 connects to device 27 */ 125 char port [127]; /* e.g. port 3 connects to device 27 */
126}; 126};
127 127
128/* Device capability flags */
129#define USBDEVFS_CAP_ZERO_PACKET 0x01
130#define USBDEVFS_CAP_BULK_CONTINUATION 0x02
131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
132
128#ifdef __KERNEL__ 133#ifdef __KERNEL__
129#ifdef CONFIG_COMPAT 134#ifdef CONFIG_COMPAT
130#include <linux/compat.h> 135#include <linux/compat.h>
@@ -204,4 +209,6 @@ struct usbdevfs_ioctl32 {
204#define USBDEVFS_CONNECT _IO('U', 23) 209#define USBDEVFS_CONNECT _IO('U', 23)
205#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) 210#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
206#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) 211#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
212#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
213
207#endif /* _LINUX_USBDEVICE_FS_H */ 214#endif /* _LINUX_USBDEVICE_FS_H */