| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /*****************************************************************************/ | 
 | 2 |  | 
 | 3 | /* | 
 | 4 |  *	usbdevice_fs.h  --  USB device file system. | 
 | 5 |  * | 
 | 6 |  *	Copyright (C) 2000 | 
 | 7 |  *          Thomas Sailer (sailer@ife.ee.ethz.ch) | 
 | 8 |  * | 
 | 9 |  *	This program is free software; you can redistribute it and/or modify | 
 | 10 |  *	it under the terms of the GNU General Public License as published by | 
 | 11 |  *	the Free Software Foundation; either version 2 of the License, or | 
 | 12 |  *	(at your option) any later version. | 
 | 13 |  * | 
 | 14 |  *	This program is distributed in the hope that it will be useful, | 
 | 15 |  *	but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 16 |  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 17 |  *	GNU General Public License for more details. | 
 | 18 |  * | 
 | 19 |  *	You should have received a copy of the GNU General Public License | 
 | 20 |  *	along with this program; if not, write to the Free Software | 
 | 21 |  *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
 | 22 |  * | 
 | 23 |  *  History: | 
 | 24 |  *   0.1  04.01.2000  Created | 
 | 25 |  * | 
 | 26 |  *  $Id: usbdevice_fs.h,v 1.1 2000/01/06 18:40:41 tom Exp $ | 
 | 27 |  */ | 
 | 28 |  | 
 | 29 | /*****************************************************************************/ | 
 | 30 |  | 
 | 31 | #ifndef _LINUX_USBDEVICE_FS_H | 
 | 32 | #define _LINUX_USBDEVICE_FS_H | 
 | 33 |  | 
 | 34 | #include <linux/types.h> | 
| Jeff Garzik | e18fa70 | 2006-09-24 11:13:19 -0400 | [diff] [blame] | 35 | #include <linux/magic.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 |  | 
 | 37 | /* --------------------------------------------------------------------- */ | 
 | 38 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | /* usbdevfs ioctl codes */ | 
 | 40 |  | 
 | 41 | struct usbdevfs_ctrltransfer { | 
 | 42 | 	__u8 bRequestType; | 
 | 43 | 	__u8 bRequest; | 
 | 44 | 	__u16 wValue; | 
 | 45 | 	__u16 wIndex; | 
 | 46 | 	__u16 wLength; | 
 | 47 | 	__u32 timeout;  /* in milliseconds */ | 
 | 48 |  	void __user *data; | 
 | 49 | }; | 
 | 50 |  | 
 | 51 | struct usbdevfs_bulktransfer { | 
 | 52 | 	unsigned int ep; | 
 | 53 | 	unsigned int len; | 
 | 54 | 	unsigned int timeout; /* in milliseconds */ | 
 | 55 | 	void __user *data; | 
 | 56 | }; | 
 | 57 |  | 
 | 58 | struct usbdevfs_setinterface { | 
 | 59 | 	unsigned int interface; | 
 | 60 | 	unsigned int altsetting; | 
 | 61 | }; | 
 | 62 |  | 
 | 63 | struct usbdevfs_disconnectsignal { | 
 | 64 | 	unsigned int signr; | 
 | 65 | 	void __user *context; | 
 | 66 | }; | 
 | 67 |  | 
 | 68 | #define USBDEVFS_MAXDRIVERNAME 255 | 
 | 69 |  | 
 | 70 | struct usbdevfs_getdriver { | 
 | 71 | 	unsigned int interface; | 
 | 72 | 	char driver[USBDEVFS_MAXDRIVERNAME + 1]; | 
 | 73 | }; | 
 | 74 |  | 
 | 75 | struct usbdevfs_connectinfo { | 
 | 76 | 	unsigned int devnum; | 
 | 77 | 	unsigned char slow; | 
 | 78 | }; | 
 | 79 |  | 
