-
Notifications
You must be signed in to change notification settings - Fork 10
Button Backlight Control
Simao Gomes Viana edited this page Mar 2, 2018
·
9 revisions
NOTE: This does not affect XOS 8.0 and newer.
We made a new implementation of button backlight control.
It is relatively easy to set it up, here we'll show you how to do that.
First create the file xoshw/ButtonBacklightControl.java
in your device tree with following content:
/*
* Copyright (C) 2016-2017 halogenOS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.halogenos.hardware.buttons;
import org.halogenos.hardware.buttons.IButtonBacklightControl;
/**
* This class is supposed to control button backlight
*/
public class ButtonBacklightControl extends IButtonBacklightControl {
public ButtonBacklightControl() {
}
}
Inside of public ButtonBacklightControl()...
you will have to specify some things which are device-specific.
First of all, the CONTROL_TYPE
needs to be specified.
Control type | Description |
---|---|
CONTROL_TYPE = CONTROL_TYPE_FULL |
Brightness can be changed seamlessly. |
CONTROL_TYPE = CONTROL_TYPE_PARTIAL |
Only 3 brightness modes, On , Dimmed and Off . |
CONTROL_TYPE = CONTROL_TYPE_SWITCH |
Backlight can only be turned on and off, no brightness change is possible. |
CONTROL_TYPE = CONTROL_TYPE_NONE |
No backlight. If you don't have backlight, you don't need this file, CONTROL_TYPE_NONE would be default. |
Then you will have some optional things which you can also set:
Config variable | Description |
---|---|
BUTTON_BACKLIGHT_PATH |
The path to the button backlight control folder, where the control files are stored. Default is /sys/class/leds/button-backlight/ and should work on any device. |
BUTTON_BACKLIGHT_PATHS |
Array of paths |
MAXIMUM_BRIGHTNESS |
In case you have to specify the brightness manually, specify it here. This value is usually auto-detected. |
You can see an example here: https://github.com/halogenOS/android_device_oneplus_oneplus2/blob/XOS-7.1/xoshw/ButtonBacklightControl.java