Raspi Shutdown Key

Noel (@noelportugal) is a clever dude. He’s also passionate. If you’ve ever met him, you already know these things.

Although I haven’t yet jumped into Raspberry Pi, despite Noel’s unbridled passion about the little-computer-that-could, I have captured some metadata about it, just from being around him and his passion.

For example, I know the Raspi needs to be shutdown a certain way, or bad things happen. I recall Noel being very specific about this at the Raspi hackday he ran in January.

Since he created a Maker Faire DIY activity based around Raspi and Embedded Java, Noel needed an easy and standardized way to shutdown his Raspis without the benefit of any standard peripherals, no keyboard, no mouse, no monitor.

So, he made a key because of course he made a key. Duh.

IMG_20140516_125213

One of Noel’s Raspis and the shutdown key

I saw the guys use this key a few times during Maker Week, and I’m not entirely sure what’s on it, e.g. scripts or magic bits, but it certainly made shutting down more than a dozen of Raspis a breeze.

I hope he’ll share the magic, fingers crossed.

Update: Noel shared the secret sauce in comments, and I’ll add it here for post-completeness.

So here is the secret sauce:

#Get Device Id and Vendor Id from USB Wifi adaptor.
$ lsusb

Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

#Create a new udev rule
$ sudo vi /etc/udev/rules.d/10-local.rules


ACTION==”remove”, ENV{ID_VENDOR_ID}==”0bda”, ENV{ID_MODEL_ID}==”8176″, RUN+=”/sbin/shutdown -h now”


$ sudo udevadm control –reload-rules

If you want to make a shutdown key make sure you use a USB drive and not a USB wifi/bluetooth dongle. Hot-plugging a powered device will cause the raspberry pi (model b) to restart.

AboutJake

a.k.a.:jkuramot

One comment

  1. So here is the secret sauce:

    #Get Device Id and Vendor Id from USB Wifi adaptor.
    $ lsusb

    Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

    #Create a new udev rule
    $ sudo vi /etc/udev/rules.d/10-local.rules

    ACTION==”remove”, ENV{ID_VENDOR_ID}==”0bda”, ENV{ID_MODEL_ID}==”8176″, RUN+=”/sbin/shutdown -h now”

    $ sudo udevadm control –reload-rules

    If you want to make a shutdown key make sure you use a USB drive and not a USB wifi/bluetooth dongle. Hot-plugging a powered device will cause the raspberry pi (model b) to restart.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.