平台 | 内核版本 |
---|---|
输入系统框架 | 输入设备配置文件(idc文件) |
文章目录
输入设备配置文件(idc文件)
文件目录:frameworks/native/services/inputflinger/EventHub.cpp
status_t EventHub::openDeviceLocked(const char *devicePath) {
int fd = open(devicePath, O_RDWR | O_CLOEXEC);
// Get device name
ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer);
// Get device driver version.
ioctl(fd, EVIOCGVERSION, &driverVersion);
//Get device identifier.
ioctl(fd, EVIOCGID, &inputId);
// Get device physical location.
ioctl(fd, EVIOCGPHYS(sizeof(buffer) - 1), &buffer)
// Get device unique id.
ioctl(fd, EVIOCGUNIQ(sizeof(buffer)
// Allocate device. (The device object takes ownership of the fd at this point.)
int32_t deviceId = mNextDeviceId++;
// Load the configuration file for the device.
loadConfigurationLocked(device);
}
代码通过loadConfigurationLocked
来加载kl/kcm
文件
void EventHub::loadConfigurationLocked(Device* device) {
//对应 Deivce的成员String8 configurationFile
device->configurationFile = getInputDeviceConfigurationFilePathByDeviceIdentifier(
device->identifier, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION);
if (device->configurationFile.isEmpty()) {
ALOGD("No input device configuration file found for device '%s'.",
device->identifier.name.string());
} else {
//对应Device的成员PropertyMap* configuration
status_t status = PropertyMap::load(device->configurationFile,
&device->configuration);
if (status) {
ALOGE("Error loading input device configuration file for device '%s'. "
"Using default configuration.",
device->identifier.name.string());
}
}
}