Actions

Difference between revisions of "Raspberry Pi Pikeyd165 keylogging"

From falz.net

 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
I ran in to a few issues where ghost button presses were happing on my [[Neo Geo Arcade Cabinet]] so resorted to debugging with a the [https://github.com/kernc/logkeys logkeys] keylogger. Here's how to install it on a Rapsberry pi and debug the pikeyd165 driver:
+
[[Category:Video Games]]
 +
 
 +
I ran in to a few issues where ghost button presses were happing on my [[Neo Geo Arcade Cabinet]] so resorted to debugging with a the [https://github.com/kernc/logkeys logkeys] keylogger. Here's how to install it on a Rapsberry pi and debug the pikeyd165 driver (binary can be found in [http://strike-devices.net/index.php/download/ the Retropie or Regamebox packages] for [http://strike-devices.net/index.php/pi2jamma/ pi2jamma]):
  
  
Line 18: Line 20:
  
  
Now you must determine which input device pikeyd165 is showing up as, this will depend on if you have a keyboard and some other things. Look at the file '''/proc/bus/input/devices''' to find yours. Mine is '''event4''' below on the Handlers line:
+
Now you must determine which input device pikeyd165 is showing up as, this will depend on if you have a keyboard and some other things. Look at the file '''/proc/bus/input/devices''' and find the event handler named "uinput-sample". Mine is '''event4''':
 
  less /proc/bus/input/devices
 
  less /proc/bus/input/devices
 +
 
  <snip removed the real keyboard stuff>
 
  <snip removed the real keyboard stuff>
 +
 
  I: Bus=0003 Vendor=0001 Product=0001 Version=0001
 
  I: Bus=0003 Vendor=0001 Product=0001 Version=0001
 
  N: Name="uinput-sample"
 
  N: Name="uinput-sample"
Line 33: Line 37:
  
  
I put this in the pi user's .bashrc to start on boot. modify event4 to whatever yours is:
+
SSH in to the pi and start logkeys. Be sure to modify '''event4''' to whatever yours is:
 
  sudo logkeys --start --device /dev/input/event4 --output /var/log/logkeys.log
 
  sudo logkeys --start --device /dev/input/event4 --output /var/log/logkeys.log
  
  
  
All output from pikeyd165 should now be logged to '''/var/log/logkeys.log'''. In my case it was registering all buttons mapped in pikeyd165.conf. Note that a few seem odd due to the shift key being virtually pressed. ! is 1, % is 5, ^ is 6.
+
All output from pikeyd165 should now be logged to '''/var/log/logkeys.log'''. Press some joystick directions to ensure it's logging. Launch a game and let it idle for a while.
 +
 
 +
 
 +
In my case it was sensing random ghost inputs of all buttons mapped in pikeyd165.conf. sometimes it took a few minutes,to sometime it took 15 minutes or so, it's random. Note that the log shows a few oddities due to the shift key being virtually pressed. ! is 1, " is 2, % is 5, ^ is 6.
  
 
  <F2><Esc> <LShft>ZXIKWQ<Left><Right><LCtrl><LAlt>SAGd%!<Up><Down>FR"^
 
  <F2><Esc> <LShft>ZXIKWQ<Left><Right><LCtrl><LAlt>SAGd%!<Up><Down>FR"^

Latest revision as of 09:38, 11 March 2018


I ran in to a few issues where ghost button presses were happing on my Neo Geo Arcade Cabinet so resorted to debugging with a the logkeys keylogger. Here's how to install it on a Rapsberry pi and debug the pikeyd165 driver (binary can be found in the Retropie or Regamebox packages for pi2jamma):


Install required packages to build logkeys. You may already have some of these installed:

sudo apt-get install autoconf automake libtool autotools-dev git


Download and compile logkeys. If the autogen.sh command gives an error I may have missed a package above.

git clone https://github.com/kernc/logkeys.git
cd logkeys
./autogen.sh
cd build
../configure
make
sudo make install


Now you must determine which input device pikeyd165 is showing up as, this will depend on if you have a keyboard and some other things. Look at the file /proc/bus/input/devices and find the event handler named "uinput-sample". Mine is event4:

less /proc/bus/input/devices

<snip removed the real keyboard stuff>

I: Bus=0003 Vendor=0001 Product=0001 Version=0001
N: Name="uinput-sample"
P: Phys=
S: Sysfs=/devices/virtual/input/input4
U: Uniq=
H: Handlers=sysrq kbd event4 rfkill 
B: PROP=0
B: EV=100003
B: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe


SSH in to the pi and start logkeys. Be sure to modify event4 to whatever yours is:

sudo logkeys --start --device /dev/input/event4 --output /var/log/logkeys.log


All output from pikeyd165 should now be logged to /var/log/logkeys.log. Press some joystick directions to ensure it's logging. Launch a game and let it idle for a while.


In my case it was sensing random ghost inputs of all buttons mapped in pikeyd165.conf. sometimes it took a few minutes,to sometime it took 15 minutes or so, it's random. Note that the log shows a few oddities due to the shift key being virtually pressed. ! is 1, " is 2, % is 5, ^ is 6.

<F2><Esc> <LShft>ZXIKWQ<Left><Right><LCtrl><LAlt>SAGd%!<Up><Down>FR"^


I'm currently working to determine what is actually causing this. It doesn't seem to happen while idling at the input menu, only while in a game. It happens in both Advmame as well as libretro FBA. Advmame sees the F2 and Escape and acts accordingly - escapes the game or goes to VTY2. Libretro seems to ignore everything, perhaps due to it being 24 characters at once.