Loading libs/ui/EventHub.cpp +12 −5 Original line number Original line Diff line number Diff line Loading @@ -781,12 +781,21 @@ int EventHub::close_device(const char *deviceName) if(strcmp(mDevices[i]->path.string(), deviceName) == 0) { if(strcmp(mDevices[i]->path.string(), deviceName) == 0) { //LOGD("remove device %d: %s\n", i, deviceName); //LOGD("remove device %d: %s\n", i, deviceName); device_t* device = mDevices[i]; device_t* device = mDevices[i]; int count = mFDCount - i - 1; LOGI("Removed device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n", device->path.string(), device->name.string(), device->id, mNumDevicesById, mFDCount, mFDs[i].fd, device->classes); // Clear this device's entry. int index = (device->id&ID_MASK); int index = (device->id&ID_MASK); mDevicesById[index].device = NULL; mDevicesById[index].device = NULL; // Close the file descriptor and compact the fd array. close(mFDs[i].fd); close(mFDs[i].fd); int count = mFDCount - i - 1; memmove(mDevices + i, mDevices + i + 1, sizeof(mDevices[0]) * count); memmove(mDevices + i, mDevices + i + 1, sizeof(mDevices[0]) * count); memmove(mFDs + i, mFDs + i + 1, sizeof(mFDs[0]) * count); memmove(mFDs + i, mFDs + i + 1, sizeof(mFDs[0]) * count); mFDCount--; #ifdef EV_SW #ifdef EV_SW for (int j=0; j<EV_SW; j++) { for (int j=0; j<EV_SW; j++) { Loading @@ -799,8 +808,6 @@ int EventHub::close_device(const char *deviceName) device->next = mClosingDevices; device->next = mClosingDevices; mClosingDevices = device; mClosingDevices = device; mFDCount--; uint32_t publicID; uint32_t publicID; if (device->id == mFirstKeyboardId) { if (device->id == mFirstKeyboardId) { LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", Loading @@ -817,7 +824,7 @@ int EventHub::close_device(const char *deviceName) return 0; return 0; } } } } LOGE("remote device: %s not found\n", deviceName); LOGE("remove device: %s not found\n", deviceName); return -1; return -1; } } Loading @@ -832,7 +839,7 @@ int EventHub::read_notify(int nfd) int event_pos = 0; int event_pos = 0; struct inotify_event *event; struct inotify_event *event; LOGD("EventHub::read_notify nfd: %d\n", nfd); LOGV("EventHub::read_notify nfd: %d\n", nfd); res = read(nfd, event_buf, sizeof(event_buf)); res = read(nfd, event_buf, sizeof(event_buf)); if(res < (int)sizeof(*event)) { if(res < (int)sizeof(*event)) { if(errno == EINTR) if(errno == EINTR) Loading Loading
libs/ui/EventHub.cpp +12 −5 Original line number Original line Diff line number Diff line Loading @@ -781,12 +781,21 @@ int EventHub::close_device(const char *deviceName) if(strcmp(mDevices[i]->path.string(), deviceName) == 0) { if(strcmp(mDevices[i]->path.string(), deviceName) == 0) { //LOGD("remove device %d: %s\n", i, deviceName); //LOGD("remove device %d: %s\n", i, deviceName); device_t* device = mDevices[i]; device_t* device = mDevices[i]; int count = mFDCount - i - 1; LOGI("Removed device: path=%s name=%s id=0x%x (of 0x%x) index=%d fd=%d classes=0x%x\n", device->path.string(), device->name.string(), device->id, mNumDevicesById, mFDCount, mFDs[i].fd, device->classes); // Clear this device's entry. int index = (device->id&ID_MASK); int index = (device->id&ID_MASK); mDevicesById[index].device = NULL; mDevicesById[index].device = NULL; // Close the file descriptor and compact the fd array. close(mFDs[i].fd); close(mFDs[i].fd); int count = mFDCount - i - 1; memmove(mDevices + i, mDevices + i + 1, sizeof(mDevices[0]) * count); memmove(mDevices + i, mDevices + i + 1, sizeof(mDevices[0]) * count); memmove(mFDs + i, mFDs + i + 1, sizeof(mFDs[0]) * count); memmove(mFDs + i, mFDs + i + 1, sizeof(mFDs[0]) * count); mFDCount--; #ifdef EV_SW #ifdef EV_SW for (int j=0; j<EV_SW; j++) { for (int j=0; j<EV_SW; j++) { Loading @@ -799,8 +808,6 @@ int EventHub::close_device(const char *deviceName) device->next = mClosingDevices; device->next = mClosingDevices; mClosingDevices = device; mClosingDevices = device; mFDCount--; uint32_t publicID; uint32_t publicID; if (device->id == mFirstKeyboardId) { if (device->id == mFirstKeyboardId) { LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", LOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", Loading @@ -817,7 +824,7 @@ int EventHub::close_device(const char *deviceName) return 0; return 0; } } } } LOGE("remote device: %s not found\n", deviceName); LOGE("remove device: %s not found\n", deviceName); return -1; return -1; } } Loading @@ -832,7 +839,7 @@ int EventHub::read_notify(int nfd) int event_pos = 0; int event_pos = 0; struct inotify_event *event; struct inotify_event *event; LOGD("EventHub::read_notify nfd: %d\n", nfd); LOGV("EventHub::read_notify nfd: %d\n", nfd); res = read(nfd, event_buf, sizeof(event_buf)); res = read(nfd, event_buf, sizeof(event_buf)); if(res < (int)sizeof(*event)) { if(res < (int)sizeof(*event)) { if(errno == EINTR) if(errno == EINTR) Loading