linux的input输入系统下载,input系统——linux 输入子系统

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

待整理完善。。。

1. struct input_devstruct input_dev {

const char *name; //名字

const char *phys;

const char *uniq;

struct input_id id;

unsigned long propbit[BITS_TO_LONGS(INPUT_PROP_CNT)];

unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; // 设备所支持的事件类型

unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; // 按键类型

unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; // 相对值类型

unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; // 绝对值类型

unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; // 混合类型

unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; // LED类型

unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; // 声音类型

unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; // 力反馈

unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; // 开关类型???unsigned int hint_events_per_packet;

unsigned int keycodemax;

unsigned int keycodesize;

void *keycode;

int (*setkeycode)(struct input_dev *dev,

const struct input_keymap_entry *ke,

unsigned int *old_keycode);

int (*getkeycode)(struct input_dev *dev,

struct input_keymap_entry *ke);

struct ff_device *ff;

unsigned int repeat_key;

struct timer_list timer;

int rep[REP_CNT];

struct input_mt *mt;

struct input_absinfo *absinfo;

unsigned long key[BITS_TO_LONGS(KEY_CNT)];

unsigned long led[BITS_TO_LONGS(LED_CNT)];

unsigned long snd[BITS_TO_LONGS(SND_CNT)];

unsigned long sw[BITS_TO_LONGS(SW_CNT)];

int (*open)(struct input_dev *dev);

void (*close)(struct input_dev *dev);

int (*flush)(struct input_dev *dev, struct file *file);

int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);

struct input_handle __rcu *grab;

spinlock_t event_lock;

struct mutex mutex;

unsigned int users;

bool going_away;

struct device dev;

struct list_head h_list;

struct list_head node;

unsigned int num_vals;

unsigned int max_vals;

struct input_value *vals;

bool devres_managed;

};

2. 注册/注销函数int input_register_device搜索(struct input_dev *dev)

void input_unregister_device(struct input_dev *dev)

3. 设备所支持的事件类型有EV_KEY 按键

EV_REL 相对坐标

EV_ABS绝对坐标

EV_MSC 其它

EV_LED LED

EV_SND 声音

EV_FF 力反馈

EV_SW 开关???

4. 操作函数set_bit(EV_KEY, button_dev.evbit) // 设置支持的事件

void input_report_key(struct input_dev *dev,unsigned int code, int value) // 在中断过程中中,内核层使用input_report_key等函数向用户空间报告,然后应用程序读取状态。

void input_report_rel(struct input_dev *dev,unsigned int code, int value) // ..

void input_report_abs(struct input_dev *dev,unsigned int code, int value) // ..

input_sync() // 用于事件同步,它告知事件的接收者:驱动已经发出了一个完整的报告。

5. 事件代码

EV_KEY 事件代码代码值0~127为键盘上的按键代码,0x110~0x116为鼠标上按键代码,其中0x110(BTN_LEFT)为鼠标左键,0x111(BTN_RIGHT)为鼠标右键,0x112(BTN_ MIDDLE)为鼠标中键。其它代码含义请参看include/linux/input.h文件

EV_KEY 事件值按键按下时值为1,松开时值为0

evdev

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值