Android设备,会导致key_down和key_up报告 当我按下一个键而不是在待机模式下释放时。 当我按下PHONE键时,即使我没有释放键,也会重新启动up事件。记录如下:
[ 422.143821] *****************[169: 1]
[ 422.161351] ltr559ALSPS 1-0023: ltr559 resume
[ 422.226537] PM: resume of devices complete after 96.311 msecs
[ 422.140462] EV_KEY KEY_PHONE DOWN
[ 422.140462] EV_SYN SYN_REPORT 00[ 422.440978] PM: suspend exit 2018-01-01 00:08:38.450639901 UTC
000000
[ 422.160697] EV_KEY KEY_PHONE UP
[ 422.160720] EV_SYN SYN_REPORT 00000001
[ 429.564297] *****************[169: 0]
关键驱动程序代码如下:
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) { const struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; if( (!bdata->key_pressed && !state) || (bdata->key_pressed && !!state) ) return; bdata->key_pressed = !!state; if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); } else { input_event(input, type, button->code, !!state); printk(KERN_ERR "*****************[%d: %d]\n", button->code, !!state); } input_sync(input); } static void gpio_keys_gpio_work_func(struct work_struct *work) { struct gpio_button_data *bdata = container_of(work, struct gpio_button_data, work); gpio_keys_gpio_report_event(bdata); if (bdata->button->wakeup && !bdata->key_pressed) pm_relax(bdata->input->dev.parent); } static void gpio_keys_gpio_timer(unsigned long _data) { struct gpio_button_data *bdata = (struct gpio_button_data *)_data; schedule_work(&bdata->work); } static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) { struct gpio_button_data *bdata = dev_id; BUG_ON(irq != bdata->irq); if (bdata->button->wakeup && !bdata->key_pressed) pm_stay_awake(bdata->input->dev.parent); if (bdata->timer_debounce) mod_timer(&bdata->timer, jiffies + msecs_to_jiffies(bdata->timer_debounce)); else schedule_work(&bdata->work); return IRQ_HANDLED; }
答案 0 :(得分:0)
我现在找到了根本原因。这是因为去抖时间太短了。