summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdaemon.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/daemon.py b/daemon.py
index 91b38e8..9d35f33 100755
--- a/daemon.py
+++ b/daemon.py
@@ -21,6 +21,7 @@ class Daemon:
def __init__(self):
self.ser = serial.Serial(sys.argv[1], 9600, timeout=1)
+ logger.debug("connected. waiting for client greeting")
# raise timeout to let arduino start up
self.ser.timeout = 15
@@ -29,13 +30,14 @@ class Daemon:
# arduino sometimes has a dirty buffer
# and sends junk before the ready message
if not incoming.endswith("ready"):
- sys.stderr.write("Got unexpected reply: "+incoming)
- raise Exception("Wrong client greeting")
+ log.error("Got reply: '"+incoming+"'")
+ raise Exception("Wrong or no client greeting")
self.ser.timeout = 1
+ logger.debug("got client greeting")
self.client = mpd.MPDClient()
self.client.connect("localhost", 6600)
- logger.debug("connected")
+ logger.debug("connected to mpd")
def readline(self):
return self.ser.readline().decode("ascii").strip()