From 6f8c5066a3f32a0ff5fade41ea25e51f7b5d4658 Mon Sep 17 00:00:00 2001 From: chrys87 Date: Mon, 27 Feb 2017 17:50:07 +0100 Subject: [PATCH] Update detectDevices.py --- play zone/detectDevices.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/play zone/detectDevices.py b/play zone/detectDevices.py index a99e94cf..c4ca8ec5 100644 --- a/play zone/detectDevices.py +++ b/play zone/detectDevices.py @@ -1,7 +1,16 @@ #!/bin/python iDevices = {} -def updateInputDevices(): +iDeviceNo = 0 +def updateInputDevices(force = False, init = False): + global iDeviceNo + if init: + iDevices = {} + iDeviceNo = 0 deviceFileList = evdev.list_devices() + if not force: + if len(deviceFileList) == iDeviceNo: + return + iDeviceNo = len(deviceFileList) mode = 'ALL' iDevicesFiles = [] for device in iDevices: