怎样添加一个自定义的LED灯?
1. 修改如下两个文件:alps/mediatek/custom/common/kernel/leds/inc/cust_leds.h
-----------------------------------------------------------
enum mt65xx_led_type
{
MT65XX_LED_TYPE_RED = 0,
... ...
MT65XX_LED_TYPE_LCD,
MT65XX_LED_TYPE_ABC, // Add a new LED type
MT65XX_LED_TYPE_TOTAL,
};
alps/mediatek/custom/YOUR_PRJ/kernel/leds/mt65xx/cust_leds.c
----------------------------------------------------------------
static struct cust_mt65xx_led cust_led_list[MT65XX_LED_TYPE_TOTAL] = {
{"red", MT65XX_LED_MODE_NONE, -1,{0}},
... ...
{"lcd-backlight", MT65XX_LED_MODE_CUST, (int)Cust_SetBacklight,{0}},
// Set LED params, Please refer to <Driver all in One>
{"abc-backlight", MT65XX_LED_MODE_CUST, (int)Cust_SetBacklight_abc,{0}},
};
www.zzzyk.com
2. 重新编译后,在Kernel log 里可以看到如下信息:
--------------------------------------------------------------------
<7>[ 1.021967] (0)Registered led device: button-backlight
<7>[ 1.022013] (0)Registered led device: lcd-backlight
<7>[ 1.022072] (0)Registered led device: abc-backlight // <------- !
3. 用如下命令查看新LED的 sysfs节点
adb shell ls /sys/devices/platform/leds-mt65xx/leds/
------------------------------------------------------------------------
abc-backlight
button-backlight
lcd-backlight
补充:移动开发 , Android ,