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 */ 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; } }
 * 1) include 
 * 2) define CLPS7111_VIRT_BASE     0xff000000
 * 3) define PBDR 0x0001