⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux-input.h

📁 主要是对Linux输入子系统的一些简单操作 比如lsinput是看有多少输入设备 比如input-events是看输入设备的键值 用来调试输入子系统很好
💻 H
📖 第 1 页 / 共 2 页
字号:
#define KEY_CHANNELDOWN		0x193#define KEY_FIRST		0x194#define KEY_LAST		0x195#define KEY_AB			0x196#define KEY_NEXT		0x197#define KEY_RESTART		0x198#define KEY_SLOW		0x199#define KEY_SHUFFLE		0x19a#define KEY_BREAK		0x19b#define KEY_PREVIOUS		0x19c#define KEY_DIGITS		0x19d#define KEY_TEEN		0x19e#define KEY_TWEN		0x19f#define KEY_DEL_EOL		0x1c0#define KEY_DEL_EOS		0x1c1#define KEY_INS_LINE		0x1c2#define KEY_DEL_LINE		0x1c3#define KEY_MAX			0x1ff/* * Relative axes */#define REL_X			0x00#define REL_Y			0x01#define REL_Z			0x02#define REL_HWHEEL		0x06#define REL_DIAL		0x07#define REL_WHEEL		0x08#define REL_MISC		0x09#define REL_MAX			0x0f/* * Absolute axes */#define ABS_X			0x00#define ABS_Y			0x01#define ABS_Z			0x02#define ABS_RX			0x03#define ABS_RY			0x04#define ABS_RZ			0x05#define ABS_THROTTLE		0x06#define ABS_RUDDER		0x07#define ABS_WHEEL		0x08#define ABS_GAS			0x09#define ABS_BRAKE		0x0a#define ABS_HAT0X		0x10#define ABS_HAT0Y		0x11#define ABS_HAT1X		0x12#define ABS_HAT1Y		0x13#define ABS_HAT2X		0x14#define ABS_HAT2Y		0x15#define ABS_HAT3X		0x16#define ABS_HAT3Y		0x17#define ABS_PRESSURE		0x18#define ABS_DISTANCE		0x19#define ABS_TILT_X		0x1a#define ABS_TILT_Y		0x1b#define ABS_VOLUME		0x20#define ABS_MISC		0x28#define ABS_MAX			0x3f/* * Misc events */#define MSC_SERIAL		0x00#define MSC_PULSELED		0x01#define MSC_GESTURE		0x02#define MSC_MAX			0x07/* * LEDs */#define LED_NUML		0x00#define LED_CAPSL		0x01#define LED_SCROLLL		0x02#define LED_COMPOSE		0x03#define LED_KANA		0x04#define LED_SLEEP		0x05#define LED_SUSPEND		0x06#define LED_MUTE		0x07#define LED_MISC		0x08#define LED_MAX			0x0f/* * Autorepeat values */#define REP_DELAY		0x00#define REP_PERIOD		0x01#define REP_MAX			0x01/* * Sounds */#define SND_CLICK		0x00#define SND_BELL		0x01#define SND_TONE		0x02#define SND_MAX			0x07/* * IDs. */#define ID_BUS			0#define ID_VENDOR		1#define ID_PRODUCT		2#define ID_VERSION		3#define BUS_PCI			0x01#define BUS_ISAPNP		0x02#define BUS_USB			0x03#define BUS_HIL			0x04#define BUS_ISA			0x10#define BUS_I8042		0x11#define BUS_XTKBD		0x12#define BUS_RS232		0x13#define BUS_GAMEPORT		0x14#define BUS_PARPORT		0x15#define BUS_AMIGA		0x16#define BUS_ADB			0x17#define BUS_I2C			0x18#define BUS_HOST		0x19/* * Values describing the status of an effect */#define FF_STATUS_STOPPED	0x00#define FF_STATUS_PLAYING	0x01#define FF_STATUS_MAX		0x01/* * Structures used in ioctls to upload effects to a device * The first structures are not passed directly by using ioctls. * They are sub-structures of the actually sent structure (called ff_effect) */struct ff_replay {	__u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */	__u16 delay;  /* Time to wait before to start playing an effect */};struct ff_trigger {	__u16 button;   /* Number of button triggering an effect */	__u16 interval; /* Time to wait before an effect can be re-triggered (ms) */};struct ff_envelope {	__u16 attack_length;	/* Duration of attack (ms) */	__u16 attack_level;	/* Level at beginning of attack */	__u16 fade_length;	/* Duration of fade (ms) */	__u16 fade_level;	/* Level at end of fade */};/* FF_CONSTANT */struct ff_constant_effect {	__s16 level;	    /* Strength of effect. Negative values are OK */	struct ff_envelope envelope;};/* FF_RAMP */struct ff_ramp_effect {	__s16 start_level;	__s16 end_level;	struct ff_envelope envelope;};/* FF_SPRING of FF_FRICTION */struct ff_condition_effect {	__u16 right_saturation; /* Max level when joystick is on the right */	__u16 left_saturation;  /* Max level when joystick in on the left */	__s16 right_coeff;	/* Indicates how fast the force grows when the				   joystick moves to the right */	__s16 left_coeff;	/* Same for left side */	__u16 deadband;	/* Size of area where no force is produced */	__s16 center;	/* Position of dead zone */};/* FF_PERIODIC */struct ff_periodic_effect {	__u16 waveform;	/* Kind of wave (sine, square...) */	__u16 period;	/* in ms */	__s16 magnitude;	/* Peak value */	__s16 offset;	/* Mean value of wave (roughly) */	__u16 phase;		/* 'Horizontal' shift */	struct ff_envelope envelope;/* Only used if waveform == FF_CUSTOM */	__u32 custom_len;	/* Number of samples  */		__s16 *custom_data;	/* Buffer of samples *//* Note: the data pointed by custom_data is copied by the driver. You can * therefore dispose of the memory after the upload/update */};/* FF_RUMBLE *//* Some rumble pads have two motors of different weight.   strong_magnitude represents the magnitude of the vibration generated   by the heavy motor.*/struct ff_rumble_effect {	__u16 strong_magnitude;  /* Magnitude of the heavy motor */	__u16 weak_magnitude;    /* Magnitude of the light one */};/* * Structure sent through ioctl from the application to the driver */struct ff_effect {	__u16 type;/* Following field denotes the unique id assigned to an effect. * If user sets if to -1, a new effect is created, and its id is returned in the same field * Else, the user sets it to the effect id it wants to update. */	__s16 id;	__u16 direction;	/* Direction. 0 deg -> 0x0000 (down)					     90 deg -> 0x4000 (left)					    180 deg -> 0x8000 (up)					    270 deg -> 0xC000 (right)				*/	struct ff_trigger trigger;	struct ff_replay replay;	union {		struct ff_constant_effect constant;		struct ff_ramp_effect ramp;		struct ff_periodic_effect periodic;		struct ff_condition_effect condition[2]; /* One for each axis */		struct ff_rumble_effect rumble;	} u;};/* * Force feedback effect types */#define FF_RUMBLE	0x50#define FF_PERIODIC	0x51#define FF_CONSTANT	0x52#define FF_SPRING	0x53#define FF_FRICTION	0x54#define FF_DAMPER	0x55#define FF_INERTIA	0x56#define FF_RAMP		0x57/* * Force feedback periodic effect types */#define FF_SQUARE	0x58#define FF_TRIANGLE	0x59#define FF_SINE		0x5a#define FF_SAW_UP	0x5b#define FF_SAW_DOWN	0x5c#define FF_CUSTOM	0x5d/* * Set ff device properties */#define FF_GAIN		0x60#define FF_AUTOCENTER	0x61#define FF_MAX		0x7f#ifdef __KERNEL__/* * In-kernel definitions. */#include <linux/fs.h>#include <linux/timer.h>#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)#define BIT(x)	(1UL<<((x)%BITS_PER_LONG))#define LONG(x) ((x)/BITS_PER_LONG)#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \	((dev->keycodesize == 1) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))#define init_input_dev(dev)	do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)struct input_dev {	void *private;	char *name;	char *phys;	char *uniq;	struct input_id id;	unsigned long evbit[NBITS(EV_MAX)];	unsigned long keybit[NBITS(KEY_MAX)];	unsigned long relbit[NBITS(REL_MAX)];	unsigned long absbit[NBITS(ABS_MAX)];	unsigned long mscbit[NBITS(MSC_MAX)];	unsigned long ledbit[NBITS(LED_MAX)];	unsigned long sndbit[NBITS(SND_MAX)];	unsigned long ffbit[NBITS(FF_MAX)];	int ff_effects_max;	unsigned int keycodemax;	unsigned int keycodesize;	void *keycode;	unsigned int repeat_key;	struct timer_list timer;	struct pm_dev *pm_dev;	struct pt_regs *regs;	int state;	int sync;	int abs[ABS_MAX + 1];	int rep[REP_MAX + 1];	unsigned long key[NBITS(KEY_MAX)];	unsigned long led[NBITS(LED_MAX)];	unsigned long snd[NBITS(SND_MAX)];	int absmax[ABS_MAX + 1];	int absmin[ABS_MAX + 1];	int absfuzz[ABS_MAX + 1];	int absflat[ABS_MAX + 1];	int (*open)(struct input_dev *dev);	void (*close)(struct input_dev *dev);	int (*accept)(struct input_dev *dev, struct file *file);	int (*flush)(struct input_dev *dev, struct file *file);	int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);	int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);	int (*erase_effect)(struct input_dev *dev, int effect_id);	struct input_handle *grab;	struct list_head	h_list;	struct list_head	node;};/* * Structure for hotplug & device<->driver matching. */#define INPUT_DEVICE_ID_MATCH_BUS	1#define INPUT_DEVICE_ID_MATCH_VENDOR	2#define INPUT_DEVICE_ID_MATCH_PRODUCT	4#define INPUT_DEVICE_ID_MATCH_VERSION	8#define INPUT_DEVICE_ID_MATCH_EVBIT	0x010#define INPUT_DEVICE_ID_MATCH_KEYBIT	0x020#define INPUT_DEVICE_ID_MATCH_RELBIT	0x040#define INPUT_DEVICE_ID_MATCH_ABSBIT	0x080#define INPUT_DEVICE_ID_MATCH_MSCIT	0x100#define INPUT_DEVICE_ID_MATCH_LEDBIT	0x200#define INPUT_DEVICE_ID_MATCH_SNDBIT	0x400#define INPUT_DEVICE_ID_MATCH_FFBIT	0x800#define INPUT_DEVICE_ID_MATCH_DEVICE\	(INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\	(INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)struct input_device_id {	unsigned long flags;	struct input_id id;	unsigned long evbit[NBITS(EV_MAX)];	unsigned long keybit[NBITS(KEY_MAX)];	unsigned long relbit[NBITS(REL_MAX)];	unsigned long absbit[NBITS(ABS_MAX)];	unsigned long mscbit[NBITS(MSC_MAX)];	unsigned long ledbit[NBITS(LED_MAX)];	unsigned long sndbit[NBITS(SND_MAX)];	unsigned long ffbit[NBITS(FF_MAX)];	unsigned long driver_info;};struct input_handle;struct input_handler {	void *private;	void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);	struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);	void (*disconnect)(struct input_handle *handle);	struct file_operations *fops;	int minor;	char *name;	struct input_device_id *id_table;	struct list_head	h_list;	struct list_head	node;};struct input_handle {	void *private;	int open;	char *name;	struct input_dev *dev;	struct input_handler *handler;	struct list_head	d_node;	struct list_head	h_node;};#define to_dev(n) container_of(n,struct input_dev,node)#define to_handler(n) container_of(n,struct input_handler,node);#define to_handle(n) container_of(n,struct input_handle,d_node)#define to_handle_h(n) container_of(n,struct input_handle,h_node)void input_register_device(struct input_dev *);void input_unregister_device(struct input_dev *);void input_register_handler(struct input_handler *);void input_unregister_handler(struct input_handler *);int input_grab_device(struct input_handle *);void input_release_device(struct input_handle *);int input_open_device(struct input_handle *);void input_close_device(struct input_handle *);int input_accept_process(struct input_handle *handle, struct file *file);int input_flush_device(struct input_handle* handle, struct file* file);void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);#define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c))#define input_report_rel(a,b,c) input_event(a, EV_REL, b, c)#define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c)#define input_report_ff(a,b,c)	input_event(a, EV_FF, b, c)#define input_report_ff_status(a,b,c)	input_event(a, EV_FF_STATUS, b, c)#define input_regs(a,b)		do { (a)->regs = (b); } while (0)#define input_sync(a)		do { input_event(a, EV_SYN, SYN_REPORT, 0); (a)->regs = NULL; } while (0)extern struct class input_class;#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -