Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

ZipIt Lid

Jump to: navigation, search

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;