How can I create a virtual HID device in code? I'm trying to avoid writing a kernel extension to accomplish this, but it seems to be the only way. I need to be able to create virtual HID devices of all types, and have an app running in the background feed them events. Is there a way to do this in user-space, or must I venture into kernel land?
Asked
Active
Viewed 1,747 times
1 Answers
2
The typical way of creating HID devices is to use the IOHID* classes in IOKit. You can write a userclient that passes events in and out.
I'm not sure what a "virtual" HID device is, however, I guess. If you want to create a keyboard on the screen, that sort of thing can probably be done in userspace.

WhirlWind
- 13,974
- 3
- 42
- 42
-
I mean an application that creates a HID device that doesn't really exist in the real world, but events can be passed to it over the network. – nonpolynomial237 May 24 '10 at 03:13
-
1If it's an actual device you want to create, you need to do it in the kernel. If you want to simulate some sort of input, you may be able to do it in userspace. – WhirlWind May 24 '10 at 15:07
-
Hey, computergeek6, did you get the virtual device working? I'm trying to do the same. do you have any code you're willing to share? thanks! – eyalw Aug 25 '11 at 20:47
-
I can imagine, that if we create a virtual HID, we'd be able to make it report in a particular way and that would make some tests easier (of course tests with a virtual device never replace tests with a real device). But it'd be awesome to have a way to create a virtual source of events, that one can test a program against. – Igor Apr 17 '23 at 08:22