[libhid-discuss] Linux: the device is opened exclusively

Charles Lepple clepple at ghz.cc
Thu Jan 8 13:18:50 UTC 2009


On Jan 8, 2009, at 4:05 AM, Lux Vampere wrote:

> Another way to solve my problem would be to catch the data in the  
> driver, and then broadcast it to the system programmatically. Does  
> this make sense and could there be side effects (like the keys  
> being fired several times in some situations, where the device is  
> not opened exclusively for some reason)? Can this be easily  
> achieved on Linux? Typically, I'll have a key event in the form of  
> an 8 bytes buffer, coming from the USB wire, that I'd like to fire  
> as a system wide key event...

This is all pure speculation, since I haven't done much with  
generating events, but if you open the device exclusively, then you  
shouldn't have to worry about multiple copies of a given event.

(Also, I usually refer to opening the *device* exclusively, where  
libhid is really opening an *interface* exclusively. If your device  
only has one interface, this may be a moot point.)

I don't know if the Linux input subsystem supports injecting events  
from user space, though. Maybe there are some keyboard macro programs  
out there that would have examples on how to do that? If you limit  
your scope to X11 applications, I am pretty sure that it is possible  
to generate fake X key events.

-- 
Charles Lepple



More information about the libhid-discuss mailing list