[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -3,6 +3,6 @@
<service name="tar_git">
<param name="url">https://github.com/nemomobile/mce-plugin-libhybris.git</param>
<param name="branch">master</param>
- <param name="revision">1fb45cdd5e3a07f5b69b0593484e387ed1df8f75</param>
+ <param name="revision">8c706d22ff2e82d08ea7be5e227f266c22aebc6f</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.4.0.tar.bz2/hybris.c
^
|
@@ -833,11 +833,11 @@
{
const char *name;
void *data;
+ bool can_breathe;
void (*enable)(void *data, bool enable);
void (*blink)(void *data, int on_ms, int off_ms);
void (*value)(void *data, int r, int g, int b);
void (*close)(void *data);
-
};
static bool led_control_vanilla_probe(led_control_t *self);
@@ -910,6 +910,9 @@
self->blink = 0;
self->value = 0;
self->close = 0;
+
+ /* Assume that it is exceptional if sw breathing can't be supported */
+ self->can_breathe = true;
}
/** Set RGB LED enabled/disable
@@ -943,6 +946,16 @@
led_control_hammerhead_probe(self));
}
+/** Query if backend can support sw breathing
+ *
+ * @return true if breathing can be enabled, false otherwise
+ */
+static bool
+led_control_can_breathe(const led_control_t *self)
+{
+ return self->can_breathe;
+}
+
/* ------------------------------------------------------------------------- *
* RGB led control: default backend
* ------------------------------------------------------------------------- */
@@ -1124,6 +1137,10 @@
self->value = led_control_hammerhead_value_cb;
self->close = led_control_hammerhead_close_cb;
+ /* Changing led parameters is so slow and consumes so much
+ * cpu cycles that we just can't have breathing available */
+ self->can_breathe = false;
+
for( size_t i = 0; i < G_N_ELEMENTS(paths) ; ++i )
{
if( led_state_hammerhead_probe(&state[0], &paths[i][0]) &&
@@ -1738,14 +1755,37 @@
return ack;
}
+/** Query if currently active led backend can support breathing
+ *
+ * @return true if breathing can be requested, false otherwise
+ */
+bool
+mce_hybris_indicator_can_breathe(void)
+{
+ if( !led_ctrl_uses_sysfs ) {
+ /* We can't know how access via hybris behaves, so
+ * err on the safe side and assume that breathing is not ok */
+ return false;
+ }
+
+ return led_control_can_breathe(&led_control);
+}
+
/** Enable/disable sw breathing
*
* @param enable true to enable sw breathing, false to disable
*/
void mce_hybris_indicator_enable_breathing(bool enable)
{
- if( !led_ctrl_uses_sysfs ) {
- // no breathing control via hybris api
+ if( !mce_hybris_indicator_can_breathe() ) {
+ if( enable ) {
+ static bool once = false;
+ if( !once ) {
+ once = true;
+ mce_log(LOG_ERR, "sw breathing was requested even"
+ " though it can't be supported");
+ }
+ }
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.4.0.tar.bz2/mce-hybris.h
^
|
@@ -58,6 +58,7 @@
bool mce_hybris_indicator_set_pattern(int r, int g, int b, int ms_on, int ms_off);
void mce_hybris_indicator_enable_breathing(bool enable);
bool mce_hybris_indicator_set_brightness(int level);
+bool mce_hybris_indicator_can_breathe(void);
/* - - - - - - - - - - - - - - - - - - - *
* proximity sensor
|