[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/nemomobile/mce-plugin-libhybris.git</param>
<param name="branch">master</param>
- <param name="revision">3e4e459f47f5cb995172e4141834b89012024039</param>
+ <param name="revision"></param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/hybris-fb.c
^
|
@@ -27,7 +27,9 @@
#include "plugin-api.h"
#include <system/window.h>
+#include <hardware/gralloc.h>
#include <hardware/fb.h>
+#include <hardware/hwcomposer.h>
/* ========================================================================= *
* PROTOTYPES
@@ -40,9 +42,6 @@
bool hybris_plugin_fb_load (void);
void hybris_plugin_fb_unload (void);
-static int hybris_plugin_fb_open_device (struct framebuffer_device_t **pdevice);
-static void hybris_plugin_fb_close_device (struct framebuffer_device_t **pdevice);
-
/* ------------------------------------------------------------------------- *
* FRAMEBUFFER_DEVICE
* ------------------------------------------------------------------------- */
@@ -58,6 +57,9 @@
/** Handle for libhybris framebuffer plugin */
static const struct hw_module_t *hybris_plugin_fb_handle = 0;
+/** Handle for libhybris hw composer plugin */
+static const struct hw_module_t *hybris_plugin_hwc_handle = 0;
+
/** Load libhybris framebuffer plugin
*
* @return true on success, false on failure
@@ -73,19 +75,33 @@
done = true;
- hw_get_module(GRALLOC_HARDWARE_FB0, &hybris_plugin_fb_handle);
-
+ /* Load framebuffer module */
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &hybris_plugin_fb_handle);
if( !hybris_plugin_fb_handle ) {
- mce_log(LL_WARN, "failed to open frame buffer module");
- goto cleanup;
+ mce_log(LL_DEBUG, "failed to open frame buffer module");
}
- mce_log(LL_DEBUG, "hybris_plugin_fb_handle = %p",
- hybris_plugin_fb_handle);
+ /* Load hw composer module */
+#ifdef HWC_DEVICE_API_VERSION_1_0
+ hw_get_module(HWC_HARDWARE_MODULE_ID, &hybris_plugin_hwc_handle);
+ if( !hybris_plugin_hwc_handle ) {
+ mce_log(LL_DEBUG, "failed to open hw composer module");
+ }
+#else
+ /* When compiling with really old hwcompser.h in place, assume
+ * that the target device is not going to have the hwc methods we
+ * are interested in -> skip module load -> hwc device loading and
+ * related cleanup turns into a nop without further #ifdeffing.
+ */
+#endif
+
+ /* Both fb and hwc are optional, but having neither is unexpected */
+ if( !hybris_plugin_fb_handle && !hybris_plugin_hwc_handle ) {
+ mce_log(LL_WARN, "could not open neither fb nor hwc module");
+ }
cleanup:
-
- return hybris_plugin_fb_handle != 0;
+ return hybris_plugin_fb_handle || hybris_plugin_hwc_handle;
}
/** Unload libhybris framebuffer plugin
@@ -93,55 +109,13 @@
void
hybris_plugin_fb_unload(void)
{
- /* Close devices related to the plugin */
+ /* Close open devices */
hybris_device_fb_quit();
- /* actually unload the module */
+ /* Unload modules */
// FIXME: how to unload libhybris modules?
-}
-
-/** Convenience function for opening frame buffer device
- *
- * Similar to what we might or might not have available from hardware/fb.h
- */
-static int
-hybris_plugin_fb_open_device(struct framebuffer_device_t ** pdevice)
-{
- int ack = false;
-
- if( !hybris_plugin_fb_load() ) {
- goto cleanup;
- }
-
- const struct hw_module_t *mod = hybris_plugin_fb_handle;
- const char *id = GRALLOC_HARDWARE_FB0;
- struct hw_device_t *dev = 0;
-
- if( !mod->methods->open(mod, id, &dev) ) {
- goto cleanup;
- }
-
- *pdevice = (struct framebuffer_device_t*)dev;
-
- ack = true;
-
-cleanup:
-
- return ack;
-}
-
-/** Convenience function for closing frame buffer device
- *
- * Similar to what we might or might not have available from hardware/fb.h
- */
-static void
-hybris_plugin_fb_close_device(struct framebuffer_device_t **pdevice)
-{
- struct framebuffer_device_t *device;
-
- if( (device = *pdevice) ) {
- *pdevice = 0, device->common.close(&device->common);
- }
+ hybris_plugin_fb_handle = 0;
+ hybris_plugin_hwc_handle = 0;
}
/* ========================================================================= *
@@ -149,7 +123,14 @@
* ========================================================================= */
/** Pointer to libhybris frame buffer device object */
-static struct framebuffer_device_t *hybris_device_fb_handle = 0;
+static framebuffer_device_t *hybris_device_fb_handle = 0;
+
+/** Pointer to libhybris frame buffer device object */
+#ifdef HWC_DEVICE_API_VERSION_1_0
+static hwc_composer_device_1_t *hybris_device_hwc_handle = 0;
+#else
+static hwc_composer_device_t *hybris_device_hwc_handle = 0;
+#endif
/** Initialize libhybris frame buffer device object
*
@@ -158,6 +139,7 @@
bool
hybris_device_fb_init(void)
{
+ static bool ack = false;
static bool done = false;
if( done ) {
@@ -166,19 +148,70 @@
done = true;
- hybris_plugin_fb_open_device(&hybris_device_fb_handle);
-
- if( !hybris_device_fb_handle ) {
- mce_log(LL_ERR, "failed to open framebuffer device");
+ if( !hybris_plugin_fb_load() ) {
goto cleanup;
}
- mce_log(LL_DEBUG, "hybris_device_fb_handle = %p",
- hybris_device_fb_handle);
+ /* Open frame buffer device */
+ if( hybris_plugin_fb_handle ) {
+ hybris_plugin_fb_handle->methods->open(hybris_plugin_fb_handle,
+ GRALLOC_HARDWARE_FB0,
+ (hw_device_t**)&hybris_device_fb_handle);
+ if( !hybris_device_fb_handle ) {
+ mce_log(LL_WARN, "failed to open frame buffer device");
+ }
+ }
+
+ /* Open hw composer device */
+ if( hybris_plugin_hwc_handle ) {
+ hybris_plugin_hwc_handle->methods->open(hybris_plugin_hwc_handle,
+ HWC_HARDWARE_COMPOSER,
+ (hw_device_t**)&hybris_device_hwc_handle);
+ if( !hybris_device_hwc_handle ) {
+ mce_log(LL_WARN, "failed to open hw composer device");
+ }
+ }
+
+ /* What we'd like to use is:
+ *
+ * 1. hwc_dev->setPowerMode()
+ * 2. hwc_dev->blank()
+ * 2. fb_dev->enableScreen()
+ *
+ * While all are optional, having none available is unexpected.
+ */
+
+#ifdef HWC_DEVICE_API_VERSION_1_0
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-bacon.c
^
|
@@ -40,6 +40,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -306,6 +307,7 @@
led_paths_bacon_t paths[BACON_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < BACON_CHANNELS; ++i )
objconf_init(bacon_conf, &paths[i]);
@@ -314,7 +316,7 @@
if( !objconf_parse(bacon_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_bacon_probe(channel+0, &paths[i]) )
+ if( !led_channel_bacon_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-binary.c
^
|
@@ -39,6 +39,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -104,10 +105,10 @@
{
bool res = false;
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
- if( sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
sysfsval_refresh(self->cached_max_brightness);
if( sysfsval_get(self->cached_max_brightness) <= 0 )
@@ -212,6 +213,7 @@
led_paths_binary_t paths[BINARY_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < BINARY_CHANNELS; ++i )
objconf_init(binary_conf, &paths[i]);
@@ -219,7 +221,7 @@
if( !objconf_parse(binary_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_binary_probe(channel+0, &paths[i]) )
+ if( !led_channel_binary_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-f5121.c
^
|
@@ -40,6 +40,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -123,10 +124,10 @@
* Practically all led control directories have 'brightness'
* file, most have 'max_brightness' while only some have 'blink'.
*/
- if( !sysfsval_open(self->cached_blink, path->blink) )
+ if( !sysfsval_open_rw(self->cached_blink, path->blink) )
goto cleanup;
- if( !sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( !sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
goto cleanup;
/* The 'max_brightness' seems to be dynamic. Make an attempt
@@ -140,7 +141,7 @@
if( sysfsval_get(self->cached_max_brightness) <= 0 )
goto cleanup;
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
ack = true;
@@ -324,6 +325,7 @@
led_paths_f5121_t paths[F5121_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < F5121_CHANNELS; ++i )
objconf_init(f5121_conf, &paths[i]);
@@ -332,7 +334,7 @@
if( !objconf_parse(f5121_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_f5121_probe(channel+0, &paths[i]) )
+ if( !led_channel_f5121_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-hammerhead.c
^
|
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <unistd.h>
+#include <string.h>
#include <glib.h>
@@ -283,6 +284,7 @@
led_paths_hammerhead_t paths[HAMMERHEAD_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < HAMMERHEAD_CHANNELS; ++i )
objconf_init(hammerhead_conf, &paths[i]);
@@ -291,7 +293,7 @@
if( !objconf_parse(hammerhead_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_hammerhead_probe(channel+0, &paths[i]) )
+ if( !led_channel_hammerhead_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-htcvision.c
^
|
@@ -42,6 +42,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -115,13 +116,13 @@
{
bool res = false;
- if( !sysfsval_open(self->cached_blink, path->blink) )
+ if( !sysfsval_open_rw(self->cached_blink, path->blink) )
goto cleanup;
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
- if( sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
sysfsval_refresh(self->cached_max_brightness);
if( sysfsval_get(self->cached_max_brightness) <= 0 )
@@ -278,6 +279,7 @@
led_paths_htcvision_t paths[HTCVISION_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < HTCVISION_CHANNELS; ++i )
objconf_init(htcvision_conf, &paths[i]);
@@ -286,7 +288,7 @@
if( !objconf_parse(htcvision_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_htcvision_probe(channel+0, &paths[i]) )
+ if( !led_channel_htcvision_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-redgreen.c
^
|
@@ -40,6 +40,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -105,10 +106,10 @@
{
bool res = false;
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
- if( sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
sysfsval_refresh(self->cached_max_brightness);
if( sysfsval_get(self->cached_max_brightness) <= 0 )
@@ -235,6 +236,7 @@
led_paths_redgreen_t paths[REDGREEN_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < REDGREEN_CHANNELS; ++i )
objconf_init(redgreen_conf, &paths[i]);
@@ -243,7 +245,7 @@
if( !objconf_parse(redgreen_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_redgreen_probe(channel+0, &paths[i]) )
+ if( !led_channel_redgreen_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-vanilla.c
^
|
@@ -51,6 +51,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -137,7 +138,7 @@
bool res = false;
// maximum brightness can be read from file or given in config
- if( sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
sysfsval_refresh(self->cached_max_brightness);
if( path->max_override > 0 )
@@ -147,18 +148,18 @@
goto cleanup;
// we always must have brightness control
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
// on/off period controls are optional, but both
// are needed if one is present
- if( sysfsval_open(self->cached_blink_delay_on, path->blink_delay_on) ) {
- if( !sysfsval_open(self->cached_blink_delay_off, path->blink_delay_off) )
+ if( sysfsval_open_rw(self->cached_blink_delay_on, path->blink_delay_on) ) {
+ if( !sysfsval_open_rw(self->cached_blink_delay_off, path->blink_delay_off) )
sysfsval_close(self->cached_blink_delay_on);
}
// having "blink" control file is optional
- sysfsval_open(self->cached_blink, path->blink);
+ sysfsval_open_rw(self->cached_blink, path->blink);
res = true;
@@ -370,6 +371,7 @@
led_paths_vanilla_t paths[VANILLA_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < VANILLA_CHANNELS; ++i )
objconf_init(vanilla_conf, &paths[i]);
@@ -378,7 +380,7 @@
if( !objconf_parse(vanilla_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_vanilla_probe(channel+0, &paths[i]) )
+ if( !led_channel_vanilla_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-led-white.c
^
|
@@ -36,6 +36,7 @@
#include "plugin-config.h"
#include <stdio.h>
+#include <string.h>
#include <glib.h>
@@ -101,10 +102,10 @@
{
bool res = false;
- if( !sysfsval_open(self->cached_brightness, path->brightness) )
+ if( !sysfsval_open_rw(self->cached_brightness, path->brightness) )
goto cleanup;
- if( !sysfsval_open(self->cached_max_brightness, path->max_brightness) )
+ if( !sysfsval_open_ro(self->cached_max_brightness, path->max_brightness) )
goto cleanup;
sysfsval_refresh(self->cached_max_brightness);
@@ -212,6 +213,7 @@
led_paths_white_t paths[WHITE_CHANNELS];
+ memset(paths, 0, sizeof paths);
for( size_t i = 0; i < WHITE_CHANNELS; ++i )
objconf_init(white_conf, &paths[i]);
@@ -219,7 +221,7 @@
if( !objconf_parse(white_conf, &paths[i], pfix[i]) )
goto cleanup;
- if( !led_channel_white_probe(channel+0, &paths[i]) )
+ if( !led_channel_white_probe(channel+i, &paths[i]) )
goto cleanup;
}
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-val.c
^
|
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
+#include <errno.h>
/* ========================================================================= *
* TYPES
@@ -51,7 +52,9 @@
sysfsval_t *sysfsval_create (void);
void sysfsval_delete (sysfsval_t *self);
-bool sysfsval_open (sysfsval_t *self, const char *path);
+bool sysfsval_open_rw (sysfsval_t *self, const char *path);
+bool sysfsval_open_ro (sysfsval_t *self, const char *path);
+static bool sysfsval_open_ex (sysfsval_t *self, const char *path, mode_t mode);
void sysfsval_close (sysfsval_t *self);
const char *sysfsval_path (const sysfsval_t *self);
int sysfsval_get (const sysfsval_t *self);
@@ -110,14 +113,32 @@
}
}
-/** Assign path to sysfsval_t object and attempt to open the file
+/** Assign path to sysfsval_t object and open the file in read+write mode
*
* @param self sysfsval_t object pointer
*
* @return true if file was opened succesfully, false otherwise
*/
bool
-sysfsval_open(sysfsval_t *self, const char *path)
+sysfsval_open_rw(sysfsval_t *self, const char *path)
+{
+ return sysfsval_open_ex(self, path, O_RDWR);
+}
+
+/** Assign path to sysfsval_t object and open the file in read-only mode
+ *
+ * @param self sysfsval_t object pointer
+ *
+ * @return true if file was opened succesfully, false otherwise
+ */
+bool
+sysfsval_open_ro(sysfsval_t *self, const char *path)
+{
+ return sysfsval_open_ex(self, path, O_RDONLY);
+}
+
+static bool
+sysfsval_open_ex(sysfsval_t *self, const char *path, mode_t mode)
{
bool ack = false;
@@ -129,8 +150,13 @@
if( (self->sv_path = strdup(path)) == 0 )
goto EXIT;
- if( (self->sv_file = open(path, O_RDWR)) == -1 )
+ if( (self->sv_file = open(path, mode)) == -1 ) {
+ if( errno == ENOENT )
+ mce_log(LOG_DEBUG, "%s: open: %m", path);
+ else
+ mce_log(LOG_ERR, "%s: open: %m", path);
goto EXIT;
+ }
mce_log(LOG_DEBUG, "%s: opened", sysfsval_path(self));
|
[-]
[+]
|
Changed |
_service:tar_git:mce-plugin-libhybris-1.12.3.tar.bz2/sysfs-val.h
^
|
@@ -38,7 +38,8 @@
sysfsval_t *sysfsval_create (void);
void sysfsval_delete (sysfsval_t *self);
-bool sysfsval_open (sysfsval_t *self, const char *path);
+bool sysfsval_open_rw (sysfsval_t *self, const char *path);
+bool sysfsval_open_ro (sysfsval_t *self, const char *path);
void sysfsval_close (sysfsval_t *self);
const char *sysfsval_path (const sysfsval_t *self);
int sysfsval_get (const sysfsval_t *self);
|