The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-04-2009
chebarbudo's Avatar
chebarbudo chebarbudo is offline
Registered User
  
 

Join Date: Nov 2008
Location: various
Posts: 188
Question Detect USB keyboard and other peripherals

Hi there,

I have a Debian machine without any peripherals (no screen, no keyboard, etc.). I'd like to be able to detect and log when someone plugs a USB keyboard. Something like : 2009-07-04 12:21 warning: keyboard pluged!
Is that possible?

I see two ways :
1. Either actively react to the connection of a device and execute a script that logs the alert.
2. Or cron a script that checks for USB devices every 5 minutes.
I have no idea how to do either ways.
Can anyone help me on that?

I would be glad to just be able to alert when any USB device is plugged. No matter if it's a keyboard or a flash key. But if I can make the difference between each device type... Better!


Thanks for your help
Santiago