Lines Matching refs:device

306         Device* device = mClosingDevices;  in ~EventHub()  local
307 mClosingDevices = device->next; in ~EventHub()
308 delete device; in ~EventHub()
321 Device* device = getDeviceLocked(deviceId); in getDeviceIdentifier() local
322 if (device == nullptr) return InputDeviceIdentifier(); in getDeviceIdentifier()
323 return device->identifier; in getDeviceIdentifier()
328 Device* device = getDeviceLocked(deviceId); in getDeviceClasses() local
329 if (device == nullptr) return 0; in getDeviceClasses()
330 return device->classes; in getDeviceClasses()
335 Device* device = getDeviceLocked(deviceId); in getDeviceControllerNumber() local
336 if (device == nullptr) return 0; in getDeviceControllerNumber()
337 return device->controllerNumber; in getDeviceControllerNumber()
342 Device* device = getDeviceLocked(deviceId); in getConfiguration() local
343 if (device && device->configuration) { in getConfiguration()
344 *outConfiguration = *device->configuration; in getConfiguration()
357 Device* device = getDeviceLocked(deviceId); in getAbsoluteAxisInfo() local
358 if (device && device->hasValidFd() && test_bit(axis, device->absBitmask)) { in getAbsoluteAxisInfo()
360 if(ioctl(device->fd, EVIOCGABS(axis), &info)) { in getAbsoluteAxisInfo()
362 axis, device->identifier.name.c_str(), device->fd, errno); in getAbsoluteAxisInfo()
384 Device* device = getDeviceLocked(deviceId); in hasRelativeAxis() local
385 if (device) { in hasRelativeAxis()
386 return test_bit(axis, device->relBitmask); in hasRelativeAxis()
396 Device* device = getDeviceLocked(deviceId); in hasInputProperty() local
397 if (device) { in hasInputProperty()
398 return test_bit(property, device->propBitmask); in hasInputProperty()
408 Device* device = getDeviceLocked(deviceId); in getScanCodeState() local
409 if (device && device->hasValidFd() && test_bit(scanCode, device->keyBitmask)) { in getScanCodeState()
412 if (ioctl(device->fd, EVIOCGKEY(sizeof(keyState)), keyState) >= 0) { in getScanCodeState()
423 Device* device = getDeviceLocked(deviceId); in getKeyCodeState() local
424 if (device && device->hasValidFd() && device->keyMap.haveKeyLayout()) { in getKeyCodeState()
426 device->keyMap.keyLayoutMap->findScanCodesForKey(keyCode, &scanCodes); in getKeyCodeState()
430 if (ioctl(device->fd, EVIOCGKEY(sizeof(keyState)), keyState) >= 0) { in getKeyCodeState()
448 Device* device = getDeviceLocked(deviceId); in getSwitchState() local
449 if (device && device->hasValidFd() && test_bit(sw, device->swBitmask)) { in getSwitchState()
452 if (ioctl(device->fd, EVIOCGSW(sizeof(swState)), swState) >= 0) { in getSwitchState()
466 Device* device = getDeviceLocked(deviceId); in getAbsoluteAxisValue() local
467 if (device && device->hasValidFd() && test_bit(axis, device->absBitmask)) { in getAbsoluteAxisValue()
469 if(ioctl(device->fd, EVIOCGABS(axis), &info)) { in getAbsoluteAxisValue()
471 axis, device->identifier.name.c_str(), device->fd, errno); in getAbsoluteAxisValue()
486 Device* device = getDeviceLocked(deviceId); in markSupportedKeyCodes() local
487 if (device && device->keyMap.haveKeyLayout()) { in markSupportedKeyCodes()
492 status_t err = device->keyMap.keyLayoutMap->findScanCodesForKey( in markSupportedKeyCodes()
498 if (test_bit(scanCodes[sc], device->keyBitmask)) { in markSupportedKeyCodes()
514 Device* device = getDeviceLocked(deviceId); in mapKey() local
517 if (device) { in mapKey()
519 sp<KeyCharacterMap> kcm = device->getKeyCharacterMap(); in mapKey()
528 if (status != NO_ERROR && device->keyMap.haveKeyLayout()) { in mapKey()
529 if (!device->keyMap.keyLayoutMap->mapKey(scanCode, usageCode, outKeycode, outFlags)) { in mapKey()
554 Device* device = getDeviceLocked(deviceId); in mapAxis() local
556 if (device && device->keyMap.haveKeyLayout()) { in mapAxis()
557 status_t err = device->keyMap.keyLayoutMap->mapAxis(scanCode, outAxisInfo); in mapAxis()
574 Device* device = getDeviceLocked(deviceId); in hasScanCode() local
575 if (device && scanCode >= 0 && scanCode <= KEY_MAX) { in hasScanCode()
576 if (test_bit(scanCode, device->keyBitmask)) { in hasScanCode()
585 Device* device = getDeviceLocked(deviceId); in hasLed() local
587 if (device && mapLed(device, led, &sc) == NO_ERROR) { in hasLed()
588 if (test_bit(sc, device->ledBitmask)) { in hasLed()
597 Device* device = getDeviceLocked(deviceId); in setLedState() local
598 setLedStateLocked(device, led, on); in setLedState()
601 void EventHub::setLedStateLocked(Device* device, int32_t led, bool on) { in setLedStateLocked() argument
603 if (device && device->hasValidFd() && mapLed(device, led, &sc) != NAME_NOT_FOUND) { in setLedStateLocked()
613 nWrite = write(device->fd, &ev, sizeof(struct input_event)); in setLedStateLocked()
623 Device* device = getDeviceLocked(deviceId); in getVirtualKeyDefinitions() local
624 if (device && device->virtualKeyMap) { in getVirtualKeyDefinitions()
626 device->virtualKeyMap->getVirtualKeys(); in getVirtualKeyDefinitions()
633 Device* device = getDeviceLocked(deviceId); in getKeyCharacterMap() local
634 if (device) { in getKeyCharacterMap()
635 return device->getKeyCharacterMap(); in getKeyCharacterMap()
643 Device* device = getDeviceLocked(deviceId); in setKeyboardLayoutOverlay() local
644 if (device) { in setKeyboardLayoutOverlay()
645 if (map != device->overlayKeyMap) { in setKeyboardLayoutOverlay()
646 device->overlayKeyMap = map; in setKeyboardLayoutOverlay()
647 device->combinedKeyMap = KeyCharacterMap::combine( in setKeyboardLayoutOverlay()
648 device->keyMap.keyCharacterMap, map); in setKeyboardLayoutOverlay()
708 Device* device = getDeviceLocked(deviceId); in vibrate() local
709 if (device && device->hasValidFd()) { in vibrate()
713 effect.id = device->ffEffectId; in vibrate()
718 if (ioctl(device->fd, EVIOCSFF, &effect)) { in vibrate()
720 device->identifier.name.c_str(), errno); in vibrate()
723 device->ffEffectId = effect.id; in vibrate()
729 ev.code = device->ffEffectId; in vibrate()
731 if (write(device->fd, &ev, sizeof(ev)) != sizeof(ev)) { in vibrate()
733 device->identifier.name.c_str(), errno); in vibrate()
736 device->ffEffectPlaying = true; in vibrate()
742 Device* device = getDeviceLocked(deviceId); in cancelVibrate() local
743 if (device && device->hasValidFd()) { in cancelVibrate()
744 if (device->ffEffectPlaying) { in cancelVibrate()
745 device->ffEffectPlaying = false; in cancelVibrate()
751 ev.code = device->ffEffectId; in cancelVibrate()
753 if (write(device->fd, &ev, sizeof(ev)) != sizeof(ev)) { in cancelVibrate()
755 device->identifier.name.c_str(), errno); in cancelVibrate()
765 Device* device = mDevices.valueAt(i); in getDeviceByDescriptorLocked() local
766 if (descriptor == device->identifier.descriptor) { in getDeviceByDescriptorLocked()
767 return device; in getDeviceByDescriptorLocked()
783 Device* device = mDevices.valueAt(i); in getDeviceByPathLocked() local
784 if (device->path == devicePath) { in getDeviceByPathLocked()
785 return device; in getDeviceByPathLocked()
800 Device* device = mDevices.valueAt(i); in getDeviceByFdLocked() local
801 if (device->fd == fd) { in getDeviceByFdLocked()
803 return device; in getDeviceByFdLocked()
805 if (device->videoDevice && device->videoDevice->getFd() == fd) { in getDeviceByFdLocked()
807 return device; in getDeviceByFdLocked()
841 Device* device = mClosingDevices; in getEvents() local
843 device->id, device->path.c_str()); in getEvents()
844 mClosingDevices = device->next; in getEvents()
846 event->deviceId = (device->id == mBuiltInKeyboardId) ? in getEvents()
847 ReservedInputDeviceId::BUILT_IN_KEYBOARD_ID : device->id; in getEvents()
850 delete device; in getEvents()
864 Device* device = mOpeningDevices; in getEvents() local
866 device->id, device->path.c_str()); in getEvents()
867 mOpeningDevices = device->next; in getEvents()
869 event->deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id; in getEvents()
917 Device* device = getDeviceByFdLocked(eventItem.data.fd); in getEvents() local
918 if (!device) { in getEvents()
924 if (device->videoDevice && eventItem.data.fd == device->videoDevice->getFd()) { in getEvents()
926 size_t numFrames = device->videoDevice->readAndQueueFrames(); in getEvents()
929 device->videoDevice->getName().c_str()); in getEvents()
934 device->videoDevice->getName().c_str()); in getEvents()
935 unregisterVideoDeviceFromEpollLocked(*device->videoDevice); in getEvents()
936 device->videoDevice = nullptr; in getEvents()
939 eventItem.events, device->videoDevice->getName().c_str()); in getEvents()
946 int32_t readSize = read(device->fd, readBuffer, in getEvents()
952 device->fd, readSize, bufferSize, capacity, errno); in getEvents()
954 closeDeviceLocked(device); in getEvents()
962 int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id; in getEvents()
984 device->identifier.name.c_str()); in getEvents()
986 closeDeviceLocked(device); in getEvents()
989 eventItem.events, device->identifier.name.c_str()); in getEvents()
1062 Device* device = getDeviceLocked(deviceId); in getVideoFrames() local
1063 if (!device || !device->videoDevice) { in getVideoFrames()
1066 return device->videoDevice->consumeFrames(); in getVideoFrames()
1140 status_t EventHub::registerDeviceForEpollLocked(Device* device) { in registerDeviceForEpollLocked() argument
1141 if (device == nullptr) { in registerDeviceForEpollLocked()
1147 status_t result = registerFdForEpoll(device->fd); in registerDeviceForEpollLocked()
1149 ALOGE("Could not add input device fd to epoll for device %" PRId32, device->id); in registerDeviceForEpollLocked()
1152 if (device->videoDevice) { in registerDeviceForEpollLocked()
1153 registerVideoDeviceForEpollLocked(*device->videoDevice); in registerDeviceForEpollLocked()
1165 status_t EventHub::unregisterDeviceFromEpollLocked(Device* device) { in unregisterDeviceFromEpollLocked() argument
1166 if (device->hasValidFd()) { in unregisterDeviceFromEpollLocked()
1167 status_t result = unregisterFdFromEpoll(device->fd); in unregisterDeviceFromEpollLocked()
1169 ALOGW("Could not remove input device fd from epoll for device %" PRId32, device->id); in unregisterDeviceFromEpollLocked()
1173 if (device->videoDevice) { in unregisterDeviceFromEpollLocked()
1174 unregisterVideoDeviceFromEpollLocked(*device->videoDevice); in unregisterDeviceFromEpollLocked()
1261 Device* device = new Device(fd, deviceId, devicePath, identifier); in openDeviceLocked() local
1277 loadConfigurationLocked(device); in openDeviceLocked()
1280 ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(device->keyBitmask)), device->keyBitmask); in openDeviceLocked()
1281 ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(device->absBitmask)), device->absBitmask); in openDeviceLocked()
1282 ioctl(fd, EVIOCGBIT(EV_REL, sizeof(device->relBitmask)), device->relBitmask); in openDeviceLocked()
1283 ioctl(fd, EVIOCGBIT(EV_SW, sizeof(device->swBitmask)), device->swBitmask); in openDeviceLocked()
1284 ioctl(fd, EVIOCGBIT(EV_LED, sizeof(device->ledBitmask)), device->ledBitmask); in openDeviceLocked()
1285 ioctl(fd, EVIOCGBIT(EV_FF, sizeof(device->ffBitmask)), device->ffBitmask); in openDeviceLocked()
1286 ioctl(fd, EVIOCGPROP(sizeof(device->propBitmask)), device->propBitmask); in openDeviceLocked()
1290 bool haveKeyboardKeys = containsNonZeroByte(device->keyBitmask, 0, sizeof_bit_array(BTN_MISC)) in openDeviceLocked()
1291 || containsNonZeroByte(device->keyBitmask, sizeof_bit_array(KEY_OK), in openDeviceLocked()
1293 bool haveGamepadButtons = containsNonZeroByte(device->keyBitmask, sizeof_bit_array(BTN_MISC), in openDeviceLocked()
1295 || containsNonZeroByte(device->keyBitmask, sizeof_bit_array(BTN_JOYSTICK), in openDeviceLocked()
1298 device->classes |= INPUT_DEVICE_CLASS_KEYBOARD; in openDeviceLocked()
1302 if (test_bit(BTN_MOUSE, device->keyBitmask) in openDeviceLocked()
1303 && test_bit(REL_X, device->relBitmask) in openDeviceLocked()
1304 && test_bit(REL_Y, device->relBitmask)) { in openDeviceLocked()
1305 device->classes |= INPUT_DEVICE_CLASS_CURSOR; in openDeviceLocked()
1310 if (device->configuration && in openDeviceLocked()
1311 device->configuration->tryGetProperty(String8("device.type"), deviceType)) { in openDeviceLocked()
1313 device->classes |= INPUT_DEVICE_CLASS_ROTARY_ENCODER; in openDeviceLocked()
1319 if (test_bit(ABS_MT_POSITION_X, device->absBitmask) in openDeviceLocked()
1320 && test_bit(ABS_MT_POSITION_Y, device->absBitmask)) { in openDeviceLocked()
1324 if (test_bit(BTN_TOUCH, device->keyBitmask) || !haveGamepadButtons) { in openDeviceLocked()
1325 device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT; in openDeviceLocked()
1328 } else if (test_bit(BTN_TOUCH, device->keyBitmask) in openDeviceLocked()
1329 && test_bit(ABS_X, device->absBitmask) in openDeviceLocked()
1330 && test_bit(ABS_Y, device->absBitmask)) { in openDeviceLocked()
1331 device->classes |= INPUT_DEVICE_CLASS_TOUCH; in openDeviceLocked()
1333 } else if ((test_bit(ABS_PRESSURE, device->absBitmask) || in openDeviceLocked()
1334 test_bit(BTN_TOUCH, device->keyBitmask)) in openDeviceLocked()
1335 && !test_bit(ABS_X, device->absBitmask) in openDeviceLocked()
1336 && !test_bit(ABS_Y, device->absBitmask)) { in openDeviceLocked()
1337 device->classes |= INPUT_DEVICE_CLASS_EXTERNAL_STYLUS; in openDeviceLocked()
1341 device->classes &= ~INPUT_DEVICE_CLASS_KEYBOARD; in openDeviceLocked()
1348 uint32_t assumedClasses = device->classes | INPUT_DEVICE_CLASS_JOYSTICK; in openDeviceLocked()
1350 if (test_bit(i, device->absBitmask) in openDeviceLocked()
1352 device->classes = assumedClasses; in openDeviceLocked()
1360 if (test_bit(i, device->swBitmask)) { in openDeviceLocked()
1361 device->classes |= INPUT_DEVICE_CLASS_SWITCH; in openDeviceLocked()
1367 if (test_bit(FF_RUMBLE, device->ffBitmask)) { in openDeviceLocked()
1368 device->classes |= INPUT_DEVICE_CLASS_VIBRATOR; in openDeviceLocked()
1372 if ((device->classes & INPUT_DEVICE_CLASS_TOUCH)) { in openDeviceLocked()
1375 bool success = loadVirtualKeyMapLocked(device); in openDeviceLocked()
1377 device->classes |= INPUT_DEVICE_CLASS_KEYBOARD; in openDeviceLocked()
1384 if (device->classes & (INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_JOYSTICK)) { in openDeviceLocked()
1386 keyMapStatus = loadKeyMapLocked(device); in openDeviceLocked()
1390 if (device->classes & INPUT_DEVICE_CLASS_KEYBOARD) { in openDeviceLocked()
1394 && isEligibleBuiltInKeyboard(device->identifier, in openDeviceLocked()
1395 device->configuration, &device->keyMap)) { in openDeviceLocked()
1396 mBuiltInKeyboardId = device->id; in openDeviceLocked()
1400 if (hasKeycodeLocked(device, AKEYCODE_Q)) { in openDeviceLocked()
1401 device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY; in openDeviceLocked()
1405 if (hasKeycodeLocked(device, AKEYCODE_DPAD_UP) && in openDeviceLocked()
1406 hasKeycodeLocked(device, AKEYCODE_DPAD_DOWN) && in openDeviceLocked()
1407 hasKeycodeLocked(device, AKEYCODE_DPAD_LEFT) && in openDeviceLocked()
1408 hasKeycodeLocked(device, AKEYCODE_DPAD_RIGHT) && in openDeviceLocked()
1409 hasKeycodeLocked(device, AKEYCODE_DPAD_CENTER)) { in openDeviceLocked()
1410 device->classes |= INPUT_DEVICE_CLASS_DPAD; in openDeviceLocked()
1415 if (hasKeycodeLocked(device, GAMEPAD_KEYCODES[i])) { in openDeviceLocked()
1416 device->classes |= INPUT_DEVICE_CLASS_GAMEPAD; in openDeviceLocked()
1423 if (device->classes == 0) { in openDeviceLocked()
1425 deviceId, devicePath, device->identifier.name.c_str()); in openDeviceLocked()
1426 delete device; in openDeviceLocked()
1431 if (deviceHasMicLocked(device)) { in openDeviceLocked()
1432 device->classes |= INPUT_DEVICE_CLASS_MIC; in openDeviceLocked()
1436 if (isExternalDeviceLocked(device)) { in openDeviceLocked()
1437 device->classes |= INPUT_DEVICE_CLASS_EXTERNAL; in openDeviceLocked()
1440 if (device->classes & (INPUT_DEVICE_CLASS_JOYSTICK | INPUT_DEVICE_CLASS_DPAD) in openDeviceLocked()
1441 && device->classes & INPUT_DEVICE_CLASS_GAMEPAD) { in openDeviceLocked()
1442 device->controllerNumber = getNextControllerNumberLocked(device); in openDeviceLocked()
1443 setLedForControllerLocked(device); in openDeviceLocked()
1449 if (device->identifier.name == videoDevice->getName()) { in openDeviceLocked()
1450 device->videoDevice = std::move(videoDevice); in openDeviceLocked()
1459 if (registerDeviceForEpollLocked(device) != OK) { in openDeviceLocked()
1460 delete device; in openDeviceLocked()
1464 configureFd(device); in openDeviceLocked()
1468 deviceId, fd, devicePath, device->identifier.name.c_str(), in openDeviceLocked()
1469 device->classes, in openDeviceLocked()
1470 device->configurationFile.c_str(), in openDeviceLocked()
1471 device->keyMap.keyLayoutFile.c_str(), in openDeviceLocked()
1472 device->keyMap.keyCharacterMapFile.c_str(), in openDeviceLocked()
1475 addDeviceLocked(device); in openDeviceLocked()
1479 void EventHub::configureFd(Device* device) { in configureFd() argument
1481 if (device->classes & INPUT_DEVICE_CLASS_KEYBOARD) { in configureFd()
1484 if (ioctl(device->fd, EVIOCSREP, repeatRate)) { in configureFd()
1486 device->path.c_str(), strerror(errno)); in configureFd()
1498 if (ioctl(device->fd, EVIOCSSUSPENDBLOCK, 1)) { in configureFd()
1509 bool usingClockIoctl = !ioctl(device->fd, EVIOCSCLOCKID, &clockId); in configureFd()
1522 Device* device = mDevices.valueAt(i); in openVideoDeviceLocked() local
1523 if (videoDevice->getName() == device->identifier.name) { in openVideoDeviceLocked()
1524 device->videoDevice = std::move(videoDevice); in openVideoDeviceLocked()
1525 if (device->enabled) { in openVideoDeviceLocked()
1526 registerVideoDeviceForEpollLocked(*device->videoDevice); in openVideoDeviceLocked()
1541 Device* device = getDeviceLocked(deviceId); in isDeviceEnabled() local
1542 if (device == nullptr) { in isDeviceEnabled()
1546 return device->enabled; in isDeviceEnabled()
1551 Device* device = getDeviceLocked(deviceId); in enableDevice() local
1552 if (device == nullptr) { in enableDevice()
1556 if (device->enabled) { in enableDevice()
1560 status_t result = device->enable(); in enableDevice()
1566 configureFd(device); in enableDevice()
1568 return registerDeviceForEpollLocked(device); in enableDevice()
1573 Device* device = getDeviceLocked(deviceId); in disableDevice() local
1574 if (device == nullptr) { in disableDevice()
1578 if (!device->enabled) { in disableDevice()
1582 unregisterDeviceFromEpollLocked(device); in disableDevice()
1583 return device->disable(); in disableDevice()
1592 Device* device = new Device(-1, ReservedInputDeviceId::VIRTUAL_KEYBOARD_ID, "<virtual>", in createVirtualKeyboardLocked() local
1594 device->classes = INPUT_DEVICE_CLASS_KEYBOARD in createVirtualKeyboardLocked()
1598 loadKeyMapLocked(device); in createVirtualKeyboardLocked()
1599 addDeviceLocked(device); in createVirtualKeyboardLocked()
1602 void EventHub::addDeviceLocked(Device* device) { in addDeviceLocked() argument
1603 mDevices.add(device->id, device); in addDeviceLocked()
1604 device->next = mOpeningDevices; in addDeviceLocked()
1605 mOpeningDevices = device; in addDeviceLocked()
1608 void EventHub::loadConfigurationLocked(Device* device) { in loadConfigurationLocked() argument
1609 device->configurationFile = getInputDeviceConfigurationFilePathByDeviceIdentifier( in loadConfigurationLocked()
1610 device->identifier, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION); in loadConfigurationLocked()
1611 if (device->configurationFile.empty()) { in loadConfigurationLocked()
1613 device->identifier.name.c_str()); in loadConfigurationLocked()
1615 status_t status = PropertyMap::load(String8(device->configurationFile.c_str()), in loadConfigurationLocked()
1616 &device->configuration); in loadConfigurationLocked()
1620 device->identifier.name.c_str()); in loadConfigurationLocked()
1625 bool EventHub::loadVirtualKeyMapLocked(Device* device) { in loadVirtualKeyMapLocked() argument
1629 path += device->identifier.getCanonicalName(); in loadVirtualKeyMapLocked()
1633 device->virtualKeyMap = VirtualKeyMap::load(path); in loadVirtualKeyMapLocked()
1634 return device->virtualKeyMap != nullptr; in loadVirtualKeyMapLocked()
1637 status_t EventHub::loadKeyMapLocked(Device* device) { in loadKeyMapLocked() argument
1638 return device->keyMap.load(device->identifier, device->configuration); in loadKeyMapLocked()
1641 bool EventHub::isExternalDeviceLocked(Device* device) { in isExternalDeviceLocked() argument
1642 if (device->configuration) { in isExternalDeviceLocked()
1644 if (device->configuration->tryGetProperty(String8("device.internal"), value)) { in isExternalDeviceLocked()
1648 return device->identifier.bus == BUS_USB || device->identifier.bus == BUS_BLUETOOTH; in isExternalDeviceLocked()
1651 bool EventHub::deviceHasMicLocked(Device* device) { in deviceHasMicLocked() argument
1652 if (device->configuration) { in deviceHasMicLocked()
1654 if (device->configuration->tryGetProperty(String8("audio.mic"), value)) { in deviceHasMicLocked()
1661 int32_t EventHub::getNextControllerNumberLocked(Device* device) { in getNextControllerNumberLocked() argument
1664 device->identifier.name.c_str()); in getNextControllerNumberLocked()
1672 void EventHub::releaseControllerNumberLocked(Device* device) { in releaseControllerNumberLocked() argument
1673 int32_t num = device->controllerNumber; in releaseControllerNumberLocked()
1674 device->controllerNumber= 0; in releaseControllerNumberLocked()
1681 void EventHub::setLedForControllerLocked(Device* device) { in setLedForControllerLocked() argument
1683 setLedStateLocked(device, ALED_CONTROLLER_1 + i, device->controllerNumber == i + 1); in setLedForControllerLocked()
1687 bool EventHub::hasKeycodeLocked(Device* device, int keycode) const { in hasKeycodeLocked() argument
1688 if (!device->keyMap.haveKeyLayout()) { in hasKeycodeLocked()
1693 device->keyMap.keyLayoutMap->findScanCodesForKey(keycode, &scanCodes); in hasKeycodeLocked()
1697 if (sc >= 0 && sc <= KEY_MAX && test_bit(sc, device->keyBitmask)) { in hasKeycodeLocked()
1705 status_t EventHub::mapLed(Device* device, int32_t led, int32_t* outScanCode) const { in mapLed() argument
1706 if (!device->keyMap.haveKeyLayout()) { in mapLed()
1711 if(device->keyMap.keyLayoutMap->findScanCodeForLed(led, &scanCode) != NAME_NOT_FOUND) { in mapLed()
1712 if(scanCode >= 0 && scanCode <= LED_MAX && test_bit(scanCode, device->ledBitmask)) { in mapLed()
1721 Device* device = getDeviceByPathLocked(devicePath); in closeDeviceByPathLocked() local
1722 if (device) { in closeDeviceByPathLocked()
1723 closeDeviceLocked(device); in closeDeviceByPathLocked()
1738 Device* device = mDevices.valueAt(i); in closeVideoDeviceByPathLocked() local
1739 if (device->videoDevice && device->videoDevice->getPath() == devicePath) { in closeVideoDeviceByPathLocked()
1740 unregisterVideoDeviceFromEpollLocked(*device->videoDevice); in closeVideoDeviceByPathLocked()
1741 device->videoDevice = nullptr; in closeVideoDeviceByPathLocked()
1758 void EventHub::closeDeviceLocked(Device* device) { in closeDeviceLocked() argument
1760 device->path.c_str(), device->identifier.name.c_str(), device->id, in closeDeviceLocked()
1761 device->fd, device->classes); in closeDeviceLocked()
1763 if (device->id == mBuiltInKeyboardId) { in closeDeviceLocked()
1765 device->path.c_str(), mBuiltInKeyboardId); in closeDeviceLocked()
1769 unregisterDeviceFromEpollLocked(device); in closeDeviceLocked()
1770 if (device->videoDevice) { in closeDeviceLocked()
1772 mUnattachedVideoDevices.push_back(std::move(device->videoDevice)); in closeDeviceLocked()
1775 releaseControllerNumberLocked(device); in closeDeviceLocked()
1777 mDevices.removeItem(device->id); in closeDeviceLocked()
1778 device->close(); in closeDeviceLocked()
1784 if (entry == device) { in closeDeviceLocked()
1795 ALOGI("Device %s was immediately closed after opening.", device->path.c_str()); in closeDeviceLocked()
1797 pred->next = device->next; in closeDeviceLocked()
1799 mOpeningDevices = device->next; in closeDeviceLocked()
1801 delete device; in closeDeviceLocked()
1805 device->next = mClosingDevices; in closeDeviceLocked()
1806 mClosingDevices = device; in closeDeviceLocked()
1926 const Device* device = mDevices.valueAt(i); in dump() local
1927 if (mBuiltInKeyboardId == device->id) { in dump()
1929 device->id, device->identifier.name.c_str()); in dump()
1931 dump += StringPrintf(INDENT2 "%d: %s\n", device->id, in dump()
1932 device->identifier.name.c_str()); in dump()
1934 dump += StringPrintf(INDENT3 "Classes: 0x%08x\n", device->classes); in dump()
1935 dump += StringPrintf(INDENT3 "Path: %s\n", device->path.c_str()); in dump()
1936 dump += StringPrintf(INDENT3 "Enabled: %s\n", toString(device->enabled)); in dump()
1937 dump += StringPrintf(INDENT3 "Descriptor: %s\n", device->identifier.descriptor.c_str()); in dump()
1938 dump += StringPrintf(INDENT3 "Location: %s\n", device->identifier.location.c_str()); in dump()
1939 dump += StringPrintf(INDENT3 "ControllerNumber: %d\n", device->controllerNumber); in dump()
1940 dump += StringPrintf(INDENT3 "UniqueId: %s\n", device->identifier.uniqueId.c_str()); in dump()
1943 device->identifier.bus, device->identifier.vendor, in dump()
1944 device->identifier.product, device->identifier.version); in dump()
1946 device->keyMap.keyLayoutFile.c_str()); in dump()
1948 device->keyMap.keyCharacterMapFile.c_str()); in dump()
1950 device->configurationFile.c_str()); in dump()
1952 toString(device->overlayKeyMap != nullptr)); in dump()
1954 if (device->videoDevice) { in dump()
1955 dump += device->videoDevice->dump() + "\n"; in dump()