public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* uinput question
@ 2008-04-20 23:32 Yan Seiner
  2008-04-25 18:26 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Yan Seiner @ 2008-04-20 23:32 UTC (permalink / raw)
  To: LKML

I'm trying to set up a system with multiple IR remotes acting as 
keyboards for specific X sessions.

lirc <http://www.lirc.org> is a way to send infrared remote keystrokes 
to applications.  Some time ago I wrote a small patch to kbdd 
<http://handhelds.org/moin/moin.cgi/kbdd> that lets me inject button 
pushes on an IR remote into the /dev/input/uinput system as keyboard 
events.

Now I'd like to send those keyboard events to only one X session, not 
all of them.

In the kbdd code, there is the following snippet when the 
/dev/input/uinput device is opened:

        memset(&dev, 0, sizeof(dev));
        strncpy(dev.name, "SerKBD", UINPUT_MAX_NAME_SIZE);
        dev.idbus = BUS_RS232;
        dev.idvendor = 0x00;
        dev.idproduct = 0x00;
        dev.idversion = 0x00;

So this would indicate to me that I can emulate different devices by 
changing the names, IDs, and events.  Then I want to select only those 
events that pertain to my app... 

So...
-   Create a 'virtual' eventNN device based on the data fed to kbdd
-   Send various keyboard events to the kernel via the uinput device 
from several physical devices
-   Select only those events destined for my virtual device
-   Have those events pop out of my eventNN device so I can handle them 
back in userspace

How do I do that?  Where can I find some information on how to handle 
uinput devices?

Thanks,

--Yan


-- 
  o__
  ,>/'_          o__
  (_)\(_)        ,>/'_        o__
Yan Seiner      (_)\(_)       ,>/'_     o__
Certified Personal Trainer   (_)\(_)    ,>/'_        o__
Licensed Professional Engineer         (_)\(_)       ,>/'_
Who says engineers have to be pencil necked geeks?  (_)\(_)

Help out my kids' school: http://www.seiner.com/blog/Travels/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: uinput question
  2008-04-20 23:32 uinput question Yan Seiner
@ 2008-04-25 18:26 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2008-04-25 18:26 UTC (permalink / raw)
  To: Yan Seiner; +Cc: LKML

Hi Yan,

On Sun, Apr 20, 2008 at 04:32:36PM -0700, Yan Seiner wrote:
> I'm trying to set up a system with multiple IR remotes acting as keyboards 
> for specific X sessions.
>
> lirc <http://www.lirc.org> is a way to send infrared remote keystrokes to 
> applications.  Some time ago I wrote a small patch to kbdd 
> <http://handhelds.org/moin/moin.cgi/kbdd> that lets me inject button pushes 
> on an IR remote into the /dev/input/uinput system as keyboard events.
>
> Now I'd like to send those keyboard events to only one X session, not all 
> of them.
>
> In the kbdd code, there is the following snippet when the /dev/input/uinput 
> device is opened:
>
>        memset(&dev, 0, sizeof(dev));
>        strncpy(dev.name, "SerKBD", UINPUT_MAX_NAME_SIZE);
>        dev.idbus = BUS_RS232;
>        dev.idvendor = 0x00;
>        dev.idproduct = 0x00;
>        dev.idversion = 0x00;
>
> So this would indicate to me that I can emulate different devices by 
> changing the names, IDs, and events.  Then I want to select only those 
> events that pertain to my app... 
> So...
> -   Create a 'virtual' eventNN device based on the data fed to kbdd
> -   Send various keyboard events to the kernel via the uinput device from 
> several physical devices
> -   Select only those events destined for my virtual device
> -   Have those events pop out of my eventNN device so I can handle them 
> back in userspace
>

You would need to set up uinput instance for every set of remotes you
want to send events to a particular X instance and then make X use
evdev driver to listen to the input events coming from 'their'
/dev/input/eventXX. You may need to teach X not to release event
device when switching vts so events from the uinput-connected devices
never reach the standard consolde driver.

Hope this helps.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-25 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-20 23:32 uinput question Yan Seiner
2008-04-25 18:26 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox