[-]
[+]
|
Added |
_service:tar_git:libhybris.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris.spec
^
|
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/Makefile.am
^
|
@@ -4,7 +4,7 @@
SUBDIRS += libsync
endif
-SUBDIRS += egl glesv1 glesv2 ui sf input camera
+SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator
if HAS_LIBNFC_NXP_HEADERS
SUBDIRS += libnfc_nxp libnfc_ndef_nxp
endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/common/hooks.c
^
|
@@ -18,7 +18,7 @@
*
*/
-#include <hybris/internal/binding.h>
+#include <hybris/internal/floating_point_abi.h>
#include "hooks_shm.h"
@@ -37,13 +37,16 @@
#include <errno.h>
#include <dirent.h>
#include <sys/types.h>
+#include <sys/xattr.h>
+#include <grp.h>
#include <sys/ipc.h>
#include <sys/shm.h>
+#include <netdb.h>
#include <unistd.h>
+#include <syslog.h>
#include <locale.h>
-#include <search.h>
#include <hybris/properties/properties.h>
@@ -1185,19 +1188,77 @@
return strtod_l(nptr, endptr, hybris_locale);
}
-static char* use_from_bionic[] = {
- "setjmp",
- "longjmp",
- NULL
-};
+extern int __cxa_atexit(void (*)(void*), void*, void*);
static struct _hook hooks[] = {
{"property_get", property_get },
{"property_set", property_set },
+ {"getenv", getenv },
+ {"printf", printf },
{"malloc", my_malloc },
+ {"free", free },
+ {"calloc", calloc },
+ {"cfree", cfree },
+ {"realloc", realloc },
+ {"memalign", memalign },
+ {"valloc", valloc },
+ {"pvalloc", pvalloc },
+ {"fread", fread },
+ {"getxattr", getxattr},
+ /* string.h */
+ {"memccpy",memccpy},
+ {"memchr",memchr},
+ {"memrchr",memrchr},
+ {"memcmp",memcmp},
{"memcpy",my_memcpy},
+ {"memmove",memmove},
+ {"memset",memset},
+ {"memmem",memmem},
+ // {"memswap",memswap},
+ {"index",index},
+ {"rindex",rindex},
+ {"strchr",strchr},
+ {"strrchr",strrchr},
{"strlen",my_strlen},
+ {"strcmp",strcmp},
+ {"strcpy",strcpy},
+ {"strcat",strcat},
+ {"strcasecmp",strcasecmp},
+ {"strncasecmp",strncasecmp},
+ {"strdup",strdup},
+ {"strstr",strstr},
+ {"strtok",strtok},
+ {"strtok_r",strtok_r},
+ {"strerror",strerror},
+ {"strerror_r",strerror_r},
+ {"strnlen",strnlen},
+ {"strncat",strncat},
+ {"strndup",strndup},
+ {"strncmp",strncmp},
+ {"strncpy",strncpy},
{"strtod", my_strtod},
+ //{"strlcat",strlcat},
+ //{"strlcpy",strlcpy},
+ {"strcspn",strcspn},
+ {"strpbrk",strpbrk},
+ {"strsep",strsep},
+ {"strspn",strspn},
+ {"strsignal",strsignal},
+ {"getgrnam", getgrnam},
+ {"strcoll",strcoll},
+ {"strxfrm",strxfrm},
+ /* strings.h */
+ {"bcmp",bcmp},
+ {"bcopy",bcopy},
+ {"bzero",bzero},
+ {"ffs",ffs},
+ {"index",index},
+ {"rindex",rindex},
+ {"strcasecmp",strcasecmp},
+ {"strncasecmp",strncasecmp},
+ /* dirent.h */
+ {"opendir", opendir},
+ {"closedir", closedir},
/* pthread.h */
{"pthread_atfork", pthread_atfork},
{"pthread_create", my_pthread_create},
@@ -1275,6 +1336,16 @@
/* stdio.h */
{"__isthreaded", &__my_isthreaded},
{"__sF", &my_sF},
+ {"fopen", fopen},
+ {"fdopen", fdopen},
+ {"popen", popen},
+ {"puts", puts},
+ {"sprintf", sprintf},
+ {"asprintf", asprintf},
+ {"vasprintf", vasprintf},
+ {"snprintf", snprintf},
+ {"vsprintf", vsprintf},
+ {"vsnprintf", vsnprintf},
{"clearerr", my_clearerr},
{"fclose", my_fclose},
{"feof", my_feof},
@@ -1303,6 +1374,7 @@
{"setbuf", my_setbuf},
{"setvbuf", my_setvbuf},
{"ungetc", my_ungetc},
+ {"vasprintf", vasprintf},
{"vfprintf", my_vfprintf},
{"vfscanf", my_vfscanf},
{"fileno", my_fileno},
@@ -1320,149 +1392,60 @@
{"setlinebuf", my_setlinebuf},
{"__errno", __errno_location},
{"__set_errno", my_set_errno},
+ /* net specifics, to avoid __res_get_state */
+ {"getaddrinfo", getaddrinfo},
+ {"gethostbyaddr", gethostbyaddr},
+ {"gethostbyname", gethostbyname},
+ {"gethostbyname2", gethostbyname2},
+ {"gethostent", gethostent},
+ {"strftime", strftime},
{"sysconf", my_sysconf},
- {"dlopen", android_dlopen},
- {"dlerror", android_dlerror},
- {"dlsym", android_dlsym},
- {"dladdr", android_dladdr},
- {"dlclose", android_dlclose},
+ {"sscanf", sscanf},
+ {"scanf", scanf},
+ {"vscanf", vscanf},
+ {"vsscanf", vsscanf},
+ {"openlog", openlog},
+ {"syslog", syslog},
+ {"closelog", closelog},
+ {"vsyslog", vsyslog},
+ {"timer_create", timer_create},
+ {"timer_settime", timer_settime},
+ {"timer_gettime", timer_gettime},
+ {"timer_delete", timer_delete},
+ {"timer_getoverrun", timer_getoverrun},
+ {"abort", abort},
+ {"writev", writev},
+ /* unistd.h */
+ {"access", access},
+ /* grp.h */
+ {"getgrgid", getgrgid},
+ {"__cxa_atexit", __cxa_atexit},
{NULL, NULL},
};
-struct hsearch_data *htab=NULL;
-
-void* hook_add(const char *func_name, void *func_ptr)
-{
- #define MAX_HTAB_ENTRIES 400
- if (htab == NULL) {
- htab = calloc(1, sizeof(struct hsearch_data));
- hcreate_r(MAX_HTAB_ENTRIES, htab);
- }
-
- ENTRY e, *ep=NULL;
- e.key = strdup(func_name);
- e.data = func_ptr;
- int rv = hsearch_r(e, ENTER, &ep, htab);
- if (ep == NULL) {
- fprintf(stderr, "entry failed:%s %s\n",func_name, strerror(errno));
- return NULL;
- }
-
- LOGD("HOOKED:%s",func_name);
- return ep->data;
-}
-
-void* hook_add_from_lib(const char *func_name, const char *lib_name)
-{
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/common/logging.c
^
|
@@ -23,6 +23,7 @@
#include <string.h>
#include <stdio.h>
#include <pthread.h>
+#include <time.h>
FILE *hybris_logging_target = NULL;
@@ -109,6 +110,17 @@
return (void *)pthread_self();
}
+double
+hybris_get_thread_time()
+{
+ struct timespec now;
+ if(clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now) == 0) {
+ return (double)now.tv_sec + (double)now.tv_nsec / 1000000000.0;
+ } else {
+ return -1.0;
+ }
+}
+
int
hybris_should_trace(const char *module, const char *tracepoint)
{
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/common/logging.h
^
|
@@ -69,6 +69,9 @@
void *
hybris_get_thread_id();
+double
+hybris_get_thread_time();
+
enum hybris_log_format hybris_logging_format();
int hybris_should_trace(const char *module, const char *tracepoint);
@@ -93,13 +96,13 @@
##__VA_ARGS__); \
fflush(hybris_logging_target); \
} else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
- fprintf(hybris_logging_target, "B|%i|%s(%s) %s:%d (%s) " message "\n", \
- getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ fprintf(hybris_logging_target, "B|%i|%.9f|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), hybris_get_thread_time(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
#level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
- fprintf(hybris_logging_target, "E|%i|%s(%s) %s:%d (%s) " message "\n", \
- getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ fprintf(hybris_logging_target, "E|%i|%.9f|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), hybris_get_thread_time(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
#level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
@@ -113,19 +116,19 @@
pthread_mutex_lock(&hybris_logging_mutex); \
if (hybris_logging_format() == HYBRIS_LOG_FORMAT_NORMAL) \
{ \
- fprintf(hybris_logging_target, "PID: %i Tracepoint-%c/%s::%s" message "\n", \
- getpid(), what, tracepoint, module, \
+ fprintf(hybris_logging_target, "PID: %i TTIME: %.9f Tracepoint-%c/%s::%s" message "\n", \
+ getpid(), hybris_get_thread_time(), what, tracepoint, module, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
} else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
if (what == 'B') \
- fprintf(hybris_logging_target, "B|%i|%s::%s" message "", \
- getpid(), tracepoint, module, ##__VA_ARGS__); \
+ fprintf(hybris_logging_target, "B|%i|%.9f|%s::%s" message "", \
+ getpid(), hybris_get_thread_time(), tracepoint, module, ##__VA_ARGS__); \
else if (what == 'E') \
fprintf(hybris_logging_target, "E"); \
else \
- fprintf(hybris_logging_target, "C|%i|%s::%s-%i|" message "", \
- getpid(), tracepoint, module, getpid(), ##__VA_ARGS__); \
+ fprintf(hybris_logging_target, "C|%i|%.9f|%s::%s-%i|" message "", \
+ getpid(), hybris_get_thread_time(), tracepoint, module, getpid(), ##__VA_ARGS__); \
fflush(hybris_logging_target); \
} \
pthread_mutex_unlock(&hybris_logging_mutex); \
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/configure.ac
^
|
@@ -210,6 +210,8 @@
input/libis.pc
camera/Makefile
camera/libcamera.pc
+ vibrator/Makefile
+ vibrator/libvibrator.pc
include/Makefile
utils/Makefile
tests/Makefile
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/egl.c
^
|
@@ -415,29 +415,12 @@
return (*_eglWaitNative)(engine);
}
-EGLBoolean _my_eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects)
-{
- EGLNativeWindowType win;
- EGLBoolean ret;
- HYBRIS_TRACE_BEGIN("hybris-egl", "eglSwapBuffersWithDamageEXT", "");
- EGL_DLSYM(&_eglSwapBuffers, "eglSwapBuffers");
- if (egl_helper_has_mapping(surface)) {
- win = egl_helper_get_mapping(surface);
- ws_prepareSwap(dpy, win, rects, n_rects);
- ret = (*_eglSwapBuffers)(dpy, surface);
- ws_finishSwap(dpy, win);
- } else {
- ret = (*_eglSwapBuffers)(dpy, surface);
- }
- HYBRIS_TRACE_END("hybris-egl", "eglSwapBuffersWithDamageEXT", "");
- return ret;
-}
-
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
- EGLBoolean ret;
+ EGLBoolean ret;
HYBRIS_TRACE_BEGIN("hybris-egl", "eglSwapBuffers", "");
- ret = _my_eglSwapBuffersWithDamageEXT(dpy, surface, NULL, 0);
+ EGL_DLSYM(&_eglSwapBuffers, "eglSwapBuffers");
+ ret = (*_eglSwapBuffers)(dpy, surface);
HYBRIS_TRACE_END("hybris-egl", "eglSwapBuffers", "");
return ret;
}
@@ -475,10 +458,6 @@
{
return _my_eglCreateImageKHR;
}
- else if (strcmp(procname, "eglSwapBuffersWithDamageEXT") == 0)
- {
- return _my_eglSwapBuffersWithDamageEXT;
- }
else if (strcmp(procname, "glEGLImageTargetTexture2DOES") == 0)
{
return _my_glEGLImageTargetTexture2DOES;
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/platforms/wayland/eglplatform_wayland.cpp
^
|
@@ -36,9 +36,6 @@
extern "C" {
#include <eglplatformcommon.h>
};
-#include <eglhybris.h>
-
-#include <EGL/eglext.h>
extern "C" {
#include <wayland-client.h>
@@ -52,13 +49,6 @@
static gralloc_module_t *gralloc = 0;
static alloc_device_t *alloc = 0;
-
-static const char * (*_eglQueryString)(EGLDisplay dpy, EGLint name) = NULL;
-static __eglMustCastToProperFunctionPointerType (*_eglGetProcAddress)(const char *procname) = NULL;
-static EGLSyncKHR (*_eglCreateSyncKHR)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) = NULL;
-static EGLBoolean (*_eglDestroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync) = NULL;
-static EGLint (*_eglClientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) = NULL;
-
extern "C" void waylandws_init_module(struct ws_egl_interface *egl_iface)
{
int err;
@@ -68,33 +58,6 @@
eglplatformcommon_init(egl_iface, gralloc, alloc);
}
-static void _init_egl_funcs(EGLDisplay display)
-{
- if (_eglQueryString != NULL)
- return;
-
- _eglQueryString = (const char * (*)(void*, int))
- hybris_android_egl_dlsym("eglQueryString");
- assert(_eglQueryString);
- _eglGetProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char *))
- hybris_android_egl_dlsym("eglGetProcAddress");
- assert(_eglGetProcAddress);
-
- const char *extensions = (*_eglQueryString)(display, EGL_EXTENSIONS);
-
- if (strstr(extensions, "EGL_KHR_fence_sync")) {
- _eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC)
- (*_eglGetProcAddress)("eglCreateSyncKHR");
- assert(_eglCreateSyncKHR);
- _eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)
- (*_eglGetProcAddress)("eglDestroySyncKHR");
- assert(_eglDestroySyncKHR);
- _eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)
- (*_eglGetProcAddress)("eglClientWaitSyncKHR");
- assert(_eglClientWaitSyncKHR);
- }
-}
-
extern "C" int waylandws_IsValidDisplay(EGLNativeDisplayType display)
{
return 1;
@@ -135,39 +98,6 @@
eglplatformcommon_passthroughImageKHR(ctx, target, buffer, attrib_list);
}
-extern "C" const char *waylandws_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name))
-{
- const char *ret = eglplatformcommon_eglQueryString(dpy, name, real_eglQueryString);
- if (name == EGL_EXTENSIONS)
- {
- assert(ret != NULL);
- static char eglextensionsbuf[512];
- snprintf(eglextensionsbuf, 510, "%s %s", ret,
- "EGL_EXT_swap_buffers_with_damage "
- );
- ret = eglextensionsbuf;
- }
- return ret;
-}
-
-extern "C" void waylandws_prepareSwap(EGLDisplay dpy, EGLNativeWindowType win, EGLint *damage_rects, EGLint damage_n_rects)
-{
- WaylandNativeWindow *window = static_cast<WaylandNativeWindow *>((struct ANativeWindow *)win);
- window->prepareSwap(damage_rects, damage_n_rects);
-}
-
-extern "C" void waylandws_finishSwap(EGLDisplay dpy, EGLNativeWindowType win)
-{
- _init_egl_funcs(dpy);
- WaylandNativeWindow *window = static_cast<WaylandNativeWindow *>((struct ANativeWindow *)win);
- if (_eglCreateSyncKHR) {
- EGLSyncKHR sync = (*_eglCreateSyncKHR)(dpy, EGL_SYNC_FENCE_KHR, NULL);
- (*_eglClientWaitSyncKHR)(dpy, sync, 0, EGL_FOREVER_KHR);
- (*_eglDestroySyncKHR)(dpy, sync);
- }
- window->finishSwap();
-}
-
struct ws_module ws_module_info = {
waylandws_init_module,
waylandws_IsValidDisplay,
@@ -175,9 +105,7 @@
waylandws_DestroyWindow,
waylandws_eglGetProcAddress,
waylandws_passthroughImageKHR,
- waylandws_eglQueryString,
- waylandws_prepareSwap,
- waylandws_finishSwap,
+ eglplatformcommon_eglQueryString
};
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.cpp
^
|
@@ -68,12 +68,19 @@
android_wlegl_handle_destroy(wlegl_handle);
}
+void WaylandNativeWindow::resize(unsigned int width, unsigned int height)
+{
+ lock();
+ this->m_defaultWidth = width;
+ this->m_defaultHeight = height;
+ unlock();
+}
+
+
void WaylandNativeWindow::resize_callback(struct wl_egl_window *egl_window, void *)
{
TRACE("%dx%d",egl_window->width,egl_window->height);
- native_window_set_buffers_dimensions(
- (WaylandNativeWindow*)egl_window->nativewindow,
- egl_window->width,egl_window->height);
+ ((WaylandNativeWindow *) egl_window->nativewindow)->resize(egl_window->width, egl_window->height);
}
void WaylandNativeWindow::lock()
@@ -177,8 +184,6 @@
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cond, NULL);
m_freeBufs = 0;
- m_damage_rects = NULL;
- m_damage_n_rects = 0;
setBufferCount(3);
HYBRIS_TRACE_END("wayland-platform", "create_window", "");
}
@@ -416,30 +421,6 @@
return NO_ERROR;
}
-void WaylandNativeWindow::prepareSwap(EGLint *damage_rects, EGLint damage_n_rects)
-{
- lock();
- m_buffer_committed = false;
- m_damage_rects = damage_rects;
- m_damage_n_rects = damage_n_rects;
- unlock();
-}
-
-void WaylandNativeWindow::finishSwap()
-{
- lock();
- if (! m_buffer_committed) {
- // If, for some reason, we have not seen a call to queueBuffer yet,
- // we need to commit anyway. Some EGL stacks will just not bother
- // queueing a buffer if nothing has been rendererd.
- wl_surface_commit(m_window->surface);
- wl_callback_destroy(wl_display_sync(m_display));
- }
- m_damage_rects = NULL;
- m_damage_n_rects = 0;
- unlock();
-}
-
static int debugenvchecked = 0;
int WaylandNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
@@ -498,32 +479,13 @@
wl_buffer_add_listener(wnb->wlbuffer, &wl_buffer_listener, this);
wl_proxy_set_queue((struct wl_proxy *) wnb->wlbuffer, this->wl_queue);
}
+ TRACE("%p DAMAGE AREA: %dx%d", wnb, wnb->width, wnb->height);
HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_attachdamagecommit", "-resource@%i", wl_proxy_get_id((struct wl_proxy *) wnb->wlbuffer));
wl_surface_attach(m_window->surface, wnb->wlbuffer, 0, 0);
- if (m_damage_n_rects > 0)
- {
- for (EGLint i = 0; i < m_damage_n_rects; ++i)
- {
- TRACE("%p DAMAGE AREA: %dx%d", wnb, m_damage_rects[i * 4 + 2], m_damage_rects[i * 4 + 3]);
- wl_surface_damage(m_window->surface, m_damage_rects[i * 4],
- wnb->height - m_damage_rects[i * 4 + 1] - m_damage_rects[i * 4 + 3],
- m_damage_rects[i * 4 + 2], m_damage_rects[i * 4 + 3]);
- }
- }
- else
- {
- TRACE("%p DAMAGE AREA: %dx%d", wnb, wnb->width, wnb->height);
- wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);
- }
+ wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);
wl_surface_commit(m_window->surface);
- // Some compositors, namely Weston, queue buffer release events instead
- // of sending them immediately. If a frame event is used, this should
- // not be a problem. Without a frame event, we need to send a sync
- // request to ensure that they get flushed.
- wl_callback_destroy(wl_display_sync(m_display));
wl_display_flush(m_display);
- m_buffer_committed = true;
HYBRIS_TRACE_END("wayland-platform", "queueBuffer_attachdamagecommit", "-resource@%i", wl_proxy_get_id((struct wl_proxy *) wnb->wlbuffer));
m_window->attached_width = wnb->width;
@@ -728,8 +690,8 @@
if (m_width != width || m_height != height)
{
TRACE("old-size:%ix%i new-size:%ix%i", m_width, m_height, width, height);
- m_width = m_defaultWidth = width;
- m_height = m_defaultHeight = height;
+ m_width = width;
+ m_height = height;
/* Buffers will be re-allocated when dequeued */
} else {
TRACE("size:%ix%i", width, height);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/platforms/wayland/wayland_window.h
^
|
@@ -105,18 +105,16 @@
void lock();
void unlock();
+ void resize(unsigned int width, unsigned int height);
void releaseBuffer(struct wl_buffer *buffer);
int postBuffer(ANativeWindowBuffer *buffer);
- void prepareSwap(EGLint *damage_rects, EGLint damage_n_rects);
- void finishSwap();
-
static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial);
static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
const char *interface, uint32_t version);
static void resize_callback(struct wl_egl_window *egl_window, void *);
struct wl_event_queue *wl_queue;
-
+
protected:
// overloads from BaseNativeWindow
virtual int setSwapInterval(int interval);
@@ -160,8 +158,6 @@
pthread_mutex_t mutex;
pthread_cond_t cond;
int m_freeBufs;
- bool m_buffer_committed;
- EGLint *m_damage_rects, m_damage_n_rects;
struct wl_callback *frame_callback;
static int wayland_roundtrip(WaylandNativeWindow *display);
};
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/ws.c
^
|
@@ -91,18 +91,4 @@
return ws->eglQueryString(dpy, name, real_eglQueryString);
}
-void ws_prepareSwap(EGLDisplay dpy, EGLNativeWindowType win, EGLint *damage_rects, EGLint damage_n_rects)
-{
- _init_ws();
- if (ws->prepareSwap)
- ws->prepareSwap(dpy, win, damage_rects, damage_n_rects);
-}
-
-void ws_finishSwap(EGLDisplay dpy, EGLNativeWindowType win)
-{
- _init_ws();
- if (ws->finishSwap)
- ws->finishSwap(dpy, win);
-}
-
// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/egl/ws.h
^
|
@@ -20,8 +20,6 @@
__eglMustCastToProperFunctionPointerType (*eglGetProcAddress)(const char *procname);
void (*passthroughImageKHR)(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list);
const char *(*eglQueryString)(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name));
- void (*prepareSwap)(EGLDisplay dpy, EGLNativeWindowType win, EGLint *damage_rects, EGLint damage_n_rects);
- void (*finishSwap)(EGLDisplay dpy, EGLNativeWindowType win);
};
int ws_IsValidDisplay(EGLNativeDisplayType display);
@@ -30,7 +28,5 @@
__eglMustCastToProperFunctionPointerType ws_eglGetProcAddress(const char *procname);
void ws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list);
const char *ws_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name));
-void ws_prepareSwap(EGLDisplay dpy, EGLNativeWindowType win, EGLint *damage_rects, EGLint damage_n_rects);
-void ws_finishSwap(EGLDisplay dpy, EGLNativeWindowType win);
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/tests/Makefile.am
^
|
@@ -7,6 +7,7 @@
test_sensors \
test_input \
test_camera \
+ test_vibrator \
test_gps
if HAS_ANDROID_4_2_0
@@ -163,3 +164,12 @@
test_nfc_LDADD = \
$(top_builddir)/libnfc_nxp/libnfc_nxp.la \
$(top_builddir)/hardware/libhardware.la
+
+test_vibrator_SOURCES = test_vibrator.c
+test_vibrator_CFLAGS = \
+ -I$(top_srcdir)/include \
+ $(ANDROID_HEADERS_CFLAGS)
+test_vibrator_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/vibrator/libvibrator.la
+
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/tests/test_sensors.c
^
|
@@ -21,6 +21,49 @@
#include <stdlib.h>
#include <hardware/sensors.h>
+static void process_event(sensors_event_t *data)
+{
+ switch (data->type) {
+ case SENSOR_TYPE_ACCELEROMETER:
+ printf("Accelerometer: %+08.2f, %+08.2f, %+08.2f", data->acceleration.x,
+ data->acceleration.y, data->acceleration.z);
+ break;
+ case SENSOR_TYPE_ORIENTATION:
+ printf("Orientation: %+08.2f, %+08.2f, %+08.2f", data->orientation.x,
+ data->orientation.y, data->orientation.z);
+ break;
+ case SENSOR_TYPE_GYROSCOPE:
+ printf("Gyroscope: %+08.2f, %+08.2f, %+08.2f", data->gyro.x,
+ data->gyro.y, data->gyro.z);
+ break;
+ case SENSOR_TYPE_LIGHT:
+ printf("Light: %+08.2f", data->light);
+ break;
+ case SENSOR_TYPE_PROXIMITY:
+ printf("Proximity: %+08.2f", data->distance);
+ break;
+ default:
+ printf("Other sensor data (not parsed yet, type=%d)", data->type);
+ }
+}
+
+static void print_sensor_info(int i, struct sensor_t const *s)
+{
+ printf("=== Sensor %d ==\n", i);
+ printf("Name: %s\n", s->name);
+ printf("Vendor: %s\n", s->vendor);
+ printf("Version: 0x%x\n", s->version);
+ printf("Handle: 0x%x\n", s->handle);
+ printf("Type: %d\n", s->type);
+ printf("maxRange: %.f\n", s->maxRange);
+ printf("resolution: %.f\n", s->resolution);
+ printf("power: %.f mA\n", s->power);
+ printf("minDelay: %d\n", s->minDelay);
+ //printf("fifoReservedEventCount: %d\n", s->fifoReservedEventCount);
+ //printf("fifoMaxEventCount: %d\n", s->fifoMaxEventCount);
+ printf("\n\n\n");
+}
+
int main(int argc, char **argv)
{
struct hw_module_t *hwmod;
@@ -34,6 +77,71 @@
exit(1);
}
+ printf("Hardware module ID: %s\n", hwmod->id);
+ printf("Hardware module Name: %s\n", hwmod->name);
+ printf("Hardware module Author: %s\n", hwmod->author);
+ printf("Hardware module API version: 0x%x\n", hwmod->module_api_version);
+ printf("Hardware HAL API version: 0x%x\n", hwmod->hal_api_version);
+ printf("Poll device version: 0x%x\n", dev->common.version);
+
+ printf("API VERSION 0.1 (legacy): 0x%x\n", HARDWARE_MODULE_API_VERSION(0, 1));
+#ifdef SENSORS_DEVICE_API_VERSION_0_1
+ printf("API VERSION 0.1: 0x%d\n", SENSORS_DEVICE_API_VERSION_0_1);
+#endif
+#ifdef SENSORS_DEVICE_API_VERSION_1_0
+ printf("API VERSION 1.0: 0x%d\n", SENSORS_DEVICE_API_VERSION_1_0);
+#endif
+#ifdef SENSORS_DEVICE_API_VERSION_1_1
+ printf("API VERSION 1.1: 0x%d\n", SENSORS_DEVICE_API_VERSION_1_1);
+#endif
+
+ struct sensors_module_t *smod = (struct sensors_module_t *)(hwmod);
+
+ struct sensor_t const *sensors_list = NULL;
+ int sensors = smod->get_sensors_list(smod, &sensors_list);
+ printf("Got %d sensors\n", sensors);
+
+ int res;
+ int poll_sensor = ((argc == 2) ? atoi(argv[1]) : -1);
+
+ if (poll_sensor != -1 && poll_sensor < sensors) {
+ struct sensor_t const *s = sensors_list + poll_sensor;
+ print_sensor_info(poll_sensor, s);
+
+ res = dev->setDelay(dev, s->handle, s->minDelay);
+ if (res != 0) {
+ printf("Could not set delay: %s\n", strerror(-res));
+ }
+ res = dev->activate(dev, s->handle, 1);
+ if (res != 0) {
+ printf("Could not activate sensor: %s\n", strerror(-res));
+ } else {
+ printf("Reading events\n");
+ while (1) {
+ sensors_event_t data;
+ data.sensor = -1;
+ printf("\rPolling... ");
+ fflush(stdout);
+ while (dev->poll(dev, &data, 1) != 1);
+ printf(" ");
+ if (data.sensor == poll_sensor) {
+ process_event(&data);
+ }
+ printf("\33[K");
+ fflush(stdout);
+ }
+ res = dev->activate(dev, s->handle, 0);
+ if (res != 0) {
+ printf("Could not deactivate sensor: %s\n", strerror(-res));
+ }
+ }
+ } else {
+ int i;
+ for (i=0; i<sensors; i++) {
+ print_sensor_info(i, sensors_list + i);
+ }
+ }
+
if (sensors_close(dev) < 0) {
printf("ERROR: failed to close sensors device\n");
exit(1);
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/tests/test_vibrator.c
^
|
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Jolla Ltd.
+ * Contact: Simonas Leleiva <simonas.leleiva@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <android-config.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <hardware_legacy/vibrator.h>
+
+int main(int argc, char **argv)
+{
+ // Android mistakenly reports that vibrator does not exist:
+ //assert(vibrator_exists() != 0);
+
+ if (vibrator_on(1000) < 0) {
+ printf("ERROR: vibrator failed to vibrate\n");
+ exit(1);
+ }
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/vibrator/Makefile.am
^
|
@@ -0,0 +1,17 @@
+lib_LTLIBRARIES = \
+ libvibrator.la
+
+libvibrator_la_SOURCES = vibrator.c
+libvibrator_la_CFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS)
+if WANT_TRACE
+libvibrator_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libvibrator_la_CFLAGS += -ggdb -O0
+endif
+libvibrator_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libvibrator.pc
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/vibrator/libvibrator.pc.in
^
|
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-vibrator
+Description: libhybris vibrator library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-common -lvibrator
+Cflags: -I${includedir}
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/libhybris/hybris/vibrator/vibrator.c
^
|
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 Jolla Ltd.
+ * Contact: Simonas Leleiva <simonas.leleiva@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include <hybris/internal/binding.h>
+
+HYBRIS_LIBRARY_INITIALIZE(vibrator, "/system/lib/libhardware_legacy.so");
+
+HYBRIS_IMPLEMENT_FUNCTION0(vibrator, int, vibrator_exists);
+HYBRIS_IMPLEMENT_FUNCTION1(vibrator, int, vibrator_on, int);
+HYBRIS_IMPLEMENT_FUNCTION1(vibrator, int, vibrator_off, int);
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/Makefile.am
^
|
@@ -4,7 +4,7 @@
SUBDIRS += libsync
endif
-SUBDIRS += egl glesv1 glesv2 ui sf input camera
+SUBDIRS += egl glesv1 glesv2 ui sf input camera vibrator
if HAS_LIBNFC_NXP_HEADERS
SUBDIRS += libnfc_nxp libnfc_ndef_nxp
endif
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/common/logging.c
^
|
@@ -23,6 +23,7 @@
#include <string.h>
#include <stdio.h>
#include <pthread.h>
+#include <time.h>
FILE *hybris_logging_target = NULL;
@@ -109,6 +110,17 @@
return (void *)pthread_self();
}
+double
+hybris_get_thread_time()
+{
+ struct timespec now;
+ if(clock_gettime(CLOCK_THREAD_CPUTIME_ID, &now) == 0) {
+ return (double)now.tv_sec + (double)now.tv_nsec / 1000000000.0;
+ } else {
+ return -1.0;
+ }
+}
+
int
hybris_should_trace(const char *module, const char *tracepoint)
{
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/common/logging.h
^
|
@@ -69,6 +69,9 @@
void *
hybris_get_thread_id();
+double
+hybris_get_thread_time();
+
enum hybris_log_format hybris_logging_format();
int hybris_should_trace(const char *module, const char *tracepoint);
@@ -93,13 +96,13 @@
##__VA_ARGS__); \
fflush(hybris_logging_target); \
} else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
- fprintf(hybris_logging_target, "B|%i|%s(%s) %s:%d (%s) " message "\n", \
- getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ fprintf(hybris_logging_target, "B|%i|%.9f|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), hybris_get_thread_time(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
#level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
- fprintf(hybris_logging_target, "E|%i|%s(%s) %s:%d (%s) " message "\n", \
- getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ fprintf(hybris_logging_target, "E|%i|%.9f|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), hybris_get_thread_time(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
#level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
@@ -113,19 +116,19 @@
pthread_mutex_lock(&hybris_logging_mutex); \
if (hybris_logging_format() == HYBRIS_LOG_FORMAT_NORMAL) \
{ \
- fprintf(hybris_logging_target, "PID: %i Tracepoint-%c/%s::%s" message "\n", \
- getpid(), what, tracepoint, module, \
+ fprintf(hybris_logging_target, "PID: %i TTIME: %.9f Tracepoint-%c/%s::%s" message "\n", \
+ getpid(), hybris_get_thread_time(), what, tracepoint, module, \
##__VA_ARGS__); \
fflush(hybris_logging_target); \
} else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
if (what == 'B') \
- fprintf(hybris_logging_target, "B|%i|%s::%s" message "", \
- getpid(), tracepoint, module, ##__VA_ARGS__); \
+ fprintf(hybris_logging_target, "B|%i|%.9f|%s::%s" message "", \
+ getpid(), hybris_get_thread_time(), tracepoint, module, ##__VA_ARGS__); \
else if (what == 'E') \
fprintf(hybris_logging_target, "E"); \
else \
- fprintf(hybris_logging_target, "C|%i|%s::%s-%i|" message "", \
- getpid(), tracepoint, module, getpid(), ##__VA_ARGS__); \
+ fprintf(hybris_logging_target, "C|%i|%.9f|%s::%s-%i|" message "", \
+ getpid(), hybris_get_thread_time(), tracepoint, module, getpid(), ##__VA_ARGS__); \
fflush(hybris_logging_target); \
} \
pthread_mutex_unlock(&hybris_logging_mutex); \
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/configure.ac
^
|
@@ -210,6 +210,8 @@
input/libis.pc
camera/Makefile
camera/libcamera.pc
+ vibrator/Makefile
+ vibrator/libvibrator.pc
include/Makefile
utils/Makefile
tests/Makefile
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/tests/Makefile.am
^
|
@@ -7,6 +7,7 @@
test_sensors \
test_input \
test_camera \
+ test_vibrator \
test_gps
if HAS_ANDROID_4_2_0
@@ -163,3 +164,12 @@
test_nfc_LDADD = \
$(top_builddir)/libnfc_nxp/libnfc_nxp.la \
$(top_builddir)/hardware/libhardware.la
+
+test_vibrator_SOURCES = test_vibrator.c
+test_vibrator_CFLAGS = \
+ -I$(top_srcdir)/include \
+ $(ANDROID_HEADERS_CFLAGS)
+test_vibrator_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/vibrator/libvibrator.la
+
|
[-]
[+]
|
Changed |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/tests/test_sensors.c
^
|
@@ -21,6 +21,49 @@
#include <stdlib.h>
#include <hardware/sensors.h>
+static void process_event(sensors_event_t *data)
+{
+ switch (data->type) {
+ case SENSOR_TYPE_ACCELEROMETER:
+ printf("Accelerometer: %+08.2f, %+08.2f, %+08.2f", data->acceleration.x,
+ data->acceleration.y, data->acceleration.z);
+ break;
+ case SENSOR_TYPE_ORIENTATION:
+ printf("Orientation: %+08.2f, %+08.2f, %+08.2f", data->orientation.x,
+ data->orientation.y, data->orientation.z);
+ break;
+ case SENSOR_TYPE_GYROSCOPE:
+ printf("Gyroscope: %+08.2f, %+08.2f, %+08.2f", data->gyro.x,
+ data->gyro.y, data->gyro.z);
+ break;
+ case SENSOR_TYPE_LIGHT:
+ printf("Light: %+08.2f", data->light);
+ break;
+ case SENSOR_TYPE_PROXIMITY:
+ printf("Proximity: %+08.2f", data->distance);
+ break;
+ default:
+ printf("Other sensor data (not parsed yet, type=%d)", data->type);
+ }
+}
+
+static void print_sensor_info(int i, struct sensor_t const *s)
+{
+ printf("=== Sensor %d ==\n", i);
+ printf("Name: %s\n", s->name);
+ printf("Vendor: %s\n", s->vendor);
+ printf("Version: 0x%x\n", s->version);
+ printf("Handle: 0x%x\n", s->handle);
+ printf("Type: %d\n", s->type);
+ printf("maxRange: %.f\n", s->maxRange);
+ printf("resolution: %.f\n", s->resolution);
+ printf("power: %.f mA\n", s->power);
+ printf("minDelay: %d\n", s->minDelay);
+ //printf("fifoReservedEventCount: %d\n", s->fifoReservedEventCount);
+ //printf("fifoMaxEventCount: %d\n", s->fifoMaxEventCount);
+ printf("\n\n\n");
+}
+
int main(int argc, char **argv)
{
struct hw_module_t *hwmod;
@@ -34,6 +77,71 @@
exit(1);
}
+ printf("Hardware module ID: %s\n", hwmod->id);
+ printf("Hardware module Name: %s\n", hwmod->name);
+ printf("Hardware module Author: %s\n", hwmod->author);
+ printf("Hardware module API version: 0x%x\n", hwmod->module_api_version);
+ printf("Hardware HAL API version: 0x%x\n", hwmod->hal_api_version);
+ printf("Poll device version: 0x%x\n", dev->common.version);
+
+ printf("API VERSION 0.1 (legacy): 0x%x\n", HARDWARE_MODULE_API_VERSION(0, 1));
+#ifdef SENSORS_DEVICE_API_VERSION_0_1
+ printf("API VERSION 0.1: 0x%d\n", SENSORS_DEVICE_API_VERSION_0_1);
+#endif
+#ifdef SENSORS_DEVICE_API_VERSION_1_0
+ printf("API VERSION 1.0: 0x%d\n", SENSORS_DEVICE_API_VERSION_1_0);
+#endif
+#ifdef SENSORS_DEVICE_API_VERSION_1_1
+ printf("API VERSION 1.1: 0x%d\n", SENSORS_DEVICE_API_VERSION_1_1);
+#endif
+
+ struct sensors_module_t *smod = (struct sensors_module_t *)(hwmod);
+
+ struct sensor_t const *sensors_list = NULL;
+ int sensors = smod->get_sensors_list(smod, &sensors_list);
+ printf("Got %d sensors\n", sensors);
+
+ int res;
+ int poll_sensor = ((argc == 2) ? atoi(argv[1]) : -1);
+
+ if (poll_sensor != -1 && poll_sensor < sensors) {
+ struct sensor_t const *s = sensors_list + poll_sensor;
+ print_sensor_info(poll_sensor, s);
+
+ res = dev->setDelay(dev, s->handle, s->minDelay);
+ if (res != 0) {
+ printf("Could not set delay: %s\n", strerror(-res));
+ }
+ res = dev->activate(dev, s->handle, 1);
+ if (res != 0) {
+ printf("Could not activate sensor: %s\n", strerror(-res));
+ } else {
+ printf("Reading events\n");
+ while (1) {
+ sensors_event_t data;
+ data.sensor = -1;
+ printf("\rPolling... ");
+ fflush(stdout);
+ while (dev->poll(dev, &data, 1) != 1);
+ printf(" ");
+ if (data.sensor == poll_sensor) {
+ process_event(&data);
+ }
+ printf("\33[K");
+ fflush(stdout);
+ }
+ res = dev->activate(dev, s->handle, 0);
+ if (res != 0) {
+ printf("Could not deactivate sensor: %s\n", strerror(-res));
+ }
+ }
+ } else {
+ int i;
+ for (i=0; i<sensors; i++) {
+ print_sensor_info(i, sensors_list + i);
+ }
+ }
+
if (sensors_close(dev) < 0) {
printf("ERROR: failed to close sensors device\n");
exit(1);
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/tests/test_vibrator.c
^
|
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Jolla Ltd.
+ * Contact: Simonas Leleiva <simonas.leleiva@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <android-config.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <hardware_legacy/vibrator.h>
+
+int main(int argc, char **argv)
+{
+ // Android mistakenly reports that vibrator does not exist:
+ //assert(vibrator_exists() != 0);
+
+ if (vibrator_on(1000) < 0) {
+ printf("ERROR: vibrator failed to vibrate\n");
+ exit(1);
+ }
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/vibrator/Makefile.am
^
|
@@ -0,0 +1,17 @@
+lib_LTLIBRARIES = \
+ libvibrator.la
+
+libvibrator_la_SOURCES = vibrator.c
+libvibrator_la_CFLAGS = -I$(top_srcdir)/include $(ANDROID_HEADERS_CFLAGS)
+if WANT_TRACE
+libvibrator_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libvibrator_la_CFLAGS += -ggdb -O0
+endif
+libvibrator_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libvibrator.pc
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/vibrator/libvibrator.pc.in
^
|
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-vibrator
+Description: libhybris vibrator library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-common -lvibrator
+Cflags: -I${includedir}
|
[-]
[+]
|
Added |
_service:tar_git:libhybris-0.0.1.tar.bz2/upstream/hybris/vibrator/vibrator.c
^
|
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2014 Jolla Ltd.
+ * Contact: Simonas Leleiva <simonas.leleiva@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include <hybris/internal/binding.h>
+
+HYBRIS_LIBRARY_INITIALIZE(vibrator, "/system/lib/libhardware_legacy.so");
+
+HYBRIS_IMPLEMENT_FUNCTION0(vibrator, int, vibrator_exists);
+HYBRIS_IMPLEMENT_FUNCTION1(vibrator, int, vibrator_on, int);
+HYBRIS_IMPLEMENT_FUNCTION1(vibrator, int, vibrator_off, int);
|