| Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 1 |  | 
 | 2 | /* | 
 | 3 |  *	usbdevice_fs.h  --  USB device file system. | 
 | 4 |  * | 
 | 5 |  *	Copyright (C) 2000 | 
 | 6 |  *          Thomas Sailer (sailer@ife.ee.ethz.ch) | 
 | 7 |  * | 
 | 8 |  *	This program is free software; you can redistribute it and/or modify | 
 | 9 |  *	it under the terms of the GNU General Public License as published by | 
 | 10 |  *	the Free Software Foundation; either version 2 of the License, or | 
 | 11 |  *	(at your option) any later version. | 
 | 12 |  * | 
 | 13 |  *	This program is distributed in the hope that it will be useful, | 
 | 14 |  *	but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 15 |  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 16 |  *	GNU General Public License for more details. | 
 | 17 |  * | 
 | 18 |  *	You should have received a copy of the GNU General Public License | 
 | 19 |  *	along with this program; if not, write to the Free Software | 
 | 20 |  *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
 | 21 |  * | 
 | 22 |  *  History: | 
 | 23 |  *   0.1  04.01.2000  Created | 
 | 24 |  */ | 
 | 25 |  | 
 | 26 |  | 
 | 27 | #ifndef _LINUX_USBDEVICE_FS_H | 
 | 28 | #define _LINUX_USBDEVICE_FS_H | 
 | 29 |  | 
 | 30 | #include <linux/types.h> | 
 | 31 | #include <linux/magic.h> | 
 | 32 |  | 
 | 33 |  | 
 | 34 |  | 
 | 35 | struct usbdevfs_ctrltransfer { | 
 | 36 | 	__u8 bRequestType; | 
 | 37 | 	__u8 bRequest; | 
 | 38 | 	__u16 wValue; | 
 | 39 | 	__u16 wIndex; | 
 | 40 | 	__u16 wLength; | 
 | 41 | 	__u32 timeout;   | 
 | 42 |  	void __user *data; | 
 | 43 | }; | 
 | 44 |  | 
 | 45 | struct usbdevfs_bulktransfer { | 
 | 46 | 	unsigned int ep; | 
 | 47 | 	unsigned int len; | 
 | 48 | 	unsigned int timeout;  | 
 | 49 | 	void __user *data; | 
 | 50 | }; | 
 | 51 |  | 
 | 52 | struct usbdevfs_setinterface { | 
 | 53 | 	unsigned int interface; | 
 | 54 | 	unsigned int altsetting; | 
 | 55 | }; | 
 | 56 |  | 
 | 57 | struct usbdevfs_disconnectsignal { | 
 | 58 | 	unsigned int signr; | 
 | 59 | 	void __user *context; | 
 | 60 | }; | 
 | 61 |  | 
 | 62 | #define USBDEVFS_MAXDRIVERNAME 255 | 
 | 63 |  | 
 | 64 | struct usbdevfs_getdriver { | 
 | 65 | 	unsigned int interface; | 
 | 66 | 	char driver[USBDEVFS_MAXDRIVERNAME + 1]; | 
 | 67 | }; | 
 | 68 |  | 
 | 69 | struct usbdevfs_connectinfo { | 
 | 70 | 	unsigned int devnum; | 
 | 71 | 	unsigned char slow; | 
 | 72 | }; | 
 | 73 |  | 
 | 74 | #define USBDEVFS_URB_SHORT_NOT_OK	0x01 | 
 | 75 | #define USBDEVFS_URB_ISO_ASAP		0x02 | 
 | 76 | #define USBDEVFS_URB_BULK_CONTINUATION	0x04 | 
 | 77 | #define USBDEVFS_URB_NO_FSBR		0x20 | 
 | 78 | #define USBDEVFS_URB_ZERO_PACKET	0x40 | 
 | 79 | #define USBDEVFS_URB_NO_INTERRUPT	0x80 | 
 | 80 |  | 
 | 81 | #define USBDEVFS_URB_TYPE_ISO		   0 | 
 | 82 | #define USBDEVFS_URB_TYPE_INTERRUPT	   1 | 
 | 83 | #define USBDEVFS_URB_TYPE_CONTROL	   2 | 
 | 84 | #define USBDEVFS_URB_TYPE_BULK		   3 | 
 | 85 |  | 
 | 86 | struct usbdevfs_iso_packet_desc { | 
 | 87 | 	unsigned int length; | 
 | 88 | 	unsigned int actual_length; | 
 | 89 | 	unsigned int status; | 
 | 90 | }; | 
 | 91 |  | 
 | 92 | struct usbdevfs_urb { | 
 | 93 | 	unsigned char type; | 
 | 94 | 	unsigned char endpoint; | 
 | 95 | 	int status; | 
 | 96 | 	unsigned int flags; | 
 | 97 | 	void __user *buffer; | 
 | 98 | 	int buffer_length; | 
 | 99 | 	int actual_length; | 
 | 100 | 	int start_frame; | 
 | 101 | 	int number_of_packets; | 
 | 102 | 	int error_count; | 
 | 103 | 	unsigned int signr;	 | 
 | 104 | 	void __user *usercontext; | 
 | 105 | 	struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | 
 | 106 | }; | 
 | 107 |  | 
 | 108 | struct usbdevfs_ioctl { | 
 | 109 | 	int	ifno;		 | 
 | 110 | 	int	ioctl_code;	 | 
 | 111 | 	void __user *data;	 | 
 | 112 | }; | 
 | 113 |  | 
 | 114 | struct usbdevfs_hub_portinfo { | 
 | 115 | 	char nports;		 | 
 | 116 | 	char port [127];	 | 
 | 117 | }; | 
 | 118 |  | 
 | 119 | #ifdef __KERNEL__ | 
 | 120 | #ifdef CONFIG_COMPAT | 
 | 121 | #include <linux/compat.h> | 
 | 122 |  | 
 | 123 | struct usbdevfs_ctrltransfer32 { | 
 | 124 |         u8 bRequestType; | 
 | 125 |         u8 bRequest; | 
 | 126 |         u16 wValue; | 
 | 127 |         u16 wIndex; | 
 | 128 |         u16 wLength; | 
 | 129 |         u32 timeout;   | 
 | 130 |         compat_caddr_t data; | 
 | 131 | }; | 
 | 132 |  | 
 | 133 | struct usbdevfs_bulktransfer32 { | 
 | 134 |         compat_uint_t ep; | 
 | 135 |         compat_uint_t len; | 
 | 136 |         compat_uint_t timeout;  | 
 | 137 |         compat_caddr_t data; | 
 | 138 | }; | 
 | 139 |  | 
 | 140 | struct usbdevfs_disconnectsignal32 { | 
 | 141 |         compat_int_t signr; | 
 | 142 |         compat_caddr_t context; | 
 | 143 | }; | 
 | 144 |  | 
 | 145 | struct usbdevfs_urb32 { | 
 | 146 | 	unsigned char type; | 
 | 147 | 	unsigned char endpoint; | 
 | 148 | 	compat_int_t status; | 
 | 149 | 	compat_uint_t flags; | 
 | 150 | 	compat_caddr_t buffer; | 
 | 151 | 	compat_int_t buffer_length; | 
 | 152 | 	compat_int_t actual_length; | 
 | 153 | 	compat_int_t start_frame; | 
 | 154 | 	compat_int_t number_of_packets; | 
 | 155 | 	compat_int_t error_count; | 
 | 156 | 	compat_uint_t signr; | 
 | 157 | 	compat_caddr_t usercontext;  | 
 | 158 | 	struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | 
 | 159 | }; | 
 | 160 |  | 
 | 161 | struct usbdevfs_ioctl32 { | 
 | 162 | 	s32 ifno; | 
 | 163 | 	s32 ioctl_code; | 
 | 164 | 	compat_caddr_t data; | 
 | 165 | }; | 
 | 166 | #endif | 
 | 167 | #endif  | 
 | 168 |  | 
 | 169 | #define USBDEVFS_CONTROL           _IOWR('U', 0, struct usbdevfs_ctrltransfer) | 
 | 170 | #define USBDEVFS_CONTROL32           _IOWR('U', 0, struct usbdevfs_ctrltransfer32) | 
 | 171 | #define USBDEVFS_BULK              _IOWR('U', 2, struct usbdevfs_bulktransfer) | 
 | 172 | #define USBDEVFS_BULK32              _IOWR('U', 2, struct usbdevfs_bulktransfer32) | 
 | 173 | #define USBDEVFS_RESETEP           _IOR('U', 3, unsigned int) | 
 | 174 | #define USBDEVFS_SETINTERFACE      _IOR('U', 4, struct usbdevfs_setinterface) | 
 | 175 | #define USBDEVFS_SETCONFIGURATION  _IOR('U', 5, unsigned int) | 
 | 176 | #define USBDEVFS_GETDRIVER         _IOW('U', 8, struct usbdevfs_getdriver) | 
 | 177 | #define USBDEVFS_SUBMITURB         _IOR('U', 10, struct usbdevfs_urb) | 
 | 178 | #define USBDEVFS_SUBMITURB32       _IOR('U', 10, struct usbdevfs_urb32) | 
 | 179 | #define USBDEVFS_DISCARDURB        _IO('U', 11) | 
 | 180 | #define USBDEVFS_REAPURB           _IOW('U', 12, void *) | 
 | 181 | #define USBDEVFS_REAPURB32         _IOW('U', 12, __u32) | 
 | 182 | #define USBDEVFS_REAPURBNDELAY     _IOW('U', 13, void *) | 
 | 183 | #define USBDEVFS_REAPURBNDELAY32   _IOW('U', 13, __u32) | 
 | 184 | #define USBDEVFS_DISCSIGNAL        _IOR('U', 14, struct usbdevfs_disconnectsignal) | 
 | 185 | #define USBDEVFS_DISCSIGNAL32      _IOR('U', 14, struct usbdevfs_disconnectsignal32) | 
 | 186 | #define USBDEVFS_CLAIMINTERFACE    _IOR('U', 15, unsigned int) | 
 | 187 | #define USBDEVFS_RELEASEINTERFACE  _IOR('U', 16, unsigned int) | 
 | 188 | #define USBDEVFS_CONNECTINFO       _IOW('U', 17, struct usbdevfs_connectinfo) | 
 | 189 | #define USBDEVFS_IOCTL             _IOWR('U', 18, struct usbdevfs_ioctl) | 
 | 190 | #define USBDEVFS_IOCTL32           _IOWR('U', 18, struct usbdevfs_ioctl32) | 
 | 191 | #define USBDEVFS_HUB_PORTINFO      _IOR('U', 19, struct usbdevfs_hub_portinfo) | 
 | 192 | #define USBDEVFS_RESET             _IO('U', 20) | 
 | 193 | #define USBDEVFS_CLEAR_HALT        _IOR('U', 21, unsigned int) | 
 | 194 | #define USBDEVFS_DISCONNECT        _IO('U', 22) | 
 | 195 | #define USBDEVFS_CONNECT           _IO('U', 23) | 
 | 196 | #define USBDEVFS_CLAIM_PORT        _IOR('U', 24, unsigned int) | 
 | 197 | #define USBDEVFS_RELEASE_PORT      _IOR('U', 25, unsigned int) | 
 | 198 | #endif  |