如何在linux内核模块中捕获键盘?

时间:2017-02-16 13:02:08

标签: c linux linux-kernel keyboard keyboard-events

我正在尝试编写一个类似于'MouseKeys'应用程序的Linux内核模块 - 获取某些键然后输出鼠标事件。我正在努力尝试以这样的方式获取输入,以便我可以根据模块的某些内部状态丢弃或传递密钥 - 我想要的是:

int keyboard_callback(event) {
    if (active) {
        processKey(event);      // this would output mouse events
        return BLOCK_KEY_EVENT; // input is not visible to any applications
    }
    // input would be processed downstream as normal
    return PASSTHROUGH_KEY_EVENT;
}
....
register_input_handler(keyboard_callback);

0 个答案:

没有答案