Blame view

include/linux/uinput.h 2.39 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  /*
   *  User level driver support for input subsystem
   *
   * Heavily based on evdev.c by Vojtech Pavlik
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
   *
   * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
221979aad   Dmitry Torokhov   Input: uinput - s...
21
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
   * Changes/Revisions:
052876f8e   Benjamin Tissoires   Input: uinput - a...
23
24
25
26
27
   *	0.5	08/13/2015 (David Herrmann <dh.herrmann@gmail.com> &
   *			    Benjamin Tissoires <benjamin.tissoires@redhat.com>)
   *		- add UI_DEV_SETUP ioctl
   *		- add UI_ABS_SETUP ioctl
   *		- add UI_GET_VERSION ioctl
e3480a61f   Benjamin Tissoires   Input: uinput - a...
28
29
   *	0.4	01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
   *		- add UI_GET_SYSNAME ioctl
ff4625512   Anssi Hannula   Input: uinput - s...
30
31
32
   *	0.3	24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
   *		- update ff support for the changes in kernel interface
   *		- add UINPUT_VERSION
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
36
37
38
   *	0.2	16/10/2004 (Micah Dowty <micah@navi.cx>)
   *		- added force feedback support
   *             - added UI_SET_PHYS
   *	0.1	20/06/2002
   *		- first public version
   */
607ca46e9   David Howells   UAPI: (Scripted) ...
39
40
  #ifndef __UINPUT_H_
  #define __UINPUT_H_
ff4625512   Anssi Hannula   Input: uinput - s...
41

607ca46e9   David Howells   UAPI: (Scripted) ...
42
  #include <uapi/linux/uinput.h>
ff4625512   Anssi Hannula   Input: uinput - s...
43

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
45
46
  #define UINPUT_NAME		"uinput"
  #define UINPUT_BUFFER_SIZE	16
  #define UINPUT_NUM_REQUESTS	16
29506415a   Dmitry Torokhov   Input: uinput - c...
47
  enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
  
  struct uinput_request {
c5b3533a8   Dmitry Torokhov   Input: uinput - s...
50
51
  	unsigned int		id;
  	unsigned int		code;	/* UI_FF_UPLOAD, UI_FF_ERASE */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
  
  	int			retval;
0048e6030   Dmitry Torokhov   Input: uinput - u...
54
  	struct completion	done;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
  
  	union {
c5b3533a8   Dmitry Torokhov   Input: uinput - s...
57
  		unsigned int	effect_id;
ff4625512   Anssi Hannula   Input: uinput - s...
58
59
60
61
  		struct {
  			struct ff_effect *effect;
  			struct ff_effect *old;
  		} upload;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62
63
64
65
66
  	} u;
  };
  
  struct uinput_device {
  	struct input_dev	*dev;
221979aad   Dmitry Torokhov   Input: uinput - s...
67
  	struct mutex		mutex;
29506415a   Dmitry Torokhov   Input: uinput - c...
68
  	enum uinput_state	state;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
  	wait_queue_head_t	waitq;
29506415a   Dmitry Torokhov   Input: uinput - c...
70
71
72
  	unsigned char		ready;
  	unsigned char		head;
  	unsigned char		tail;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
  	struct input_event	buff[UINPUT_BUFFER_SIZE];
05be8b81a   Dan Carpenter   Input: force feed...
74
  	unsigned int		ff_effects_max;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
  
  	struct uinput_request	*requests[UINPUT_NUM_REQUESTS];
  	wait_queue_head_t	requests_waitq;
0048e6030   Dmitry Torokhov   Input: uinput - u...
78
  	spinlock_t		requests_lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
  #endif	/* __UINPUT_H_ */