LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2011, 09:02 AM   #1
hamedhsn
Member
 
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 57

Rep: Reputation: 0
how to add time of occurrence for mouse event in xinput


i need to have the time of occurence for mouse event in xinput,right now i run
Code:
xinput test <device_id> >log.txt
(for finding device_id using xinput list)
it will log mouse events to log.txt but i need the time that each event happens.this is the result that i can get but i need time as well:
Code:
motion a[0]=-1 a[1]=1
motion a[0]=-1
button press   1
button release 1
can anybody help me.
thanks.

Last edited by hamedhsn; 01-24-2011 at 09:32 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-24-2011, 12:20 PM   #2
z1p
Member
 
Registered: Jan 2011
Location: the right coast of the US
Distribution: Ubuntu 10.04
Posts: 80

Rep: Reputation: 23
Since this is the programming forum, I'm assuming that you aren't opposed to modifying the code for xinput. The code for the button press monitoring is in test.c, you can change the printf in the following section of code to include the time.

Code:
	} else if ((Event.type == button_press_type) ||
		   (Event.type == button_release_type)) {
	    int	loop;
	    XDeviceButtonEvent *button = (XDeviceButtonEvent *) &Event;

	    printf("button %s %d ", (Event.type == button_release_type) ? "release" : "press  ",
		   button->button);
 
2 members found this post helpful.
Old 01-24-2011, 12:57 PM   #3
hamedhsn
Member
 
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 57

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by z1p View Post
Since this is the programming forum, I'm assuming that you aren't opposed to modifying the code for xinput. The code for the button press monitoring is in test.c, you can change the printf in the following section of code to include the time.

Code:
	} else if ((Event.type == button_press_type) ||
		   (Event.type == button_release_type)) {
	    int	loop;
	    XDeviceButtonEvent *button = (XDeviceButtonEvent *) &Event;

	    printf("button %s %d ", (Event.type == button_release_type) ? "release" : "press  ",
		   button->button);
yes,i was exactly looking for changing the source.but
can you tell me where that code is(test.c)?path?
 
Old 01-24-2011, 09:43 PM   #4
z1p
Member
 
Registered: Jan 2011
Location: the right coast of the US
Distribution: Ubuntu 10.04
Posts: 80

Rep: Reputation: 23
xinput is one of the xorg apps and you can get the source various places. See http://cgit.freedesktop.org/xorg/app/xinput/ for one.
 
Old 01-25-2011, 04:31 AM   #5
hamedhsn
Member
 
Registered: Feb 2010
Distribution: opensuse 11.2
Posts: 57

Original Poster
Rep: Reputation: 0
thanks z1p.it was really cool.
awesome man.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add event listener to startx in linux hamedhsn Programming 0 09-30-2010 07:13 AM
add past event with googlecl to Google Calendar m4rtin Linux - Software 0 08-22-2010 06:41 PM
How to add event ABS_PRESSURE ?? webquinty Linux - Kernel 0 02-02-2009 04:31 AM
Mouse Event steve_linux Linux - Desktop 1 07-17-2008 11:33 AM
How to add event remiders in MyLQ? ctkroeker LQ Suggestions & Feedback 0 12-09-2005 02:11 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration