ramccor / logkeys

Automatically exported from code.google.com/p/logkeys
Other
0 stars 0 forks source link

No log file, 100% CPU usage on x86_64 #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile and install program
2. Run program like 'logkeys -s -o logfile -d /dev/input/event9'
3.

What is the expected output? What do you see instead?
Expected is that there would be an output log file. I don't see any log
file being created. There's also 100% CPU usage.

What version of the product are you using? On what operating system?
0.1.0 on slackware64 13.0

Please provide any additional information below.

I am using a USB keyboard listed as:

I: Bus=0003 Vendor=045e Product=00b0 Version=0111
N: Name="Microsoft Microsoft® Digital Media Pro Keyboard"
P: Phys=usb-0000:00:1a.0-1/input0
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0/input/input9
U: Uniq=
H: Handlers=kbd event9 
B: EV=120013
B: KEY=1000000000007 ff800000000007ff febeffdff3cfffff fffffffffffffffe
B: MSC=10
B: LED=107

I: Bus=0003 Vendor=045e Product=00b0 Version=0111
N: Name="Microsoft Microsoft® Digital Media Pro Keyboard"
P: Phys=usb-0000:00:1a.0-1/input1
S: Sysfs=/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.1/input/input10
U: Uniq=
H: Handlers=kbd event10 js0 
B: EV=10001f
B: KEY=837fff002c3027 bf00444400000000 c00000000000001 10f848a27c007
ffff7bfad941dfff febeffdfffefffff fffffffffffffffe
B: REL=40
B: ABS=ffffff01000701ff
B: MSC=10

I know another keylogger works with event9, so this one should too, it also
does not work with event10.

Not sure if this will help, but here's the gdb output:
bash-3.1# gdb -args logkeys -s -o logfile -d /dev/input/event9
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-slackware-linux"...
(gdb) start
Breakpoint 1 at 0x401f20
Starting program: /home/demonslayer/tmp/logkeys-0.1.0/src/logkeys -s -o
logfile -d /dev/input/event9
0x0000000000401f20 in main ()
Current language:  auto; currently asm
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x0000000000402e00 in main ()

I had to quit it because it was stuck with Ctrl-C.

I suspect that it may be a problem with USB keyboards ?

Original issue reported on code.google.com by draconis...@gmail.com on 11 Jan 2010 at 6:51

GoogleCodeExporter commented 9 years ago
As far as I see, all loops before first print and flush are finite loops, so I 
have
absolutely no idea why it hangs.

logkeys has been reported working (!) with a USB keyboard, and regardless I 
don't see
how that would play any role here.

If anyone can confirm or shed any light on this matter, please do. :)

Or else I'll just have to try it on slackware myself...

Original comment by kernc...@gmail.com on 18 Jan 2010 at 12:16

GoogleCodeExporter commented 9 years ago
I am seeing the exact same behavior with an Ubuntu 9.10 64-bit system (dual 
core), not 
using a USB keyboard:

Linux 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 02:39:34 UTC 2010 x86_64 
GNU/Linux

Could the problem be 64-bit related?  Let me know if there is anything I can 
test or 
provide more info.

Original comment by unspecif...@gmail.com on 22 Feb 2010 at 1:47

GoogleCodeExporter commented 9 years ago
I was able to fix this on my system with the following changes:

(1) 
dumpkeys -n | grep '^\\([[:space:]]sh    
ift[[:space:]]\\)*\\([[:space:]]altgr[[:space:]]\\)*keycode'

was not returning anything on my system.  Reverting to the 'old' dumpkeys 
command 
string referenced in the comment in the code worked.

(2) the while loop following line.find just a few lines down from the dump was 
looping forever.  Changing the cast on index to be (std::string::size_type) 
resolved 
this for me.

With these 2 changes this seems to be working for me.

Original comment by unspecif...@gmail.com on 23 Feb 2010 at 2:19

GoogleCodeExporter commented 9 years ago
Regarding (1), could you please run

sudo dumpkeys -n | grep
'^\([[:space:]]shift[[:space:]]\)*\([[:space:]]altgr[[:space:]]\)*keycode'

command in your terminal. (The double backslash in code produces a single 
backslash
when executed.) Is there any output? I suppose there must be, otherwise program 
would
never reach (2).

Thanks for your valuable effort! :)

Original comment by kernc...@gmail.com on 23 Feb 2010 at 12:33

GoogleCodeExporter commented 9 years ago
Yes, you are correct, the dumpkeys command does in fact return information.  I 
must 
have originally done something wrong in testing.  It is working fine for me 
with just 
the size_type cast for index.  I think it was probably fine for 32 bit but 
broken on 
64:

user@host:~/src/logkeys-0.1.0/src$ diff -u logkeys.cc.org logkeys.cc
--- logkeys.cc.org  2010-02-23 23:39:32.000000000 -0500
+++ logkeys.cc  2010-02-23 23:42:17.000000000 -0500
@@ -305,7 +305,7 @@

       // replace any U+#### with 0x#### for easier parsing
       index = line.find("U+", 0);
-      while ((unsigned int) index != std::string::npos) {
+      while ((std::string::size_type) index != std::string::npos) {
         line[index] = '0'; line[index + 1] = 'x';
         index = line.find("U+", index);
       }

Original comment by unspecif...@gmail.com on 24 Feb 2010 at 4:48

GoogleCodeExporter commented 9 years ago
The issue is confirmed fixed thanks to unspecified.user.account (interesting 
name
there, btw).
Fix committed as r25.

Original comment by kernc...@gmail.com on 25 Feb 2010 at 4:07

GoogleCodeExporter commented 9 years ago

Original comment by kernc...@gmail.com on 25 Feb 2010 at 4:09

GoogleCodeExporter commented 9 years ago
Issue 20 has been merged into this issue.

Original comment by kernc...@gmail.com on 7 May 2010 at 9:15