首页 > 代码库 > openwrt 实现hotplug-button
openwrt 实现hotplug-button
<*> kmod-gpio-button-hotplug................Simple GPIO Button Hotplug driver
gpio-button-hotplug是gpio-button platform总线的driver,负责与name为gpio-button-hotplug的platform总线 device匹配
源代码:./build_dir/linux-ralink_mt7620/gpio-button-hotplug/gpio-button-hotplug.c
<*> kmod-input-polldev........................... Polled Input device support
是input system的input_dev,采用采取轮询方式,不断通过input_gpio_button查询GPIO状态,然后发送input event。
源代码: ./build_dir/linux-ralink_mt7620/linux-3.3.8/drivers/input/input-polldev.c
<*> kmod-button-hotplug................................ Button Hotplug driver
button-hotplug是面向应用层接口的,把input_event转换成hotplug消息。这个主要是内核的hotplug机制(通过内核netlink技术广播对象消息,从而支持热插拔之类的)。OpenWRT用的是hotplug2,具体配置在/etc/hotplug.d下。如果要在应用层处理按键事件,就新建/etc/hotplug.d/button目录,写个测试脚本;
源代码:./build_dir/linux-ralink_mt7620/button-hotplug/button-hotplug.c
源代码:
build_dir/linux-ralink_mt7620/linux-3.3.8/arch/mips/ralink/dev-gpio-buttons.c
build_dir/linux-ralink_mt7620/linux-3.3.8/arch/mips/ralink/boards/wr8305rt-board.c
上面dev-gpio-buttons.c是gpio button platform driver注册;boards/wr8305rt-board.c是特定的board板platform 总线的button device驱动
openwrt 实现hotplug-button