Re: [PATCH 2/2] platform/x86: system76_acpi: Add input driver

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

 



> [...]
> +static void input_key(struct system76_data *data, unsigned int code)
> +{
> +	input_report_key(data->input, code, 1);
> +	input_sync(data->input);
> +
> +	input_report_key(data->input, code, 0);
> +	input_sync(data->input);
> +}
> +
>  // Handle ACPI notification
>  static void system76_notify(struct acpi_device *acpi_dev, u32 event)
>  {
> @@ -459,6 +470,9 @@ static void system76_notify(struct acpi_device *acpi_dev, u32 event)
>  	case 0x84:
>  		kb_led_hotkey_color(data);
>  		break;
> +	case 0x85:
> +		input_key(data, KEY_SCREENLOCK);
> +		break;
>  	}
>  }
>
> @@ -524,6 +538,21 @@ 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);
> +	err = input_register_device(data->input);
> +	if (err) {
> +		input_free_device(data->input);
> +		return err;
> +	}
> +
>  	return 0;
>  }

Hi,

wouldn't sparse_keymap be a better choice here?


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