[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,8 +1,8 @@
<services>
<service name="tar_git">
- <param name="url">https://github.com/mer-hybris/mce-plugin-libhybris.git</param>
+ <param name="url">https://github.com/Sailfish-On-Vince/mce-plugin-libhybris.git</param>
<param name="branch">master</param>
- <param name="revision">HEAD</param>
+ <param name="revision">51ecaa4311d6048078ad111a75d8198efa6fd938</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/.depend
^
|
@@ -182,6 +182,24 @@
sysfs-led-util.h\
sysfs-val.h\
+sysfs-led-vince.o:\
+ sysfs-led-vince.c\
+ plugin-config.h\
+ plugin-logging.h\
+ sysfs-led-vince.h\
+ sysfs-led-main.h\
+ sysfs-led-util.h\
+ sysfs-val.h\
+
+sysfs-led-vince.pic.o:\
+ sysfs-led-vince.c\
+ plugin-config.h\
+ plugin-logging.h\
+ sysfs-led-vince.h\
+ sysfs-led-main.h\
+ sysfs-led-util.h\
+ sysfs-val.h\
+
sysfs-led-main.o:\
sysfs-led-main.c\
plugin-config.h\
@@ -192,6 +210,7 @@
sysfs-led-f5121.h\
sysfs-led-hammerhead.h\
sysfs-led-htcvision.h\
+ sysfs-led-vince.h\
sysfs-led-main.h\
sysfs-led-redgreen.h\
sysfs-led-util.h\
@@ -208,6 +227,7 @@
sysfs-led-f5121.h\
sysfs-led-hammerhead.h\
sysfs-led-htcvision.h\
+ sysfs-led-vince.h\
sysfs-led-main.h\
sysfs-led-redgreen.h\
sysfs-led-util.h\
@@ -287,4 +307,3 @@
sysfs-val.c\
plugin-logging.h\
sysfs-val.h\
-
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/Makefile
^
|
@@ -132,6 +132,7 @@
hybris_OBJS += sysfs-led-util.pic.o
hybris_OBJS += sysfs-led-vanilla.pic.o
hybris_OBJS += sysfs-led-white.pic.o
+hybris_OBJS += sysfs-led-vince.pic.o
hybris_OBJS += sysfs-val.pic.o
hybris.so : LDLIBS += -lhardware -lm
|
[-]
[+]
|
Added |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/inifiles/60-vince.ini
^
|
@@ -0,0 +1,18 @@
+[LEDConfigHybris]
+
+# Choose vince backend
+BackEnd=vince
+
+# Configure base directories for white channels
+LedDirectory=/sys/class/leds/green
+
+# Built-in defaults for directory relative paths
+BrightnessFile=brightness
+MaxBrightnessFile=max_brightness
+BlinkFile=blink
+
+# Optional channel specific overrides
+LedBrightnessFile=/sys/class/leds/green/brightness
+LedMaxBrightnessFile=/sys/class/leds/green/max_brightness
+LedBlinkFile=/sys/class/leds/green/blink
+# ... and similarly for Green and Blue.
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/sysfs-led-main.c
^
|
@@ -32,6 +32,7 @@
#include "sysfs-led-binary.h"
#include "sysfs-led-redgreen.h"
#include "sysfs-led-white.h"
+#include "sysfs-led-vince.h"
#include "plugin-logging.h"
#include "plugin-config.h"
@@ -300,6 +301,10 @@
/* The binary backend needs just one directory
* that has 'brightness' control file. */
{ "binary", led_control_binary_probe },
+
+ /* The vince requires 'brightness', 'max_brightness' and 'blink'
+ * control files to be present for red, green and blue channels. */
+ { "vince", led_control_vince_probe },
};
bool ack = false;
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/sysfs-led-redgreen.c
^
|
@@ -277,7 +277,7 @@
/* We can use sw breathing logic to simulate hw blinking */
self->can_breathe = true;
- self->breath_type = LED_RAMP_HARD_STEP;
+ // self->breath_type = LED_RAMP_HARD_STEP;
if( self->use_config )
res = led_control_redgreen_dynamic_probe(channel);
|
[-]
[+]
|
Added |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/sysfs-led-vince.c
^
|
@@ -0,0 +1,272 @@
+/** @file sysfs-led-vince.c
+ *
+ * mce-plugin-libhybris - Libhybris plugin for Mode Control Entity
+ * <p>
+ * Copyright (C) 2017 Jolla Ltd.
+ * <p>
+ * @author Simo Piiroinen <simo.piiroinen@jollamobile.com>
+ * @author BirdZhang <0312birdzhang@gmail.com>
+ *
+ * mce-plugin-libhybris is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License.
+ *
+ * mce-plugin-libhybris is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with mce-plugin-libhybris; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* ========================================================================= *
+ * RGB led control: vince backend
+ *
+ * Three channels, all of which:
+ * - must have 'brightness' control file
+ * - must have 'max_brightness' control file
+ * - must have 'blink' control file
+ *
+ * Assumptions built into code:
+ * - writing to 'blink' affects 'brightness' control too and vice versa
+ * ========================================================================= */
+
+#include "sysfs-led-vince.h"
+#include "sysfs-led-util.h"
+#include "sysfs-val.h"
+#include "plugin-config.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include <glib.h>
+
+/* ========================================================================= *
+ * PROTOTYPES
+ * ========================================================================= */
+
+typedef struct
+{
+ const char *max_brightness; // R
+ const char *brightness; // W
+} led_paths_vince_t;
+
+typedef struct
+{
+ sysfsval_t *cached_max_brightness;
+ sysfsval_t *cached_brightness;
+} led_channel_vince_t;
+
+/* ------------------------------------------------------------------------- *
+ * ONE_CHANNEL
+ * ------------------------------------------------------------------------- */
+
+static void led_channel_vince_init (led_channel_vince_t *self);
+static void led_channel_vince_close (led_channel_vince_t *self);
+static bool led_channel_vince_probe (led_channel_vince_t *self, const led_paths_vince_t *path);
+static void led_channel_vince_set_value (const led_channel_vince_t *self, int value);
+
+/* ------------------------------------------------------------------------- *
+ * ALL_CHANNELS
+ * ------------------------------------------------------------------------- */
+
+static void led_control_vince_map_color (int r, int g, int b, int *white);
+static void led_control_vince_value_cb (void *data, int r, int g, int b);
+static void led_control_vince_close_cb (void *data);
+
+bool led_control_vince_probe (led_control_t *self);
+
+/* ========================================================================= *
+ * ONE_CHANNEL
+ * ========================================================================= */
+
+static void
+led_channel_vince_init(led_channel_vince_t *self)
+{
+ self->cached_max_brightness = sysfsval_create();
+ self->cached_brightness = sysfsval_create();
+}
+
+static void
+led_channel_vince_close(led_channel_vince_t *self)
+{
+ sysfsval_delete(self->cached_max_brightness),
+ self->cached_max_brightness = 0;
+
+ sysfsval_delete(self->cached_brightness),
+ self->cached_brightness = 0;
+}
+
+static bool
+led_channel_vince_probe(led_channel_vince_t *self,
+ const led_paths_vince_t *path)
+{
+ bool res = false;
+
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
+ goto cleanup;
+
+ if( !sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
+ goto cleanup;
+
+ sysfsval_refresh(self->cached_max_brightness);
+
+ if( sysfsval_get(self->cached_max_brightness) <= 0 )
+ goto cleanup;
+
+ res = true;
+
+cleanup:
+
+ /* Always close the max_brightness file */
+ sysfsval_close(self->cached_max_brightness);
+
+ /* On failure close the other files too */
+ if( !res )
+ {
+ sysfsval_close(self->cached_brightness);
+ }
+
+ return res;
+}
+
+static void
+led_channel_vince_set_value(const led_channel_vince_t *self, int value)
+{
+ value = led_util_scale_value(value,
+ sysfsval_get(self->cached_max_brightness));
+ sysfsval_set(self->cached_brightness, value);
+}
+
+/* ========================================================================= *
+ * ALL_CHANNELS
+ * ========================================================================= */
+
+#define VINCE_CHANNELS 1
+
+static void
+led_control_vince_map_color(int r, int g, int b, int *white)
+{
+ /* Use maximum value from requested RGB value */
+ if( r < g ) r = g;
+ if( r < b ) r = b;
+ *white = r;
+}
+
+static void
+led_control_vince_value_cb(void *data, int r, int g, int b)
+{
+ const led_channel_vince_t *channel = data;
+
+ int white = 0;
+ led_control_vince_map_color(r, g, b, &white);
+
+ led_channel_vince_set_value(channel + 0, white);
+}
+
+static void
+led_control_vince_close_cb(void *data)
+{
+ led_channel_vince_t *channel = data;
+ led_channel_vince_close(channel + 0);
+}
+static bool
+led_control_vince_static_probe(led_channel_vince_t *channel)
+{
+ /** Sysfs control paths for vince leds */
+ static const led_paths_vince_t paths[][VINCE_CHANNELS] =
+ {
+ // "vince (Xiaomi Redmi note 5/5 plus)"
+ {
+ {
+ .max_brightness = "/sys/class/leds/green/max_brightness",
+ .brightness = "/sys/class/leds/green/brightness",
+ },
+ },
+ };
+
+ bool ack = false;
+
+ for( size_t i = 0; i < G_N_ELEMENTS(paths); ++i ) {
+ if( (ack = led_channel_vince_probe(channel+0, &paths[i][0])) )
+ break;
+ }
+
+ return ack;
+}
|
[-]
[+]
|
Added |
_service:tar_git:mce-plugin-libhybris-1.12.2.tar.bz2/sysfs-led-vince.h
^
|
@@ -0,0 +1,31 @@
+/** @file sysfs-led-vince.h
+ *
+ * mce-plugin-libhybris - Libhybris plugin for Mode Control Entity
+ * <p>
+ * Copyright (C) 2017 Jolla Ltd.
+ * <p>
+ * @author Simo Piiroinen <simo.piiroinen@jollamobile.com>
+ *
+ * mce-plugin-libhybris is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License.
+ *
+ * mce-plugin-libhybris is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with mce-plugin-libhybris; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef SYSFS_LED_VINCE_H_
+# define SYSFS_LED_VINCE_H_
+
+# include "sysfs-led-main.h"
+
+bool led_control_vince_probe(led_control_t *self);
+
+#endif /* SYSFS_LED_VINCE_H_ */
|