I'm developing an application in rust, which uses vigem-client, my idea is to deactivate the keyboard completely and pass its inputs to an xbox virtual controller, what can I use to intercept the keys pressed on the keyboard and prevent them from being processed in the applications, I want that when the controller is active, it should completely deactivate the keyboard.
A kernel mode driver, maybe? [1]
User mode software is usually not allowed to take exclusive access over HIDs. Other software might expect to receive keyboard input when its window has focus.
It's hard to overstate how many problems you are going to experience by trying this. If you only have one keyboard attached to the system and install a driver to give one piece of software exclusive access, you won't be able to use the keyboard for anything else until the driver is removed. It's also wildly unsafe and will crash your system if you make any little mistake. I don't think this is a reasonable idea. ↩︎
You can just grab it, but I would strongly recommend against grabbing you main keyboard.
This prevents other clients (including kernel-internal ones such as rfkill) from receiving events from this device. This is generally a bad idea. Don’t do this.