From 0f98b94299a8e43922b92a48f1d4c8b04033a54e Mon Sep 17 00:00:00 2001 From: CymatiCorp Date: Thu, 11 Aug 2016 12:15:00 -0700 Subject: [PATCH] Add a user request to use a device. This will prompt a user to confirm if they want to use a found device. --- python/emokit/emotiv.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/emokit/emotiv.py b/python/emokit/emotiv.py index 142a253..6beb7c3 100644 --- a/python/emokit/emotiv.py +++ b/python/emokit/emotiv.py @@ -249,8 +249,10 @@ def hid_enumerate(): is_emotiv = True if is_emotiv: - serial_number = device.serial_number - path = device.path + useDevice = raw_input("Use this device? [Y]es? ") + if useDevice.upper() == "Y": + serial_number = device.serial_number + path = device.path except: pass return path, serial_number @@ -619,9 +621,12 @@ def setup_windows(self): if "EEG Signals" in device.product_name: is_emotiv = True if is_emotiv: - devices.append(device) + print "\n" + device.product_name + " Found!\n" + useDevice = raw_input("Use this device? [Y]es? ") + if useDevice.upper() == "Y": + devices.append(device) if len(devices) > 0: - device = devices[1] + device = devices[0] device.open() self.serial_number = device.serial_number device.set_raw_data_handler(self.handler)