Led for Button Touch

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Led for Button Touch

960 Views
dinhbang
Contributor II

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!

Labels (1)
0 Kudos
3 Replies

708 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dinh

what processor and what BSP are you using ?

0 Kudos

708 Views
dinhbang
Contributor II

Hi chipexpert, thanks for reply, i use imx6q and BSP is android 4.2

0 Kudos

708 Views
jamesbone
NXP TechSupport
NXP TechSupport

Dear Dinh,

Let me give you some resume about how the inputs are working in Android, I think you should use the events to call the led ligth from there. Please see the attach


Have a great day,
Jaime

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos