virtual void init() { if (mInotifyFd == -1) { mInotifyFd = inotify_init1(IN_CLOEXEC); if (mInotifyFd == -1) { rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str()); } else { rtLogDebug("initializing inotify, adding watch: %s", kDevInput); mWatchFd = inotify_add_watch(mInotifyFd, kDevInput, (IN_DELETE | IN_CREATE)); if (mWatchFd == -1) { rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str()); } else { rtLogDebug("adding change notify descriptor: %d to poll list", mInotifyFd); pollfd p; p.fd = mInotifyFd; p.events = (POLLIN | POLLERR); p.revents = 0; mFds.push_back(p); } } } registerDevices(getKeyboardDevices()); registerDevices(getMouseDevices()); }
// // ISDL12InputSubsystem::initKeyboard // void ISDL12InputSubsystem::initKeyboard(int id) { shutdownKeyboard(0); const std::vector<IInputDeviceInfo> devices = getKeyboardDevices(); std::string device_name; for (std::vector<IInputDeviceInfo>::const_iterator it = devices.begin(); it != devices.end(); ++it) { if (it->mId == id) device_name = it->mDeviceName; } Printf(PRINT_HIGH, "I_InitInput: intializing %s\n", device_name.c_str()); setKeyboardInputDevice(new ISDL12KeyboardInputDevice(id)); registerInputDevice(getKeyboardInputDevice()); getKeyboardInputDevice()->resume(); }