Raspberry Pi USB Input Device Data Monitor (Part 1)

USB Mouse/Keyboard Data Monitoring Using Raspberry Pi


I am working on getting the raw USB mouse or keyboard data using raspberry pi.
To start with, I just decided to grab the data from the Logitech K400R wireless keyboard that I use for my raspberry pi.
This keyboard has the touchpad and size is good, not too small, not too large, and price is very reasonable. 

Logitech Wireless Touch Keyboard K400 with Built-In Multi-Touch Touchpad



Setup
Install pip:



$ sudo apt-get install python-pip python-dev build-essential 
$ sudo pip install --upgrade pip 
$ sudo pip install --upgrade virtualenv 
Install evdev module:

$ sudo pip install evdev
Check input events:

$ ls /dev/input
If you do not know which event is mouse or keyboard, follow this.
Install input-utils:

$ sudo apt-get install input-utils
$ lsinput



Python Code

This is the python example code.
Example 1:
from evdev import InputDevice, categorize, ecodes
dev = InputDevice('/dev/input/event0')
print(dev)
for event in dev.read_loop():
             print(event)
Example 2:
from evdev import InputDevice, categorize, ecodes
dev = InputDevice('/dev/input/event0')
print(dev)
for event in dev.read_loop():
             if event.type == ecodes.EV_KEY:
                        print(event)
Crate a python script file as below and copy&paste the above code.
nano test.py
Run the python script.
python test.py
Press any buttons on the keyboard or mouse and you will see the outputs in the terminal.
Done!



                  

[AKM Chip Booster] Audio ADC AK5704 PCB Design

Designing a PCB prototype with AK5704 is not so difficult and I show an example with my design. People who are not familiar with AK5704,...