Problems caused by the failure to implement the brightness_get function in the LED driver.

Source: Internet
Author: User

Test found:

/Sys/devices/platform/keyboard-backlight/LEDs/keyboard-Backlight
/Sys/class/LEDs/keyboard-Backlight
Cat brightness is always 0 at each boot, regardless of whether the LED is on.
The status of each boot keyboard led depends on the status of the last shutdown.

Driver path kernel/Drivers/LEDs/leds-sprd-kb.c

The driver does not implement the brightness_get callback function:
LED-> cdev. brightness_get = NULL;

This causes no LED-> cdev. before brightness_set is called, the value of cat brightness is always 0, and only once led-> cdev. after brightness_set and then Cat brightness, you can get the value you just set.
Why can't I get the value for the first time, but it can be obtained later? This takes a look at the implementation of these sys files, as well as the corresponding show and store functions, see: kernel/Drivers/LEDs/leds-class.c

Static ssize_t led_brightness_show (struct device * Dev,
Struct device_attribute * ATTR, char * BUF)
{
Struct led_classdev * led_cdev = dev_get_drvdata (Dev );
/* No lock needed for this */
Led_update_brightness (led_cdev );
Return sprintf (BUF, "% u \ n", led_cdev-> brightness );
}
The led_update_brightness function updates brightness Based on the get function implemented by the driver, but our driver does not implement this function. Therefore, this update function does not work. So brightness is always 0 at the first read.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.