Commit:     c01d50d181f074a60bf3ed54eb055ce1679afb98
Parent:     82eb121989c06e3de33b56ade1fa52c9e86c014e
Author:     Jiri Kosina <[EMAIL PROTECTED]>
AuthorDate: Mon Aug 20 12:13:34 2007 +0200
Committer:  Jiri Kosina <[EMAIL PROTECTED]>
CommitDate: Sun Oct 14 13:40:01 2007 +0200

    HID: Report usage codes of keys as EV_MSC scancode events
    Current HID layer does not report usage codes to the input layer. This 
    was previously removed, because it caused unnecessary storm of events in 
    of positioning devices, etc.
    This patch adds reporting of usage codes as EV_MSC events only for key 
    We issue the EV_MSC event only if the state of the key corresponding to the
    given code has changed, so that we don't report usages that are sent in 
    report even if the state hasn't changed (for example Shift/Caps Lock/...
    states as sent by various keyboards).
    This functionality is required at least by KeyTouch in order to provide
    convenient means for remapping the usage codes.
    Cc: Marvin Raaijmakers <[EMAIL PROTECTED]>
    Signed-off-by: Jiri Kosina <[EMAIL PROTECTED]>
 drivers/hid/hid-input.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index f80b571..36be431 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -921,6 +921,11 @@ static void hidinput_configure_usage(struct hid_input 
*hidinput, struct hid_fiel
                set_bit(KEY_VOLUMEDOWN, input->keybit);
+       if (usage->type == EV_KEY) {
+               set_bit(EV_MSC, input->evbit);
+               set_bit(MSC_SCAN, input->mscbit);
+       }
        hid_resolv_event(usage->type, usage->code);
@@ -1043,6 +1048,9 @@ void hidinput_hid_event(struct hid_device *hid, struct 
hid_field *field, struct
                        input_event(input, usage->type, last_key, 0);
+       /* report the usage code as scancode if the key status has changed */
+       if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != 
+               input_event(input, EV_MSC, MSC_SCAN, usage->hid);
        input_event(input, usage->type, usage->code, value);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to