如何在linux内核模块中为虚拟输入设备(/ dev / input / js3)创建事件#设备?

时间:2013-07-26 19:58:22

标签: linux input linux-kernel kernel-module joystick

我正在编写一个linux内核模块,该模块使用N个真实/ dev / input / js#设备并将它们作为单个/ dev / input / js3设备进行代理。目前我的模块正在创建/ dev / input / js3,jstest对它很满意,但不是真正的应用程序。我猜(strace'd)就是这样,因为我的虚拟js3设备没有匹配的/ dev / input / event#对。如何从我的模块中创建一个?

这是我的模块的来源,可能有很多问题,但主要是工作:https://github.com/iamtakingiteasy/unijoy/blob/master/unijoy.c

1 个答案:

答案 0 :(得分:0)

以下是一个示例,您可以使用

1. class_create to create the class specified for the device,
2. device_create to create the device node
3. cdev_init to initialize and 
4. cdev_add to add the device to the /dev list

例如,您可以参考以下链接:Create a device node in kernel module