diff --git a/amdsmi_cli/amdsmi_commands.py b/amdsmi_cli/amdsmi_commands.py index 086c8bd104..21a7d73753 100644 --- a/amdsmi_cli/amdsmi_commands.py +++ b/amdsmi_cli/amdsmi_commands.py @@ -2816,16 +2816,20 @@ class AMDSMICommands(): args.gpu = [args.gpu] print('EVENT LISTENING:\n') - print('Press q and hit ENTER when you want to stop (listening will stop within 10 seconds)') - + print('Press q and hit ENTER when you want to stop.') + self.stop = False threads = [] for device_handle in range(len(args.gpu)): x = threading.Thread(target=self._event_thread, args=(self, device_handle)) threads.append(x) x.start() - while self.stop!= 'q': - self.stop = input("") + while True: + user_input = input() + if user_input == 'q': + print("Escape Sequence Detected; Exiting") + self.stop = True + break for thread in threads: thread.join() @@ -4956,9 +4960,9 @@ class AMDSMICommands(): amdsmi_interface.AmdSmiEvtNotificationType) values_dict = {} - while self.stop!='q': + while not self.stop: try: - events = listener.read(10000) + events = listener.read(2000) for event in events: values_dict["event"] = event["event"] values_dict["message"] = event["message"] @@ -4970,4 +4974,4 @@ class AMDSMICommands(): except Exception as e: print(e) - listener.stop() + listener.stop() \ No newline at end of file