Defeating that Screensaver While Working at Home

Defeating the corporate screen lock while working at home is just one little Arduino away…

Corporate IT enforces an inactivity timeout and a password lock on my laptop. That’s fine and responsible if I’m out in the world, but it’s really stupid and irritating if I’m stuck working at home for weeks on end – such as right now. There’s no great threat to corporate security in my house. Worst case the cats walk over the keyboard at night and delete some stuff I don’t have in version control yet.

I’ve been fighting it for the last week by looking over periodically and whacking the trackpad when I see i try to go to sleep, but I realized if I could just emulate small, harmless mouse movements, I could do the same thing. I mean I am an embedded developer, after all. However, I have real work to do, so I didn’t want to spend a couple days hammering it out.

Arduino to the rescue!

The Arduino Leonardo and Pro Micro both use an atmega32u4, which has a built-in USB controller. There’s a handy “Mouse” library for Arduino that emulates a mouse. This project gave me the idea for using a Pro Micro and some large heat shrink. Originally I was just using a spare Leonardo, which wasn’t easy to keep from shorting out against random crap on my desk. However, I had a couple Pro Micros laying around from another project, and they fit just perfectly in a piece of 45mm heat shrink tubing.

I also wound up going with his two step mouse movement code pretty much as-is. I changed his wiggle time to 5 seconds, but otherwise it’s the same.

Here’s your sketch:

#include <Mouse.h>

void setup()
{
  Mouse.begin();
}

void loop()
{
  while(true) 
  { 
    delay(5000);  // Wait time until next jiggle
    Mouse.move(4,0,0);
    delay(100);
    Mouse.move(-8,0,0);
    delay(100);
    Mouse.move(4,0,0);
  }
}