Exemplo n.º 1
0
    def regSet(self, dev_type, addr, data):
        try:
            self._devAddrSet(dev_type)
        except Exception as e:
            self.logger.error("Set device address fail, error: " + str(e))
            raise

        try:
            portio.iopl(3)
        except Exception as e:
            self.logger.error("LPC.regGet: iopl() enable failed")
            raise

        try:
            portio.ioperm(self.lpcAddr + addr, 4, 1)
        except Exception as e:
            self.logger.error("LPC.regGet: ioperm() enable failed")
            raise

        try:
            portio.outb(data, self.lpcAddr + addr)
        except Exception as e:
            self.logger.error("LPC.regGet: outb() failed")

        try:
            portio.ioperm(self.lpcAddr + addr, 4, 0)
        except Exception as e:
            self.logger.error("LPC.regGet: ioperm() disable failed")
            raise

        try:
            portio.iopl(0)
        except Exception as e:
            self.logger.error("LPC.regGet: iopl() disable failed")
            raise
Exemplo n.º 2
0
def acquire_io_access_permission():
    global iopl_flag

    # root privilege is required
    if not root_flag:
        verify_root_privilege()
        pass

    ret = portio.iopl(3)
    if ret == 0:
        iopl_flag = True
        print('INFO: I/O access is available (using root privileges)')
        pass
    return ret
Exemplo n.º 3
0
#!/usr/bin/python3
import portio

portio.iopl(3)
portio.ioperm(0x2E, 2, 1)

portio.outb_p(0x87, 0x2E)
portio.outb_p(0x01, 0x2E)
portio.outb_p(0x55, 0x2E)
portio.outb_p(0x55, 0x2E)
portio.outb_p(0x07, 0x2E)
portio.outb_p(0x03, 0x2F)
portio.outb_p(0xF0, 0x2E)
f = portio.inb_p(0x2F)
f ^= 0x08
portio.outb_p(f, 0x2F)
Exemplo n.º 4
0
 def __init__(self):
     portio.iopl(3)
     self.get_azel()
     pass
Exemplo n.º 5
0
 def __init__(self):
     portio.iopl(3)
     self.get_azel()
     pass