سؤال

I'm trying to use an IR remote to pass certain key codes to Android. So far, I'm able to pass numeric keys (0-9) and D-pad keys (up, down, left, right, enter). Now I'm trying to extend the keys to include other characters like a-z.

The code that I'm modifying is an IR driver in the Linux kernel part of Android. It's similar to this driver. However, when I pass a value like KEY_A (maps "a" to 30: defined in Linux's include/linux/input.h), Android doesn't see it.

The section of code that passes the command up is the following:

        input_report_key(cir->input, cir->last_key, 1);
        input_report_key(cir->input, cir->last_key, 0);
        input_sync(cir->input);

When I print cir->last_key, I can see the value 30 when I press the "a" button. However, I'm not sure how to trace the code from here to Android to see where the button press is being dropped.

In Android, I have a file called /system/usr/keylayout/qwerty.kl that maps values, e.g. 30 maps to "a". The problem is Android never gets the value of 30 when I press "a".

هل كانت مفيدة؟

المحلول

The keybit field of this structure has to be set to include all the key codes being passed.

For example,

set_bit(KEY_A, input_dev->keybit);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top