#!/usr/bin/python3
import os, time, sys

FAN1 = (0x67, 0x68)
FAN2 = (0x6B, 0x6C)

PWN = 0x0D
TEST_EN = 0x0E


def read_reg(add):
    cmd = "./ecx86_64 -a %s -r" % hex(add)
    f = os.popen(cmd)
    return int(f.read(), 16)


def main():
    while True:
        sval = input("请输入风扇转速等级（1～254）:")
        val = int(sval)
        os.system("./ecx86_64 -a %s -w %s" % (hex(PWN), hex(val)))



if __name__ == '__main__':
    os.system("chmod +x ./ecx86_64")
    os.system("./ecx86_64 -a %s -w %s" % (hex(TEST_EN), 1))
    main()
