Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f43d9ec0 authored by Ike Panhc's avatar Ike Panhc Committed by Matthew Garrett
Browse files

ideapad: add event for Novo key



Novo key is the Lenovo define key on every ideapads, which has two
definition. Long press and short click. Driver will report
KEY_PROG1 on short click and KEY_PROG2 when long press.

On pre-install OS for ideapads there are application waiting for
the event and there is no such application for Linux yet, so I
think to report KEY_PROG is fine in anyway.

Also change the scancode from hex to decimal because they are
related to vpc bit in notify function which is in decimal.

Signed-off-by: default avatarIke Panhc <ike.pan@canonical.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 923de84a
Loading
Loading
Loading
Loading
+19 −2
Original line number Original line Diff line number Diff line
@@ -386,8 +386,10 @@ static void ideapad_platform_exit(struct ideapad_private *priv)
 * input device
 * input device
 */
 */
static const struct key_entry ideapad_keymap[] = {
static const struct key_entry ideapad_keymap[] = {
	{ KE_KEY, 0x06, { KEY_SWITCHVIDEOMODE } },
	{ KE_KEY, 6,  { KEY_SWITCHVIDEOMODE } },
	{ KE_KEY, 0x0D, { KEY_WLAN } },
	{ KE_KEY, 13, { KEY_WLAN } },
	{ KE_KEY, 16, { KEY_PROG1 } },
	{ KE_KEY, 17, { KEY_PROG2 } },
	{ KE_END, 0 },
	{ KE_END, 0 },
};
};


@@ -442,6 +444,18 @@ static void ideapad_input_report(struct ideapad_private *priv,
	sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
	sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
}
}


static void ideapad_input_novokey(struct ideapad_private *priv)
{
	unsigned long long_pressed;

	if (read_ec_data(ideapad_handle, VPCCMD_R_NOVO, &long_pressed))
		return;
	if (long_pressed)
		ideapad_input_report(priv, 17);
	else
		ideapad_input_report(priv, 16);
}

/*
/*
 * backlight
 * backlight
 */
 */
@@ -634,6 +648,9 @@ static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
			case 4:
			case 4:
				ideapad_backlight_notify_brightness(priv);
				ideapad_backlight_notify_brightness(priv);
				break;
				break;
			case 3:
				ideapad_input_novokey(priv);
				break;
			case 2:
			case 2:
				ideapad_backlight_notify_power(priv);
				ideapad_backlight_notify_power(priv);
				break;
				break;