73 lines
1.7 KiB
Diff
73 lines
1.7 KiB
Diff
diff -ur libhardware_legacy/vibrator/Android.mk libhardware_legacy_mtk/vibrator/Android.mk
|
|
--- libhardware_legacy/vibrator/Android.mk 2016-01-22 15:47:44.299870000 -0800
|
|
+++ libhardware_legacy_mtk/vibrator/Android.mk 2016-01-23 05:25:45.217410359 -0800
|
|
@@ -2,3 +2,8 @@
|
|
|
|
LOCAL_SRC_FILES += vibrator/vibrator.c
|
|
|
|
+ifdef BOARD_HAVE_OPENSOURCE_IMMVIBE
|
|
+LOCAL_SHARED_LIBRARIES += libimmvibeconnector
|
|
+LOCAL_CFLAGS += -DHAVE_OPENSOURCE_IMMVIBE
|
|
+LOCAL_CPPFLAGS += -DHAVE_OPENSOURCE_IMMVIBE
|
|
+endif
|
|
diff -ur libhardware_legacy/vibrator/vibrator.c libhardware_legacy_mtk/vibrator/vibrator.c
|
|
--- libhardware_legacy/vibrator/vibrator.c 2016-01-22 15:47:44.299870000 -0800
|
|
+++ libhardware_legacy_mtk/vibrator/vibrator.c 2016-01-23 05:25:45.217410359 -0800
|
|
@@ -13,6 +13,7 @@
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
+
|
|
#include <hardware_legacy/vibrator.h>
|
|
#include "qemu.h"
|
|
|
|
@@ -21,6 +22,12 @@
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
|
|
+#include <cutils/log.h>
|
|
+
|
|
+#ifdef HAVE_OPENSOURCE_IMMVIBE
|
|
+#include <immvibeconn.h>
|
|
+#endif
|
|
+
|
|
#define THE_DEVICE "/sys/class/timed_output/vibrator/enable"
|
|
|
|
int vibrator_exists()
|
|
@@ -33,6 +40,11 @@
|
|
}
|
|
#endif
|
|
|
|
+#ifdef HAVE_OPENSOURCE_IMMVIBE
|
|
+ /* TODO */
|
|
+ return 1;
|
|
+#endif
|
|
+
|
|
fd = open(THE_DEVICE, O_RDWR);
|
|
if(fd < 0)
|
|
return 0;
|
|
@@ -51,6 +63,23 @@
|
|
}
|
|
#endif
|
|
|
|
+#ifdef HAVE_OPENSOURCE_IMMVIBE
|
|
+ fd = immvibe_conn_open();
|
|
+ if (fd < 0) {
|
|
+ return errno;
|
|
+ }
|
|
+
|
|
+ if (timeout_ms) {
|
|
+ ret = immvibe_conn_vibrate(fd, timeout_ms);
|
|
+ } else {
|
|
+ ret = immvibe_conn_stop(fd);
|
|
+ }
|
|
+
|
|
+ close(fd);
|
|
+
|
|
+ return ret ? -1 : 0;
|
|
+#endif
|
|
+
|
|
fd = open(THE_DEVICE, O_RDWR);
|
|
if(fd < 0)
|
|
return errno;
|