From 4f68412225b24c8c567416e3e2ecdb7a6a5dae67 Mon Sep 17 00:00:00 2001 From: apocatarsis Date: Fri, 21 Aug 2015 23:24:28 +0200 Subject: [PATCH] Bug fixed Fixed bug where the daemon takes 100% CPU when the device is disconected. --- src/naga.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/naga.cpp b/src/naga.cpp index a6d63d3..21b3a8b 100644 --- a/src/naga.cpp +++ b/src/naga.cpp @@ -85,6 +85,7 @@ class NagaDaemon{ int pid; while (1){ rd = read (fd, ev, size * 64); + if (rd == -1) exit(1); //Thanks Destroyer! value = ev[0].value; if (value != ' ' && ev[1].value == 1 && ev[1].type == 1){ // Only read the key press event for(int i=0;i