[SOLVED] USB mouse, keyboard assigning to process not desktop, how to?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
USB mouse, keyboard assigning to process not desktop, how to?
Hi group,
I need to assign my USB devices ( mouse and keyboard ) to a special program.
Currently, when these devices are plugged in they are assigned to the desktop. I wish to mimic the actions of Qemu. My program will capture
the actions of the devices and preform special programmed actions.
I don't understand how what you want to do is different than a simple window capture.
I do not understand what you mean by "simple window capture'?
Let us use a laptop as an example, you have the mouse pad and keyboard as input to the desktop. Now you attach a USB mouse or keyboard. Normally these new devices are added to the desktop as input devices. I want to be able to use these new devices as input to a program, the program will read the input of the USB HID devices and redirect them to another process.
I do not understand what you mean by "simple window capture'?
Let us use a laptop as an example, you have the mouse pad and keyboard as input to the desktop. Now you attach a USB mouse or keyboard. Normally these new devices are added to the desktop as input devices. I want to be able to use these new devices as input to a program, the program will read the input of the USB HID devices and redirect them to another process.
I believe this will require 2 steps:
Remove the USB devices from Xorg.
Attach the HID devices to a program.
Does that make thing clearer?
You will need to go through X.org (if that's the display server on your distro) for that. The focuses of both the keyboard and mouse should be on the new program as soon as you click on its window.
Can you elaborate?
If you need lower level access to input devices, you will need to go into the source code and program it in yourself. I'm not certain it's possible to bypass X even then. Maybe read directly from /dev/hid-foo? At any rate, probably out of the scope of this section of the forums.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.