From: realraum Date: Thu, 30 Apr 2009 04:18:17 +0000 (+0000) Subject: update status at daemon start X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=8a0646b11b10d1aeb930fec838b825e917ba6cc9;p=svn42.git update status at daemon start --- diff --git a/door_daemon.py b/door_daemon.py index fefc6cd..8df0761 100755 --- a/door_daemon.py +++ b/door_daemon.py @@ -50,7 +50,8 @@ class ArduinoUSBThread ( threading.Thread ): self.cv_updatestatus = threading.Condition(); #lock ist automatically created withing condition self.file_dev_ttyusb=file_dev_ttyusb #self.fh = open(self.file_dev_ttyusb,"w+") - self.fh = os.fdopen(os.open(self.file_dev_ttyusb, os.O_RDWR | os.O_NONBLOCK),"r+") + self.fh = os.fdopen(os.open(self.file_dev_ttyusb, os.O_RDWR | os.O_NONBLOCK),"r+") + #pythons sucks just like perl: we need nonblock or we can't write to FileHandle while we block reading on same filehandle self.statusdisplay = StatusDisplay() threading.Thread.__init__(self) @@ -206,6 +207,8 @@ arduino.start() ctrlfifo = ControlFIFOThread(fifofile,arduino) ctrlfifo.start() +arduino.send_statusrequest() + def exit_handler(signum, frame): global arduino, ctrlfifo logging.info("Door Daemon stopping")