AnsweredAssumed Answered

Led for Button Touch

Question asked by Dinh Bang on Apr 22, 2014
Latest reply on May 5, 2014 by jamesbone

Hi everyone,

    I have integrated touch for my custom board, and i need integrate leds for button touch.  I have created dev file button-backlight in /sys/class/leds/ and add code as below to imx/lights/fsl_lights.c in HAL:

char const*const KEYBOARD_FILE
        = "/sys/class/leds/button-backlight/brightness";
...

static int
set_light_buttons(struct light_device_t *dev,
    struct light_state_t const *state)
{
    int err = 0;
    int on = is_lit(state);
    pthread_mutex_lock(&g_lock);
    err = write_int(KEYBOARD_FILE, on ? 255 : 0);
    pthread_mutex_unlock(&g_lock);


    return err;


}
...
if (0 == strcmp(LIGHT_ID_BACKLIGHT, name))
        set_light = set_light_backlight;
    else if (0 == strcmp(LIGHT_ID_KEYBOARD, name))
        set_light = set_light_keyboard;
    else if (0 == strcmp(LIGHT_ID_BUTTONS, name))
        set_light = set_light_buttons;
    else if (0 == strcmp(LIGHT_ID_BATTERY, name))
        set_light = set_light_battery;
    else if (0 == strcmp(LIGHT_ID_NOTIFICATIONS, name))
        set_light = set_light_notification;
    else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
        set_light = set_light_attention;
    else
        return -EINVAL;

But it do not work, i think platform of FSL is using LIGHT_ID_BATTERY and LIGHT_ID_BACKLIGHT, and I do not know where to configure for  LIGHT_ID_BUTTONS. If anyone has solution for this issue, let me know, thank you very much!

Outcomes