Making my ThinkPad LED flash 'decoded.legal' in morse code

I “wasted” my lunch break today.

Controlling your ThinkPad’s lid LED

This morning, Lennart Poettering posted a rather cool piece of information:

Did you know you could control brightness of the red dot on the i of the “ThinkPad” on the top-side of your thinkpad? I sure didn’t:

this turns it off:

echo 0 | tee /sys/class/leds/tpacpi\:\:lid_logo_dot/brightness

and this turns it on:

echo 255 | tee /sys/class/leds/tpacpi\:\:lid_logo_dot/brightness

I don’t really know what this information is good for, but hey, isn’t it awesome to have a 1px display on the outside of your laptop?

Making it flash morse code

So here’s a horrible but functional bash script for making mine flash “decoded.legal” in morse code:

#!/bin/bash

#-.. . -.-. --- -.. . -.. .-.-.- .-.. . --. .- .-..

function turnoff {
echo 0 | sudo tee /sys/class/leds/tpacpi\:\:lid_logo_dot/brightness
}

function turnon {
echo 255 | sudo tee /sys/class/leds/tpacpi\:\:lid_logo_dot/brightness
}

function dash {

turnon

sleep 1

turnoff

sleep 0.5

}

function dot {

turnon

sleep 0.5

turnoff

sleep 0.5

}

function pause {

turnoff

sleep 1

}

function d {

# -.. d

dash

dot

dot

pause



}


function e {
#. e

dot

pause

}

function c {
#-.-. c

dash

dot

dash

dot

pause

}

function o {
#--- o

dash

dash

dash

pause

}

function period {
#.-.-.- .

dot

dash

dot

dash

dot

dash

pause

}

function l {
#.-.. l

dot

dash

dot

dot

pause

}

function g {
#--. g

dash

dash

dot

pause
}

function a {
#.- a

dot

dash

pause
}

while true; do

d
e
c
o
d
e
d
period
l
e
g
a
l

done

Why? Sod knows.