Compare commits
No commits in common. "9bee6c0d9e7cc689afbf3fbe3ad14b0e40134416" and "a426233cb6cdbba7672845205aece1359b24c058" have entirely different histories.
9bee6c0d9e
...
a426233cb6
4 changed files with 1 additions and 80 deletions
|
@ -1,12 +0,0 @@
|
||||||
cc_binary {
|
|
||||||
name: "aguiledbeltctl",
|
|
||||||
system_ext_specific: true,
|
|
||||||
srcs: [
|
|
||||||
"aguiledbeltctl.cpp",
|
|
||||||
],
|
|
||||||
shared_libs: [
|
|
||||||
"vendor.mediatek.hardware.aguiledbelt@1.0",
|
|
||||||
"libutils",
|
|
||||||
"libhidlbase",
|
|
||||||
],
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
// vim: expandtab tabstop=4 shiftwidth=4
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <vendor/mediatek/hardware/aguiledbelt/1.0/IAguiLedBeltLight.h>
|
|
||||||
#include <vendor/mediatek/hardware/aguiledbelt/1.0/types.h>
|
|
||||||
|
|
||||||
using namespace ::vendor::mediatek::hardware::aguiledbelt::V1_0;
|
|
||||||
|
|
||||||
void print_usage() {
|
|
||||||
std::cerr << "Usage: aguiledbeltctl <light_bit_field> <r> <g> <b> <brightness>" << std::endl;
|
|
||||||
std::cerr << " aguiledbeltctl clear" << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
std::cerr << "<light_bit_field> should be a binary string where each bit (0 or 1) corresponds to the ON state of each physical light belt" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
auto service = IAguiLedBeltLight::getService();
|
|
||||||
|
|
||||||
if (argc <= 1) {
|
|
||||||
print_usage();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string arg1(argv[1]);
|
|
||||||
|
|
||||||
if (arg1 == "clear") {
|
|
||||||
service->setLedBeltAlwaysOnState(0, 0, 0, false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t light_id = std::stoi(std::string(argv[1]), nullptr, 2);
|
|
||||||
|
|
||||||
if (light_id > 31) {
|
|
||||||
std::cerr << "First argument should be a bit field with each bit corresponding to one physical light belt" << std::endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc < 6) {
|
|
||||||
print_usage();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t r = std::stoi(std::string(argv[2]));
|
|
||||||
uint32_t g = std::stoi(std::string(argv[3]));
|
|
||||||
uint32_t b = std::stoi(std::string(argv[4]));
|
|
||||||
|
|
||||||
if (r > 255 || g > 255 || b > 255) {
|
|
||||||
std::cerr << "Color channels must be bewteen 0 and 255" << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t brightness = std::stoi(std::string(argv[5]));
|
|
||||||
|
|
||||||
if (brightness > 100) {
|
|
||||||
std::cerr << "Brightness must be between 0 and 100" << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
service->setLedBeltAlwaysOnState(light_id, (r << 16) + (g << 8) + b, brightness, false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -78,7 +78,3 @@ ifeq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
|
||||||
PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||||
ro.adb.secure=1
|
ro.adb.secure=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Custom commands
|
|
||||||
PRODUCT_PACKAGES += \
|
|
||||||
aguiledbeltctl
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
package vendor.mediatek.hardware.aguiledbelt@1.0;
|
package vendor.mediatek.hardware.aguiledbelt@1.0;
|
||||||
|
|
||||||
import vendor.mediatek.hardware.aguiledbelt@1.0::ILedBeltLightCallback;
|
import vendor.mediatek.hardware.aguiledbelt@1.0::ILedBeltLightCallback;
|
||||||
import vendor.mediatek.hardware.aguiledbelt@1.0::LedBeltType;
|
|
||||||
|
|
||||||
interface IAguiLedBeltLight {
|
interface IAguiLedBeltLight {
|
||||||
setLedBeltLightMusicState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
setLedBeltLightMusicState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
||||||
setLedBeltLightAtomphereState(uint32_t lightId, uint32_t color, uint32_t brightness);
|
setLedBeltLightAtomphereState(uint32_t lightId, uint32_t color, uint32_t brightness);
|
||||||
setLedBeltLightState(LedBeltType type, uint32_t color, uint32_t brightness);
|
setLedBeltLightState(uint32_t type, uint32_t color, uint32_t brightness);
|
||||||
setLedBeltBrightnessState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
setLedBeltBrightnessState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
||||||
setLedBeltPatternSettingsState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
setLedBeltPatternSettingsState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
||||||
setLedBeltAlwaysOnState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
setLedBeltAlwaysOnState(uint32_t lightId, uint32_t color, uint32_t brightness, bool isRandom);
|
||||||
|
|
Loading…
Add table
Reference in a new issue