Input notifier support
Subsystems (2)
PATCH 1/1 Input notifier support
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
Thank you,
Kyungmin Park
---
drivers/input/Makefile +1 -1
@@ -5,7 +5,7 @@ # Each configuration option enables a list of files. obj-$(CONFIG_INPUT) += input-core.o -input-core-objs := input.o input-compat.o ff-core.o +input-core-objs := input.o input-compat.o ff-core.o input_notify.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
drivers/input/input.c +2 -0
@@ -274,6 +274,8 @@ void input_event(struct input_dev *dev,add_input_randomness (type, code, value);input_handle_event (dev, type, code, value);spin_unlock_irqrestore (&dev->event_lock, flags); +if (type ==EV_KEY ) +input_notifier_call_chain (value, &code); } }EXPORT_SYMBOL (input_event);
drivers/input/input_notify.c new file +43 -0
43 lines not on this page · raw message
include/linux/input.h +4 -0
@@ -1325,6 +1325,10 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int minint input_get_keycode (struct input_dev *dev,int scancode,int *keycode);int input_set_keycode (struct input_dev *dev,int scancode,int keycode); +extern int input_register_client (struct notifier_block *nb); +extern int input_unregister_client (struct notifier_block *nb); +extern int input_notifier_call_chain (unsigned long val,void *v); +extern struct class input_class;/**
Hi Kyungmin,
Quoted 2 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
I am not able to understand this.
Quoted 2 lines
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
If it is just LED, then you may write some led-input-trigger?
Quoted 2 lines
Any commnets are welcome.
Could you please show example driver too, in-order to explain its usage. Thanks.
Signature · 3 lines
---Trilok Soni http://triloksoni.wordpress.com http://www.linkedin.com/in/triloksoni
Hi,
Quoted 7 lines · Trilok Soni
Hi Kyungmin,
Quoted 2 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
I am not able to understand this.
it's simple there's one led and it's for key input. so when there's key input, it's blink. that's all
Quoted 5 lines
Quoted 3 lines
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
If it is just LED, then you may write some led-input-trigger?
Please see the LED key input trigger patch.
Thank you,
Kyungmin Park
Hi Kyungmin,
drivers/input/input.c void input_event(struct input_dev *dev, · line 278
Quoted 10 lines
drivers/input/input.c +2
-0@@ -274,6 +274,8 @@ void input_event(struct input_dev *dev, add_input_randomness(type, code, value); input_handle_event(dev, type, code, value); spin_unlock_irqrestore(&dev->event_lock, flags); + if (type == EV_KEY) + input_notifier_call_chain(value, &code);
This check will be done for every input_report_xxx calls, even for touchscreen events (in which case of course it will fail), and I don't think this is optimal solution. Users should be given an option to disable this if they don't need this notification mechanism.
How about moving this to input_report_key?
Signature · 7 lines
---Trilok Soni http://triloksoni.wordpress.com http://www.linkedin.com/in/triloksoni -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi,
Quoted 18 lines · Trilok Soni
Hi Kyungmin,
drivers/input/input.c void input_event(struct input_dev *dev, · line 278
Quoted 10 lines
drivers/input/input.c +2
-0@@ -274,6 +274,8 @@ void input_event(struct input_dev *dev, add_input_randomness(type, code, value); input_handle_event(dev, type, code, value); spin_unlock_irqrestore(&dev->event_lock, flags); + if (type == EV_KEY) + input_notifier_call_chain(value, &code);This check will be done for every
input_report_xxxcalls, even for touchscreen events (in which case of course it will fail), and I don't think this is optimal solution. Users should be given an option to disable this if they don't need this notification mechanism.
Quoted 1 line
How about moving this to
input_report_key?
Good, Thank you for point it. I will move it to input_report_key.
Thank you,
Kyungmin Park
Hi Kyungmin,
Quoted 21 lines · Kyungmin Park
Hi,
Quoted 18 lines · Trilok Soni
Hi Kyungmin,
drivers/input/input.c void input_event(struct input_dev *dev, · line 278
Quoted 10 lines
drivers/input/input.c +2
-0@@ -274,6 +274,8 @@ void input_event(struct input_dev *dev, add_input_randomness(type, code, value); input_handle_event(dev, type, code, value); spin_unlock_irqrestore(&dev->event_lock, flags); + if (type == EV_KEY) + input_notifier_call_chain(value, &code);This check will be done for every
input_report_xxxcalls, even for touchscreen events (in which case of course it will fail), and I don't think this is optimal solution. Users should be given an option to disable this if they don't need this notification mechanism.
Quoted 3 lines
Quoted 1 line
How about moving this to
input_report_key?Good, Thank you for point it. I will move it to
input_report_key.
As most of the other platforms may not need input_notify as standard in-built feature, it is better to add Kconfig symbol for this, so that it can be compiled out when not needed.
Signature · 7 lines
---Trilok Soni http://triloksoni.wordpress.com http://www.linkedin.com/in/triloksoni -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov
maintainerHi Kyungmin,
Quoted 9 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
I don't think we need to do the notifier route. It is very easy to add another input handler in style of rfkill-input or apm-power that would listen to events from all ungrabbed input devices and act accordingly. Your LED trigger example should work very well if implemented as another input handler.
Thanks.
Signature · 1 line
Dmitry
Quoted 6 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only.
Dmitry Torokhov
maintainerQuoted 7 lines · Andi Kleen
Quoted 5 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Quoted 7 lines
Quoted 1 line
Any commnets are welcome.
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
We already have good interface for that. That's why you want to limit access to /dev/input/eventX ;) and not make it world-readable.
Signature · 1 line
Dmitry
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Andi Kleen
Quoted 6 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
Quoted 9 lines
Quoted 5 lines
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
We already have good interface for that. That's why you want to limit access to
/dev/input/eventX;) and not make it world-readable.
Hi Dmitry,
Could you tell me know which interface you're talking? I agreed it's not good idea to pass key code value to drivers. it caused security issues.
Thank you,
Kyungmin Park
Dmitry Torokhov
maintainerQuoted 22 lines · Kyungmin Park
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Andi Kleen
Quoted 6 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
Quoted 9 lines
Quoted 5 lines
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
We already have good interface for that. That's why you want to limit access to
/dev/input/eventX;) and not make it world-readable.
Quoted 6 lines
Hi Dmitry,
Could you tell me know which interface you're talking? I agreed it's not good idea to pass key code value to drivers. it caused security issues.
The interface to steal the root password. One can simply open all input devices and read all events (if the process has sufficient rights).
Signature · 1 line
Dmitry
Hi,
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Kyungmin Park
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Andi Kleen
Quoted 6 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
Quoted 9 lines
Quoted 5 lines
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
We already have good interface for that. That's why you want to limit access to
/dev/input/eventX;) and not make it world-readable.Hi Dmitry,
Quoted 8 lines
Quoted 4 lines
Could you tell me know which interface you're talking? I agreed it's not good idea to pass key code value to drivers. it caused security issues.
The interface to steal the root password. One can simply open all input devices and read all events (if the process has sufficient rights).
"I don't think we need to do the notifier route. It is very easy to add another input handler in style of rfkill-input or apm-power that would listen to events from all ungrabbed input devices and act accordingly. Your LED trigger example should work very well if implemented as another input handler."
Ah, I mean the this one, sorry for confusing you. You mean add led trigger using input handler.
Then my question how to know which input device is connected trigger As know it's input device is allocated by dynamically then how do we know which input event is used and set?
Thank you,
Kyungmin Park
Dmitry Torokhov
maintainerQuoted 43 lines · Kyungmin Park
Hi,
Quoted 25 lines · Dmitry Torokhov
Quoted 24 lines · Kyungmin Park
Quoted 10 lines · Dmitry Torokhov
Quoted 9 lines · Andi Kleen
Quoted 6 lines · Kyungmin Park
Some hardware doesn't connected with key button and led. In this case key should be connected with led by software. Of course each application can control it however it's too big burden to application programmer.
So add input notifier and then use it at other frameworks such as led. Of course, other input device can use this one.
Any commnets are welcome.
Quoted 9 lines
Quoted 5 lines
It looks like the perfect interface for a password stealing root kit.
Yes there are probably other ways to do this, but still this seems to make it very easy.
We already have good interface for that. That's why you want to limit access to
/dev/input/eventX;) and not make it world-readable.Hi Dmitry,
Quoted 8 lines
Quoted 4 lines
Could you tell me know which interface you're talking? I agreed it's not good idea to pass key code value to drivers. it caused security issues.
The interface to steal the root password. One can simply open all input devices and read all events (if the process has sufficient rights).
"I don't think we need to do the notifier route. It is very easy to add another input handler in style of rfkill-input or apm-power that would listen to events from all ungrabbed input devices and act accordingly. Your LED trigger example should work very well if implemented as another input handler."
Quoted 6 lines
Ah, I mean the this one, sorry for confusing you. You mean add led trigger using input handler.
Then my question how to know which input device is connected trigger As know it's input device is allocated by dynamically then how do we know which input event is used and set?
Umm, I am sorry, you lost me. Could you rephrase your question please?
Signature · 1 line
Dmitry