[U-Boot] [PATCH 04/28] input: Add the keycode translation tables separately

Simon Glass sjg at chromium.org
Mon Oct 19 01:17:14 CEST 2015


Hi Bin,

On 15 September 2015 at 00:11, Bin Meng <bmeng.cn at gmail.com> wrote:
> Hi Simon,
>
> On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass <sjg at chromium.org> wrote:
>> Require the caller to add the keycode translation tables separately so that
>> it can select which ones to use. In a later patch we will add the option to
>> add German tables.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>
>>  board/kosagi/novena/novena.c |  1 +
>>  drivers/input/cros_ec_keyb.c |  1 +
>>  drivers/input/input.c        | 21 ++++++++++++---------
>>  drivers/input/tegra-kbc.c    |  1 +
>>  include/input.h              | 10 ++++++++++
>>  5 files changed, 25 insertions(+), 9 deletions(-)
>>
>> diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
>> index 69f5be3..48cbb0f 100644
>> --- a/board/kosagi/novena/novena.c
>> +++ b/board/kosagi/novena/novena.c
>> @@ -88,6 +88,7 @@ int drv_keyboard_init(void)
>>                 debug("%s: Cannot set up input\n", __func__);
>>                 return -1;
>>         }
>> +       input_add_tables(&button_input);
>>         button_input.read_keys = novena_gpio_button_read_keys;
>>
>>         error = input_stdio_register(&dev);
>> diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
>> index a31aa77..eaab86f 100644
>> --- a/drivers/input/cros_ec_keyb.c
>> +++ b/drivers/input/cros_ec_keyb.c
>> @@ -255,6 +255,7 @@ int drv_keyboard_init(void)
>>                 return -1;
>>         }
>>         config.input.read_keys = cros_ec_kbc_check;
>> +       input_add_tables(&config.input);
>>
>>         memset(&dev, '\0', sizeof(dev));
>>         strcpy(dev.name, "cros-ec-keyb");
>> diff --git a/drivers/input/input.c b/drivers/input/input.c
>> index 9033935..0f11ae6 100644
>> --- a/drivers/input/input.c
>> +++ b/drivers/input/input.c
>> @@ -457,19 +457,22 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms,
>>         config->repeat_rate_ms = repeat_rate_ms;
>>  }
>>
>> +int input_add_tables(struct input_config *config)
>> +{
>> +       input_add_table(config, -1, -1,
>> +                       kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate));
>> +       input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
>> +                       kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate));
>> +       input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
>> +                       kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate));
>
> Should we return error codes here? In previous patch, we've added -ENOSPC.

It can't actually happen since there is always enough space for 3
items and this is called at the start. Still it looks strange to not
check errors so I will add it.

[snip]

Regards,
Simon


More information about the U-Boot mailing list