#include #include #include #include void write_wait(); int main() { unsigned char ret; iopl (3); printf("Magic writes begin\n"); outb_p (0xb4, 0x64); write_wait (); outb_p (0xff, 0x64); write_wait(); printf("Magic writes end\n"); while (! inb_p (0x60) == 0xfa); printf("EC has now been put to sleep\n"); system("flashrom/flashrom -V"); printf("Closing shop begin\n"); outb_p (0xfb, 0x64); write_wait(); outb_p (0xff, 0x64); write_wait(); printf("Closing shop end.. lets hope you have keyboard now\n"); return 0; } void write_wait() { int timer = 0; while (inb_p(0x64) & (1 << 1)) { if(++timer == 40000) { printf("Okies... yank the power and battery... again..\n"); exit (-1); } } }