1
0
mirror of https://github.com/rzzzwilson/pymlac.git synced 2025-06-10 09:32:41 +00:00

Better logging for TtyIn device

This commit is contained in:
Ross Wilson
2016-03-12 15:27:22 +07:00
parent 8153fd86ac
commit 6f6715b66b

View File

@@ -34,6 +34,8 @@ class TtyIn(object):
def mount(self, fname):
"""Mount a file on the TTYIN device."""
log("Mounting '%s' on TTYIN" % fname)
self.filename = fname
self.open_file = open(fname, 'r')
self.value = self.open_file.read(1)
@@ -51,6 +53,8 @@ class TtyIn(object):
def dismount(self):
"""Dismount the file on the TTYIN device."""
log("Dismounting '%s' on TTYIN" % self.filename)
if self.open_file:
self.open_file.close()
self.filename = None
@@ -63,6 +67,8 @@ class TtyIn(object):
def read(self):
"""Return the current device value."""
log("Reading TTYIN: returning %03o" % self.value)
return self.value
def ready(self):
@@ -73,6 +79,8 @@ class TtyIn(object):
def clear(self):
"""Clear the device 'ready' status."""
log("TTYIN: clearing flag")
self.status = self.DEVICE_NOT_READY
def tick(self, cycles):