summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mdb/device.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/mdb/device.py b/mdb/device.py
index 0b1940c..5f789b5 100644
--- a/mdb/device.py
+++ b/mdb/device.py
@@ -143,7 +143,25 @@ class CashlessMDBDevice(MDBDevice):
model_number = '123456789012'
software_version = (0x21, 0x37)
+ lockup_counter = 0
+
def process_request(self, req):
+ # FIXME this shouldn't be required...
+ if req.command == 0x30 and req.validate_checksum():
+ self.lockup_counter += 1
+
+ if self.lockup_counter >= 20:
+ self.logger.info('YOLO')
+ return []
+ if req.command == 0x31 and req.validate_checksum():
+ return []
+ if req.command == 0x37 and req.validate_checksum():
+ return []
+ if req.command == 0x36 and req.validate_checksum():
+ return []
+ if req.command == 0x34 and req.validate_checksum():
+ return []
+
if (req.command & self.base_address) != self.base_address:
# Target mismatch
return
@@ -152,6 +170,8 @@ class CashlessMDBDevice(MDBDevice):
# Invalid checksum
return
+ self.lockup_counter = 0
+
if req.command == CASHLESS_RESET:
self.state = 'RESET'
self.logger.info('RESET: Device reset')
@@ -241,6 +261,7 @@ class CashlessMDBDevice(MDBDevice):
return []
def begin_session(self, amount):
+ self.logger.info('Beginning session for %d', amount)
# Begins new session with balance provided
if amount > 65535:
amount = 65535