Ejemplo n.º 1
0
    print("Hardware removed!")


sensors = [
    '/intelcpu/0/temperature/0', '/intelcpu/0/temperature/1',
    '/intelcpu/0/temperature/2', '/intelcpu/0/temperature/3'
]

hardware = ['/intelcpu/0']

__sensors = []
__hw = []

comp = Computer()

comp.MainboardEnabled = False
comp.RAMEnabled = False
comp.CPUEnabled = True
comp.GPUEnabled = False
comp.HDDEnabled = False
comp.Open()

for hw in comp.Hardware:
    print(hw.Identifier, hardware)
    if str(hw.Identifier) in hardware:
        __hw.append(hw)

        hw.Update()
        for sensor in hw.Sensors:
            if str(sensor.Identifier) in sensors:
                __sensors.append(sensor)
Ejemplo n.º 2
0
#GUI INIT
root = Tk()
root.title("Info Display Serial Server")
S = Scrollbar(root)
S.pack(side=RIGHT, fill=Y)
T = Text(root, height=50, width=100)
S.config(command=T.yview)
T.pack()
T.config(yscrollcommand=S.set)

#Configure Open Hardware Lib
c = Computer()
c.CPUEnabled = True  # get the Info about CPU
c.GPUEnabled = True  # get the Info about GPU
c.MainboardEnabled = True
c.FanControllerEnabled = True
c.HDDEnabled = True
c.RAMEnabled = True
c.Open()

#Message Send Delay, we could sent multiple commands with same message but we are lazy and only sent one command with every message, this is the time between the messages
#crappy com structure but works
MsgDelay = 0.15

#Settings for Serial Interface
ser = serial.Serial()
ser.baudrate = 115200
ser.port = 'COM3'