| Alan Stern | 14722ef | 2008-04-17 10:18:11 -0400 | [diff] [blame] | 80 | #define USBDEVFS_URB_SHORT_NOT_OK	0x01 | 
 | 81 | #define USBDEVFS_URB_ISO_ASAP		0x02 | 
 | 82 | #define USBDEVFS_URB_NO_FSBR		0x20 | 
 | 83 | #define USBDEVFS_URB_ZERO_PACKET	0x40 | 
 | 84 | #define USBDEVFS_URB_NO_INTERRUPT	0x80 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 |  | 
 | 86 | #define USBDEVFS_URB_TYPE_ISO		   0 | 
 | 87 | #define USBDEVFS_URB_TYPE_INTERRUPT	   1 | 
 | 88 | #define USBDEVFS_URB_TYPE_CONTROL	   2 | 
 | 89 | #define USBDEVFS_URB_TYPE_BULK		   3 | 
 | 90 |  | 
 | 91 | struct usbdevfs_iso_packet_desc { | 
 | 92 | 	unsigned int length; | 
 | 93 | 	unsigned int actual_length; | 
 | 94 | 	unsigned int status; | 
 | 95 | }; | 
 | 96 |  | 
 | 97 | struct usbdevfs_urb { | 
 | 98 | 	unsigned char type; | 
 | 99 | 	unsigned char endpoint; | 
 | 100 | 	int status; | 
 | 101 | 	unsigned int flags; | 
 | 102 | 	void __user *buffer; | 
 | 103 | 	int buffer_length; | 
 | 104 | 	int actual_length; | 
 | 105 | 	int start_frame; | 
 | 106 | 	int number_of_packets; | 
 | 107 | 	int error_count; | 
| Phil Endecott | bc59462 | 2007-10-29 20:40:30 +0000 | [diff] [blame] | 108 | 	unsigned int signr;	/* signal to be sent on completion, | 
 | 109 | 				  or 0 if none should be sent. */ | 
| Marcin Slusarz | 7f9705b | 2007-12-16 03:23:20 +0100 | [diff] [blame] | 110 | 	void __user *usercontext; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | 	struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | 
 | 112 | }; | 
 | 113 |  | 
 | 114 | /* ioctls for talking directly to drivers */ | 
 | 115 | struct usbdevfs_ioctl { | 
 | 116 | 	int	ifno;		/* interface 0..N ; negative numbers reserved */ | 
 | 117 | 	int	ioctl_code;	/* MUST encode size + direction of data so the | 
 | 118 | 				 * macros in <asm/ioctl.h> give correct values */ | 
 | 119 | 	void __user *data;	/* param buffer (in, or out) */ | 
 | 120 | }; | 
 | 121 |  | 
 | 122 | /* You can do most things with hubs just through control messages, | 
 | 123 |  * except find out what device connects to what port. */ | 
 | 124 | struct usbdevfs_hub_portinfo { | 
 | 125 | 	char nports;		/* number of downstream ports in this hub */ | 
 | 126 | 	char port [127];	/* e.g. port 3 connects to device 27 */ | 
 | 127 | }; | 
 | 128 |  | 
| David Woodhouse | eae19a7 | 2006-04-25 15:14:50 +0100 | [diff] [blame] | 129 | #ifdef __KERNEL__ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | #ifdef CONFIG_COMPAT | 
| Harald Welte | ce44159 | 2005-09-03 11:27:08 +0200 | [diff] [blame] | 131 | #include <linux/compat.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | struct usbdevfs_urb32 { | 
 | 133 | 	unsigned char type; | 
 | 134 | 	unsigned char endpoint; | 
 | 135 | 	compat_int_t status; | 
 | 136 | 	compat_uint_t flags; | 
 | 137 | 	compat_caddr_t buffer; | 
 | 138 | 	compat_int_t buffer_length; | 
 | 139 | 	compat_int_t actual_length; | 
 | 140 | 	compat_int_t start_frame; | 
 | 141 | 	compat_int_t number_of_packets; | 
 | 142 | 	compat_int_t error_count; | 
 | 143 | 	compat_uint_t signr; | 
 | 144 | 	compat_caddr_t usercontext; /* unused */ | 
 | 145 | 	struct usbdevfs_iso_packet_desc iso_frame_desc[0]; | 
 | 146 | }; | 
