Article / 22nd Jan 2009

The Panic Button

Today I took delivery of one USB Panic Button; I've been wanting one of these for a very long time, and so I'm pleased to finally have one. I don't necessarily have a need to panic a lot, but there's a lot of times a big red button is just so satisfying (launch events, test runs, and so on).

Unfortunately, it comes with a Windows driver CD and the only Linux script I could find was a Perl script. Since I'm not the greatest fan of Perl, and I wanted to try some USB code, I've made my own driver for them.

You can download it here; just edit the COMMAND = line at the top of the script to change what it runs. Alternatively, you can import the file for use as a module; just make a new instance of PanicButton and call .pressed() to see if it was pressed recently (yes, you have to poll it).

Also note it has to be run as root, to prise off the kernel's HID module.

Finally, here's one more picture of it in situ.