blob: fb57c221746827a06a1f7153ad794728771b1c89 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*****************************************************************************/
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>
35#include <linux/compat.h>
36
37/* --------------------------------------------------------------------- */
38
39#define USBDEVICE_SUPER_MAGIC 0x9fa2
40
41/* usbdevfs ioctl codes */
42
43struct usbdevfs_ctrltransfer {
44 __u8 bRequestType;
45 __u8 bRequest;
46 __u16 wValue;
47 __u16 wIndex;
48 __u16 wLength;
49 __u32 timeout; /* in milliseconds */
50 void __user *data;
51};
52
53struct usbdevfs_bulktransfer {
54 unsigned int ep;
55 unsigned int len;
56 unsigned int timeout; /* in milliseconds */
57 void __user *data;
58};
59
60struct usbdevfs_setinterface {
61 unsigned int interface;
62 unsigned int altsetting;
63};
64
65struct usbdevfs_disconnectsignal {
66 unsigned int signr;
67 void __user *context;
68};
69
70#define USBDEVFS_MAXDRIVERNAME 255
71
72struct usbdevfs_getdriver {
73 unsigned int interface;
74 char driver[USBDEVFS_MAXDRIVERNAME + 1];
75};
76
77struct usbdevfs_connectinfo {
78 unsigned int devnum;
79 unsigned char slow;
80};
81
82#define USBDEVFS_URB_SHORT_NOT_OK 1
83#define USBDEVFS_URB_ISO_ASAP 2
84
85#define USBDEVFS_URB_TYPE_ISO 0
86#define USBDEVFS_URB_TYPE_INTERRUPT 1
87#define USBDEVFS_URB_TYPE_CONTROL 2
88#define USBDEVFS_URB_TYPE_BULK 3
89
90struct usbdevfs_iso_packet_desc {
91 unsigned int length;
92 unsigned int actual_length;
93 unsigned int status;
94};
95
96struct usbdevfs_urb {
97 unsigned char type;
98 unsigned char endpoint;
99 int status;
100 unsigned int flags;
101 void __user *buffer;
102 int buffer_length;
103 int actual_length;
104 int start_frame;
105 int number_of_packets;
106 int error_count;
107 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */
108 void *usercontext;
109 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
110};
111
112/* ioctls for talking directly to drivers */
113struct usbdevfs_ioctl {
114 int ifno; /* interface 0..N ; negative numbers reserved */
115 int ioctl_code; /* MUST encode size + direction of data so the
116 * macros in <asm/ioctl.h> give correct values */
117 void __user *data; /* param buffer (in, or out) */
118};
119
120/* You can do most things with hubs just through control messages,
121 * except find out what device connects to what port. */
122struct usbdevfs_hub_portinfo {
123 char nports; /* number of downstream ports in this hub */
124 char port [127]; /* e.g. port 3 connects to device 27 */
125};
126
127#ifdef CONFIG_COMPAT
128struct usbdevfs_urb32 {
129 unsigned char type;
130 unsigned char endpoint;
131 compat_int_t status;
132 compat_uint_t flags;
133 compat_caddr_t buffer;
134 compat_int_t buffer_length;
135 compat_int_t actual_length;
136 compat_int_t start_frame;
137 compat_int_t number_of_packets;
138 compat_int_t error_count;
139 compat_uint_t signr;
140 compat_caddr_t usercontext; /* unused */
141 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
142};
143#endif
144
145#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
146#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
147#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
148#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
149#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
150#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
151#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
152#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
153#define USBDEVFS_DISCARDURB _IO('U', 11)
154#define USBDEVFS_REAPURB _IOW('U', 12, void *)
155#define USBDEVFS_REAPURB32 _IOW('U', 12, u32)
156#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
157#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, u32)
158#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
159#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
160#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
161#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
162#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
163#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
164#define USBDEVFS_RESET _IO('U', 20)
165#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
166#define USBDEVFS_DISCONNECT _IO('U', 22)
167#define USBDEVFS_CONNECT _IO('U', 23)
168#endif /* _LINUX_USBDEVICE_FS_H */