From 3918a71627fd36062e8f63c27b89aef01043653e Mon Sep 17 00:00:00 2001 From: Maschell Date: Mon, 6 Feb 2017 09:17:22 +0100 Subject: [PATCH] Fixed possible problem with the LinuxDevInputController --- .../ash/HIDToVPADNetworkClient/controller/Controller.java | 6 +++++- .../controller/LinuxDevInputController.java | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/net/ash/HIDToVPADNetworkClient/controller/Controller.java b/src/net/ash/HIDToVPADNetworkClient/controller/Controller.java index 0467f08..44b0df7 100644 --- a/src/net/ash/HIDToVPADNetworkClient/controller/Controller.java +++ b/src/net/ash/HIDToVPADNetworkClient/controller/Controller.java @@ -62,7 +62,7 @@ public abstract class Controller implements Runnable{ if(newData != null){ setLatestData(newData); } - Utilities.sleep(10); + doSleepAfterPollingData(); } synchronized (shutdownLock) { shutdownState = shutdown; @@ -73,6 +73,10 @@ public abstract class Controller implements Runnable{ } } + protected void doSleepAfterPollingData() { + Utilities.sleep(10); + } + @Synchronized("dataLock") private void setLatestData(byte[] newData) { this.latestData = newData; diff --git a/src/net/ash/HIDToVPADNetworkClient/controller/LinuxDevInputController.java b/src/net/ash/HIDToVPADNetworkClient/controller/LinuxDevInputController.java index 6eef7a7..82bde01 100644 --- a/src/net/ash/HIDToVPADNetworkClient/controller/LinuxDevInputController.java +++ b/src/net/ash/HIDToVPADNetworkClient/controller/LinuxDevInputController.java @@ -125,6 +125,11 @@ public class LinuxDevInputController extends Controller implements Runnable{ } return newData; } + + @Override + protected void doSleepAfterPollingData() { + //This is event driven (aka pollLatestData() is blocking anyway until we have data), we don't need to sleep it all. + } @Override public void destroyDriver() {