rendered paste body#include <stdio.h>
#include <sys/types.h>
#include <machine/pio.h>
#include <machine/sysarch.h>
#include <err.h>
int main(){
u_long iomap[32];
u_long mask = 0xFFFFFFFF;
int i = 0;
if (i386_get_ioperm(iomap) < 0)
errx(1,"get_ioperm failed :(");
for (i=0;i<32;i++){
iomap[i] = mask | iomap[i];
}
if (i386_set_ioperm(iomap) < 0)
errx(1, "i386_set_ioperm failed");
outb(0x03, 0xB3);
outb(0xBF, 0xB2);
char c = inb(0xb3);
printf("%x\n",c);
// value -> addr
// backlight value (tested 0x54, 0x74, 0xA4)
outb(0x04, 0xB3);
// ?
outb(0xBF, 0xB2);
return 0;
}