1

I'm doing some edits to an input device driver in an android kernel.

This device has a limited range of keybits and evbits enabled. What I want to do is to create a new /dev/input event node that is not related to any physical device, with more keybits and evbits enabled, so that I can send real input signals from the physical driver to the userspace, in the userspace I listen to them and when received I can inject input events to the "virtual" driver writing to its event node.

Does linux/android kernel offer such option? Which path should I follow? Is there any alternative to this?

As a second option, can I create two input nodes in the same driver and send input_reports only to the "physical" node?

Vektor88
  • 4,841
  • 11
  • 59
  • 111
  • Not sure I understand. If the physical driver doesn't support some keybits, how do you plan to receive unsupported keys in the userspace? – msh May 20 '13 at 16:02
  • @msh I basically need two devices, one bound to a real device with a limited set of keybits available: I'd send them from kernel space to user space with input_report_key. The second "virtual" device should be not bound to any real device and should have a wider range of keybits available, then in user-space I'd like to listen for key inputs from real device and inject, writing data to the input event node, to the virtual device. – Vektor88 May 21 '13 at 13:32

2 Answers2

1

I see two alternatives:

  1. Create virtual input device - you can write your own driver or use uinput

  2. Bypass low-level input susbsystem and inject key events at the Android framework level

Community
  • 1
  • 1
msh
  • 2,700
  • 1
  • 17
  • 23
  • I think that `uinput` or a customized driver could be what I need. Can you provide some guide/article or any directions? I don't know this much the kernel structure. Moreover, even if it's not specified the input events should have the less lag possible, is uinput reliable considering this new condition? – Vektor88 May 22 '13 at 09:26
  • People asking about uinput are probably working in c/c++. Alternative 2 above is Java and may not be pertinent to many looking at this. – Chef Pharaoh Oct 24 '16 at 18:58
0

the linux has a builtin virtual keyboard mouse driver named uinput, if your android device has /dev/uinput ,that means you could talk to /dev/uinput to simulate mouse and keyboard https://www.kernel.org/doc/html/v4.12/input/uinput.html

bowman han
  • 1,097
  • 15
  • 25