LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2010, 04:33 AM   #1
sohumsin
LQ Newbie
 
Registered: Feb 2010
Posts: 9

Rep: Reputation: 0
Unhappy Slow reponse >xev | grep keyPress


Hi,

I tried this command xev, no problem.

But I try to pipe >xev | grep KeyPress, there is no response until I had press and release 7 keys then all the 7 results appear together.

Is there any setting I can make it appear every key press.

This command run in bash shell of Redhat Enterprise 5.4
 
Old 05-10-2010, 05:08 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
This might do more what you want: xev 2>&1 1>&2 | grep KeyPress. My thinking is that what you are seeing is caused by stdout buffering and my hope is that this format of the command passes stdout through stderr so should not buffer. Testing gave output a lot more frequently than every 7 lines.
 
Old 05-10-2010, 05:43 AM   #3
sohumsin
LQ Newbie
 
Registered: Feb 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Hi catkin,

You are right.

Is there any method to capture keypress without delay? Just wandering!!!
 
Old 05-10-2010, 06:07 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
You could try using grep's --line-buffered option.
 
Old 05-10-2010, 07:31 AM   #5
sohumsin
LQ Newbie
 
Registered: Feb 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Hi Catkin,

The result is the same, it depend stdout buffering.

Can we disable buffering?
 
Old 05-10-2010, 07:44 AM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by sohumsin View Post
The result is the same, it depend stdout buffering.

Can we disable buffering?
Given that grep's --line-buffered option didn't make any difference, we can assume that the phenomenon is caused by xev's output buffering. xev's man page shows no options to control output buffering. One possibility is to modify the xev source code and rebuild it. Another possibility, given that xev writes to the terminal very quickly (unbuffered or line-buffered?) would be to intercept terminal writes and filter them as required. I don't know how to do that. Might be worth researching the "screen" and "script" commands.
 
  


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
Not getting a reponse when pinging tractng Red Hat 10 08-22-2013 10:06 AM
apache2 slow reponse JJX Linux - Software 2 10-19-2007 12:45 AM
500 EOF instead of reponse status line in perl script Sherlock Programming 7 05-16-2007 07:52 AM
Keypress in X knobby67 Programming 3 04-15-2007 08:55 AM
the command 'grep' is so slow domeili Linux - Newbie 13 10-28-2003 09:16 AM


All times are GMT -5. The time now is 01:00 AM.

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