Link to home
Start Free TrialLog in
Avatar of saini_er
saini_er

asked on

How can I pipe xevent viewer (xev) output to file completely?

I am using xev to note down all pressed key events but unfortunately after pipeline output to file , I always found last few presses keys missing...

I am using like

xev -id 0x3200020 >testout

I typed sentence --> full sentence
here in xev output last two alphabet 'c' and 'e' are missing from pipeline
xev-output
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

You mean send the output to a file?

xev > file

Hi,
this seems to be a consequence of stdout buffering.
As I believe, the only solution is to wait for the timeout or to stop xev gracefully.
 
wmp
SOLUTION
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of saini_er
saini_er

ASKER

I am using xev as integration im my code..I am already opening child process for that .I can't open new window with screen
Hi,

so, in your child process, do you see a chance to terminate xev gracefully in certain intervals (and then start it anew) to give its stdout the chance to get fflushed?

wmp

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Basically , I am using perl program to execute xev for particular terminal window and then I am using `killall -9 xev` to terminate program..My perl program is interactive program which requires user input and  I am integrating xev to  capture all user activity on keyboard.....So I am looking for some good procedure which can flush the buffer of xev before it terminated the program  
Hi folks
I would like to thank everyone for thier suggestion.Finally I came up with couple  of ideas to resolve this problem for which I need your input

OPTION1-> Is there any way that I can execute 'Returnk key' escape sequence from perl program. If We can execute retun key from perl program , then I can have changes in my code to ignore last return key.

OPTION2-> Is there any switch cases available in Perl like c where I can ask user to press return key to exit program


The problem is that you terminate it with 'kill -9' which leaves no chance to xev to flush its buffer!

No I have tested this already..basically If I press two return key in the end of program with sleep(3) , it clears the buffer and I am getting my all keys.

I just want some procedure using escape sequences that my program with press return key two times
I am using killall xev and not the forceful -9 option.sorry for confusion
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial