core_fb: Fix crash on tablet with removable kbd
authorOlivier Guiter <olivier.guiter@linux.intel.com>
Mon, 30 Jun 2014 14:32:36 +0000 (16:32 +0200)
committerGustavo Sverzut Barbieri <gustavo.barbieri@intel.com>
Mon, 30 Jun 2014 22:55:40 +0000 (19:55 -0300)
On tablet with removable keyboard (e.g.: T100), as the FB support
in ecore is very limited, the lib crashes when you remove the kbd.
This patch disabled gracefully a "not anymore present" keyboard...

Signed-off-by: Olivier Guiter <olivier.guiter@linux.intel.com>
src/lib/ecore_fb/ecore_fb_li.c

index f332959..8385762 100644 (file)
@@ -406,6 +406,10 @@ _ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh EINA_UNUSED)
    dev = (Ecore_Fb_Input_Device*)data;
    /* read up to 64 events at once */
    len = read(dev->fd, &ev, sizeof(ev));
+   if (len < 0) {
+       dev->listen = EINA_FALSE;
+       return EINA_FALSE;
+   }
    for(i = 0; i < (int)(len / sizeof(ev[0])); i++)
      {
         switch(ev[i].type)