diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2014-06-26 16:23:56 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2014-06-26 16:23:56 +0200 |
commit | e2359405dd96735749906e63ba64d3b13ec7764e (patch) | |
tree | 6e8d91e54c209ecb9e5884ff75017d1244f5aa46 | |
parent | 13066d8de9ae8456571e6640a37ea249b1147363 (diff) | |
download | device_goldelico_gta04-e2359405dd96735749906e63ba64d3b13ec7764e.zip device_goldelico_gta04-e2359405dd96735749906e63ba64d3b13ec7764e.tar.gz device_goldelico_gta04-e2359405dd96735749906e63ba64d3b13ec7764e.tar.bz2 |
lights: Properly handle provided colorsreplicant-4.2-0002
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r-- | lights/gta04_lights.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lights/gta04_lights.c b/lights/gta04_lights.c index b01c1fe..845a17d 100644 --- a/lights/gta04_lights.c +++ b/lights/gta04_lights.c @@ -139,9 +139,9 @@ int gta04_lights_set_light_notifications(struct light_device_t *device, if (state == NULL) return -EINVAL; - // GTA04 only has red and green - red = state->color & 0x00ff0000; - green = state->color & 0x0000ff00; + // GTA04 only has red and green: blue is merged to green + red = (state->color & 0x00ff0000) >> 16; + green = (state->color & 0x0000ff00) >> 8 | (state->color & 0x000000ff); pthread_mutex_lock(&lights_mutex); @@ -173,9 +173,9 @@ int gta04_lights_set_light_battery(struct light_device_t *device, if (state == NULL) return -EINVAL; - // GTA04 only has red and green - red = state->color & 0x00ff0000; - green = state->color & 0x0000ff00; + // GTA04 only has red and green: blue is merged to green + red = (state->color & 0x00ff0000) >> 16; + green = (state->color & 0x0000ff00) >> 8 | (state->color & 0x000000ff); pthread_mutex_lock(&lights_mutex); |