Re: [Ilugc] Re: How to trap key strokes

2010-02-12 Thread Saravanan S
On Sat, Jan 9, 2010 at 12:35 PM, Vijay Kumar wrote:

 Saravanan S dearsarava...@... writes:
  Hi all,
  I used xmodmap to block few key strokes in my distro.
  How to initiate/trigger a key combination like say (Ctrl+Shift+Y) as if
 the
  user has pressed those keys??

 Keystrokes can be fed to the kernel using the uinput subsystem. The uinput
 subsystem can be accessed through the device file /dev/uinput. But the
 interface
 is low-level. A wrapper library called libsuinput
 http://codegrove.org/libsuinput/ makes things simpler. The code using the
 wrapper library is given below. For the sake of simplicity error handling
 code
 has been omitted.

 #include suinput.h

 int main(void)
 {
  struct input_id id = {BUS_BLUETOOTH, 13, 3, 7};
  int uinput_fd = suinput_open(HelloInput, id);

  suinput_press(uinput_fd, KEY_LEFTCTRL);
  suinput_press(uinput_fd, KEY_LEFTSHIFT);
  suinput_press(uinput_fd, KEY_Y);

  suinput_release(uinput_fd, KEY_Y);
  suinput_release(uinput_fd, KEY_LEFTSHIFT);
  suinput_release(uinput_fd, KEY_LEFTCTRL);

  return 0;
 }

 Note: You should have uinput module loaded into the kernel. You should have
 sufficient privileges to access the device file.


I could not install libsuinput.
Is there any other way to just trigger a single/a combination of key
stroke(s)???


Saravanan Sundaramoorthy
Red Hat Certified Engineer
+91 99404 32545
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


Re: [Ilugc] Re: How to trap key strokes

2010-01-10 Thread Saravanan S
Good info Mr. Vijay, but is there any way to understand this better.???


Saravanan Sundaramoorthy
Red Hat Certified Engineer
+91 99404 32545
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


Re: [Ilugc] Re: How to trap key strokes

2010-01-09 Thread Satish Eerpini
I had sometime ago tried writing a simple program to emulate mouse
clicks based on the code given here :

www.einfochips.com/download/dash_jan_tip.pdf

but even after running the program, nothing happens, as in I don see
the mouse clicks emualted. What might I be missing here ??


Satish
-- 
http://satish.playdrupal.com
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc


Re: [Ilugc] Re: How to trap key strokes

2010-01-09 Thread Satish Eerpini
 I had sometime ago tried writing a simple program to emulate mouse
 clicks based on the code given here :

 www.einfochips.com/download/dash_jan_tip.pdf

the code given at the above link seems to use the uinput API directly
and not the libsuinput.

 but even after running the program, nothing happens, as in I don see
 the mouse clicks emualted. What might I be missing here ??

and I had to change the input device from /dev/uinput to
/dev/input/uinput. And ran the program as root.

 Satish
-- 
http://satish.playdrupal.com
___
ILUGC Mailing List:
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc