Created
October 22, 2014 08:14
-
-
Save gauteh/a6c88677495ca07ebb2b to your computer and use it in GitHub Desktop.
no more 1802 error for thinkpad x31 (cross compiled)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from: http://www.thinkwiki.org/wiki/Problem_with_unauthorized_MiniPCI_network_card | |
// cross compile using (install gcc-multilib): | |
// $ linux32 | |
// $ gcc -m32 -static -o no-1802 no-1802.c | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
int main(void) | |
{ | |
int fd; | |
unsigned char data; | |
fd = open("/dev/nvram", O_RDWR); | |
if (fd==-1) { | |
printf("Opening /dev/nvram failed\n"); | |
return 1; | |
} | |
printf("Disabling WiFi whitelist check.\n"); | |
/* BIG INFORMATIONAL WARNING */ | |
/* The linux nvram driver doesn't give access to the first 14 bytes of | |
the CMOS. As a result, we seek to 0x5c rather than 0x6a. If you're | |
implementing this under another OS, then you'll have to go to whichever | |
address is appropriate for your access method */ | |
lseek(fd, 0x5c, SEEK_SET); | |
read(fd, &data, 1); | |
printf("CMOS address 0x5c: %02x->", data); | |
data |= 0x80; | |
printf("%02x\n", data); | |
lseek(fd, 0x5c, SEEK_SET); | |
if (write(fd, &data, 1)<0) { | |
printf("Unable to write to /dev/nvram - hack failed\n"); | |
close(fd); | |
return 2; | |
} | |
close(fd); | |
printf("Done.\n"); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment