2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* 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>
|
2006-02-19 13:22:36 +08:00
|
|
|
*
|
2005-04-17 06:20:36 +08:00
|
|
|
* Changes/Revisions:
|
2006-07-19 13:41:09 +08:00
|
|
|
* 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
|
|
|
|
* - update ff support for the changes in kernel interface
|
|
|
|
* - add UINPUT_VERSION
|
2005-04-17 06:20:36 +08:00
|
|
|
* 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
|
|
|
|
*/
|
2012-10-13 17:46:48 +08:00
|
|
|
#ifndef __UINPUT_H_
|
|
|
|
#define __UINPUT_H_
|
2006-07-19 13:41:09 +08:00
|
|
|
|
2012-10-13 17:46:48 +08:00
|
|
|
#include <uapi/linux/uinput.h>
|
2006-07-19 13:41:09 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#define UINPUT_NAME "uinput"
|
|
|
|
#define UINPUT_BUFFER_SIZE 16
|
|
|
|
#define UINPUT_NUM_REQUESTS 16
|
|
|
|
|
2005-11-20 13:51:22 +08:00
|
|
|
enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct uinput_request {
|
2012-07-30 13:48:32 +08:00
|
|
|
unsigned int id;
|
|
|
|
unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
int retval;
|
2005-06-30 13:48:14 +08:00
|
|
|
struct completion done;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
union {
|
2012-07-30 13:48:32 +08:00
|
|
|
unsigned int effect_id;
|
2006-07-19 13:41:09 +08:00
|
|
|
struct {
|
|
|
|
struct ff_effect *effect;
|
|
|
|
struct ff_effect *old;
|
|
|
|
} upload;
|
2005-04-17 06:20:36 +08:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct uinput_device {
|
|
|
|
struct input_dev *dev;
|
2006-02-19 13:22:36 +08:00
|
|
|
struct mutex mutex;
|
2005-11-20 13:51:22 +08:00
|
|
|
enum uinput_state state;
|
2005-04-17 06:20:36 +08:00
|
|
|
wait_queue_head_t waitq;
|
2005-11-20 13:51:22 +08:00
|
|
|
unsigned char ready;
|
|
|
|
unsigned char head;
|
|
|
|
unsigned char tail;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct input_event buff[UINPUT_BUFFER_SIZE];
|
2011-10-13 12:05:53 +08:00
|
|
|
unsigned int ff_effects_max;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct uinput_request *requests[UINPUT_NUM_REQUESTS];
|
|
|
|
wait_queue_head_t requests_waitq;
|
2005-06-30 13:48:14 +08:00
|
|
|
spinlock_t requests_lock;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
#endif /* __UINPUT_H_ */
|