Re: [PATCH 2/3] platform/x86: system76_acpi: Replace Fn+F2 function for OLED models

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi


2021. szeptember 27., hétfő 23:06 keltezéssel, Tim Crawford írta:

> From: Jeremy Soller <jeremy@xxxxxxxxxxxx>
>
> System76 laptops models with OLED displays do not support the default
> Fn+F2 behavior of turning the embedded display on and off. Some models
> instead introduce a new notify event that is used to lock the screen so
> the OS will put the display in a low power state.
>
> Signed-off-by: Jeremy Soller <jeremy@xxxxxxxxxxxx>
> Signed-off-by: Tim Crawford <tcrawford@xxxxxxxxxxxx>
> ---
>  drivers/platform/x86/system76_acpi.c | 31 ++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>
> diff --git a/drivers/platform/x86/system76_acpi.c b/drivers/platform/x86/system76_acpi.c
> index 11f0e42386ba..06f6509980e2 100644
> --- a/drivers/platform/x86/system76_acpi.c
> +++ b/drivers/platform/x86/system76_acpi.c
> [...]
> @@ -514,6 +528,23 @@ static int system76_add(struct acpi_device *acpi_dev)
>  	if (IS_ERR(data->therm))
>  		return PTR_ERR(data->therm);
>
> +	data->input = devm_input_allocate_device(&acpi_dev->dev);
> +	if (!data->input)
> +		return -ENOMEM;
> +
> +	data->input->name = "System76 ACPI Hotkeys";
> +	data->input->phys = "system76_acpi/input0";
> +	data->input->id.bustype = BUS_HOST;
> +	data->input->dev.parent = &acpi_dev->dev;
> +	set_bit(EV_KEY, data->input->evbit);
> +	set_bit(KEY_SCREENLOCK, data->input->keybit);

You can use `input_set_capability()` instead of manually setting the bits.


> +
> +	err = input_register_device(data->input);
> +	if (err) {
> +		input_free_device(data->input);
> +		return err;
> +	}
> +
>  	return 0;
>  }
>
> --
> 2.31.1
>


Regards,
Barnabás Pőcze




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux