從 probe (), register 的 input value 只有:
input->name = "mxc_power_key";
input->lphys = "mxcpwrkey/input0";
input->id.bustype = BUS_HOST;
input->evbit[0] = BIT_MASK(EV_KEY);
mxc_pwrkey->value = pdata->key_value;
mxc_pwrkey->get_status = pdata->get_key_status;
mxc_pwrkey->input = input;
pdata->register_pwrkey(pwrkey_event_handler);
platform driver name:
static struct platform_driver mxcpwrkey_driver = {
.driver = {
.name = "mxcpwrkey",
},
.probe = mxcpwrkey_probe,
.remove = mxcpwrkey_remove,
};
找一下 mxcpwrkey 對應的 platform device (data): arch/arm/mach-mx5/devices.c:
struct platform_device mxc_powerkey_device = {
.name = "mxcpwrkey",
.id = 0,
};
所以要找一下 register mxc_powerkey_device 時的 data: arch/arm/mach-mx5/mx51_babbage.c
mxc_register_device(&mxc_powerkey_device, &pwrkey_data);
也就是 . pwrkey_data:
static struct power_key_platform_data pwrkey_data = {
.key_value = KEY_F4,
.register_pwrkey = mxc_register_powerkey,
.get_key_status = mxc_pwrkey_getstatus,
};
找到!
PowerKey 送的是 KEY_F4
這個 constant 宣告在 include/linux/input.h
#define KEY_F4 62
也就是說,當 power button 被按下, input event 讀到的會是 62
Android InputReader 讀到後,會先依照 device/fsl/imx51_bbg/mxckpd.kl :
key 62 ENDCALL WAKE
key 4 POWER WAKE
會轉成 ENDCALL
再依照這個字串table base/include/ui/KeycodeLabel.h 轉成 數值:
{ "ENDCALL", 6 },
{ "POWER", 26 },
所以在 app 的 onKeyDown( ) 收到的會是 "6"
沒有留言:
張貼留言