Change FIFO read/write to text mode; fix bug with `cat` via FIFO open/close around each write

This commit is contained in:
Joshua Boniface 2017-03-31 05:02:18 +00:00
parent 6e2283f8d6
commit 0ffe48e080
1 changed files with 3 additions and 2 deletions

5
bmcd
View File

@ -55,7 +55,7 @@ def locate_off():
is_pled_flashing.clear() is_pled_flashing.clear()
def readcmd(): def readcmd():
fcmd = open(bmcd_cmd, 'r+b', 0) fcmd = open(bmcd_cmd, 'r+', 0)
while True: while True:
line = fcmd.readline() line = fcmd.readline()
try: try:
@ -64,11 +64,12 @@ def readcmd():
pass pass
def writestate(is_pled_flashing): def writestate(is_pled_flashing):
fstate = open(bmcd_state, 'w+b', 0)
state_prev = 1 state_prev = 1
while True: while True:
state_now = GPIO.input(gpio_state) state_now = GPIO.input(gpio_state)
fstate = open(bmcd_state, 'w+', 0)
fstate.write(str(state_now) + '\n') fstate.write(str(state_now) + '\n')
fstate.close()
if not is_pled_flashing.isSet(): if not is_pled_flashing.isSet():
if state_now == 1: if state_now == 1:
powerled_on() powerled_on()