ZipIt Lid
Here is the source to the 'lid' utility in my distribution. If you change the read to a write, and change the port/bit appropriately, it's pretty simple to change the LED output state.
---
/* quick & dirty check of whether the lid-closed button is pressed */ /* Adam Tilghman, 5/2005, released into the public domain */ #include <unistd.h> #define CLPS7111_VIRT_BASE 0xff000000 #define PBDR 0x0001 int main(int argc, char **argv) { unsigned char c = *(unsigned char *) ( CLPS7111_VIRT_BASE + PBDR ); if (c & 0x08 ) { /* lid switch is connected to PB bit four */ return 1; /* closed */ } else { return 0; } }