| Pete Zaitcev | c36fc88 | 2005-10-17 18:15:54 -0700 | [diff] [blame] | 147 |  | 
 | 148 | struct usbdevfs_ioctl32 { | 
 | 149 | 	s32 ifno; | 
 | 150 | 	s32 ioctl_code; | 
 | 151 | 	compat_caddr_t data; | 
 | 152 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | #endif | 
| David Woodhouse | eae19a7 | 2006-04-25 15:14:50 +0100 | [diff] [blame] | 154 | #endif /* __KERNEL__ */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 |  | 
 | 156 | #define USBDEVFS_CONTROL           _IOWR('U', 0, struct usbdevfs_ctrltransfer) | 
 | 157 | #define USBDEVFS_BULK              _IOWR('U', 2, struct usbdevfs_bulktransfer) | 
 | 158 | #define USBDEVFS_RESETEP           _IOR('U', 3, unsigned int) | 
 | 159 | #define USBDEVFS_SETINTERFACE      _IOR('U', 4, struct usbdevfs_setinterface) | 
 | 160 | #define USBDEVFS_SETCONFIGURATION  _IOR('U', 5, unsigned int) | 
 | 161 | #define USBDEVFS_GETDRIVER         _IOW('U', 8, struct usbdevfs_getdriver) | 
 | 162 | #define USBDEVFS_SUBMITURB         _IOR('U', 10, struct usbdevfs_urb) | 
 | 163 | #define USBDEVFS_SUBMITURB32       _IOR('U', 10, struct usbdevfs_urb32) | 
 | 164 | #define USBDEVFS_DISCARDURB        _IO('U', 11) | 
 | 165 | #define USBDEVFS_REAPURB           _IOW('U', 12, void *) | 
| Mike Frysinger | fc8d919 | 2007-02-05 16:41:03 -0800 | [diff] [blame] | 166 | #define USBDEVFS_REAPURB32         _IOW('U', 12, __u32) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | #define USBDEVFS_REAPURBNDELAY     _IOW('U', 13, void *) | 
| Mike Frysinger | fc8d919 | 2007-02-05 16:41:03 -0800 | [diff] [blame] | 168 | #define USBDEVFS_REAPURBNDELAY32   _IOW('U', 13, __u32) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | #define USBDEVFS_DISCSIGNAL        _IOR('U', 14, struct usbdevfs_disconnectsignal) | 
 | 170 | #define USBDEVFS_CLAIMINTERFACE    _IOR('U', 15, unsigned int) | 
 | 171 | #define USBDEVFS_RELEASEINTERFACE  _IOR('U', 16, unsigned int) | 
 | 172 | #define USBDEVFS_CONNECTINFO       _IOW('U', 17, struct usbdevfs_connectinfo) | 
 | 173 | #define USBDEVFS_IOCTL             _IOWR('U', 18, struct usbdevfs_ioctl) | 
| Pete Zaitcev | c36fc88 | 2005-10-17 18:15:54 -0700 | [diff] [blame] | 174 | #define USBDEVFS_IOCTL32           _IOWR('U', 18, struct usbdevfs_ioctl32) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | #define USBDEVFS_HUB_PORTINFO      _IOR('U', 19, struct usbdevfs_hub_portinfo) | 
 | 176 | #define USBDEVFS_RESET             _IO('U', 20) | 
 | 177 | #define USBDEVFS_CLEAR_HALT        _IOR('U', 21, unsigned int) | 
 | 178 | #define USBDEVFS_DISCONNECT        _IO('U', 22) | 
 | 179 | #define USBDEVFS_CONNECT           _IO('U', 23) | 
 | 180 | #endif /* _LINUX_USBDEVICE_FS_H */ |