diff --git a/external/cwiid/Android.mk b/external/cwiid/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/external/cwiid/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/external/cwiid/common/include/config.h b/external/cwiid/common/include/config.h new file mode 100644 index 0000000..5a1c980 --- /dev/null +++ b/external/cwiid/common/include/config.h @@ -0,0 +1,69 @@ +/* common/include/config.h. Generated from config.h.in by configure. */ +/* common/include/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_BLUETOOTH_HCI_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_BLUETOOTH_L2CAP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `bluetooth' library (-lbluetooth). */ +#define HAVE_LIBBLUETOOTH 1 + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#define HAVE_LIBPTHREAD 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if python support is enabled */ +//#define HAVE_PYTHON 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "cwiid@abstrakraft.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "CWiid" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "CWiid 0.6.00" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "cwiid" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.6.00" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#define YYTEXT_POINTER 1 diff --git a/external/cwiid/libcwiid/Android.mk b/external/cwiid/libcwiid/Android.mk new file mode 100644 index 0000000..7d4ea7e --- /dev/null +++ b/external/cwiid/libcwiid/Android.mk @@ -0,0 +1,36 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES:= \ + external/bluez/libs/include \ + external/bluez/utils/common \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/../common/include \ + +LOCAL_CFLAGS += -O2 \ + -DHAVE_CONFIG_H \ + -DPTHREAD_CANCEL_ENABLE=0 \ + -DPTHREAD_CANCEL_DISABLE=1 \ + -DPTHREAD_CANCELED=0 \ + +LOCAL_SRC_FILES:= \ + bluetooth.c \ + command.c \ + connect.c \ + interface.c \ + process.c \ + state.c \ + thread.c \ + util.c + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libcutils \ + libbluetooth + +LOCAL_PRELINK_MODULE := false + +LOCAL_MODULE_TAGS := user +LOCAL_MODULE:= libcwiid + +include $(BUILD_SHARED_LIBRARY) diff --git a/external/cwiid/libcwiid/cwiid.h b/external/cwiid/libcwiid/cwiid.h index 0490511..28b3c0f 100644 --- a/external/cwiid/libcwiid/cwiid.h +++ b/external/cwiid/libcwiid/cwiid.h @@ -150,6 +150,11 @@ /* Callback Maximum Message Count */ #define CWIID_MAX_MESG_COUNT 5 +#ifdef ANDROID +#define pthread_cancel(foo) ((int)0) +#define pthread_setcancelstate(foo,bar) ((void*)0) +#endif + /* Enumerations */ enum cwiid_command { CWIID_CMD_STATUS, diff --git a/external/cwiid/wminput/Android.mk b/external/cwiid/wminput/Android.mk new file mode 100644 index 0000000..874bebf --- /dev/null +++ b/external/cwiid/wminput/Android.mk @@ -0,0 +1,101 @@ +SAVE_MAKEFILES := $(call all-subdir-makefiles) + +LOCAL_PATH:= $(call my-dir) + +# +# libwminput +# + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES:= \ + external/bluez/libs/include \ + external/bluez/utils/common \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/../libcwiid \ + $(LOCAL_PATH)/../common/include \ + +LOCAL_CFLAGS := \ + -DVERSION=\"1.0.0\" -x c + +CWIID_CONFIG_DIR := /etc/cwiid +WMINPUT_CONFIG_DIR := $(CWIID_CONFIG_DIR)/wminput + +LOCAL_CFLAGS += -O2 \ + -DHAVE_CONFIG_H \ + -DWMINPUT_CONFIG_DIR=\"$(WMINPUT_CONFIG_DIR)\" \ + -DCWIID_PLUGINS_DIR=\"/system/lib/cwiid-plugin\" \ + +LOCAL_PRELINK_MODULE := false + +LOCAL_MODULE := libwminput +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +intermediates := $(call local-intermediates-dir) +GEN := $(intermediates)/gen_action_enum.c +$(GEN) : PRIVATE_PATH := $(LOCAL_PATH) +$(GEN) : PRIVATE_CUSTOM_TOOL = awk -f $(PRIVATE_PATH)/action_enum.awk < $(PRIVATE_PATH)/action_enum.txt > $@ +$(GEN) : PRIVATE_MODULE := $(LOCAL_MODULE) +$(GEN) : + @echo "target Generating: $@" + $(transform-generated-source) +$(intermediates)/action_enum.o : $(GEN) + +LOCAL_GENERATED_SOURCES += $(GEN) + +LOCAL_SRC_FILES:= \ + parser.y \ + lexer.l \ + main.c \ + c_plugin.c \ + uinput.c \ + util.c \ + conf.c \ + action_enum.c + +LOCAL_SHARED_LIBRARIES := \ + libdl \ + libutils \ + libcutils \ + libbluetooth \ + libcwiid + +include $(BUILD_SHARED_LIBRARY) + +# +# wminput +# + +include $(CLEAR_VARS) + +LOCAL_SHARED_LIBRARIES := \ + libwminput + +LOCAL_MODULE := wminput +LOCAL_MODULE_CLASS := EXECUTABLES + +include $(BUILD_EXECUTABLE) + +# +# config files +# + +include $(CLEAR_VARS) + +copy_from := \ + gamepad \ + neverball \ + ir_ptr \ + buttons \ + acc_ptr + +copy_to := $(addprefix $(TARGET_OUT)/$(WMINPUT_CONFIG_DIR)/,$(copy_from)) +copy_from := $(addprefix $(LOCAL_PATH)/configs/,$(copy_from)) + + +$(copy_to) : PRIVATE_MODULE := system_etcdir +$(copy_to) : $(TARGET_OUT)/$(WMINPUT_CONFIG_DIR)/% : $(LOCAL_PATH)/configs/% | $(ACP) + $(transform-prebuilt-to-target) + +ALL_PREBUILT += $(copy_to) +include $(SAVE_MAKEFILES) diff --git a/external/cwiid/wminput/action_enum.c b/external/cwiid/wminput/action_enum.c new file mode 100644 index 0000000..9c748f6 --- /dev/null +++ b/external/cwiid/wminput/action_enum.c @@ -0,0 +1 @@ +#include "gen_action_enum.c" diff --git a/external/cwiid/wminput/conf.c b/external/cwiid/wminput/conf.c index fe6d7a9..747a708 100644 --- a/external/cwiid/wminput/conf.c +++ b/external/cwiid/wminput/conf.c @@ -55,7 +55,11 @@ #include "conf.h" #include "util.h" +#ifdef ANDROID +#include "parser.h" +#else #include "y.tab.h" +#endif #include "c_plugin.h" #ifdef HAVE_PYTHON #include "py_plugin.h" diff --git a/external/cwiid/wminput/conf.h b/external/cwiid/wminput/conf.h index 73c299a..da7eaa3 100644 --- a/external/cwiid/wminput/conf.h +++ b/external/cwiid/wminput/conf.h @@ -53,7 +53,11 @@ #include "cwiid.h" #include "wmplugin.h" +#ifdef ANDROID +#include "parser.h" +#else #include "y.tab.h" +#endif #define CONF_WM 1 #define CONF_NC 2 diff --git a/external/cwiid/wminput/configs/buttons b/external/cwiid/wminput/configs/buttons index 5a5df37..855f36e 100644 --- a/external/cwiid/wminput/configs/buttons +++ b/external/cwiid/wminput/configs/buttons @@ -1,14 +1,14 @@ #buttons Wiimote.A = BTN_LEFT -Wiimote.B = BTN_RIGHT +Wiimote.B = KEY_ENTER Wiimote.Up = KEY_UP Wiimote.Down = KEY_DOWN Wiimote.Left = KEY_LEFT Wiimote.Right = KEY_RIGHT Wiimote.Minus = KEY_BACK Wiimote.Plus = KEY_FORWARD -Wiimote.Home = KEY_HOME +Wiimote.Home = KEY_MENU Wiimote.1 = KEY_PROG1 Wiimote.2 = KEY_PROG2 @@ -21,9 +21,9 @@ Classic.Left = KEY_LEFT Classic.Right = KEY_RIGHT Classic.Minus = KEY_BACK Classic.Plus = KEY_FORWARD -Classic.Home = KEY_HOME +Classic.Home = KEY_MENU Classic.A = BTN_LEFT -Classic.B = BTN_RIGHT +Classic.B = KEY_ENTER #Classic.X = #Classic.Y = #Classic.ZL = diff --git a/external/cwiid/wminput/lexer.l b/external/cwiid/wminput/lexer.l index d4ab80a..30e6eea 100644 --- a/external/cwiid/wminput/lexer.l +++ b/external/cwiid/wminput/lexer.l @@ -28,7 +28,11 @@ #include #include "conf.h" #include "util.h" +#ifdef ANDROID +#include "parser.h" +#else #include "y.tab.h" +#endif #define step \ do { \ diff --git a/external/cwiid/wminput/plugins/Android.mk b/external/cwiid/wminput/plugins/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/external/cwiid/wminput/plugins/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/external/cwiid/wminput/plugins/acc/Android.mk b/external/cwiid/wminput/plugins/acc/Android.mk new file mode 100644 index 0000000..1fdac51 --- /dev/null +++ b/external/cwiid/wminput/plugins/acc/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES:= \ + external/bluez/libs/include \ + external/bluez/utils/common \ + $(LOCAL_PATH)/../../../common/include \ + $(LOCAL_PATH)/../../../libcwiid \ + $(LOCAL_PATH)/../../../wminput + +LOCAL_CFLAGS := \ + -DVERSION=\"1.0.0\" + +LOCAL_SRC_FILES:= \ + acc.c + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libcutils \ + libwminput \ + libcwiid + +LOCAL_PRELINK_MODULE := false + +LOCAL_MODULE_TAGS := user +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/cwiid-plugin +LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/cwiid-plugin +LOCAL_MODULE := acc + +include $(BUILD_SHARED_LIBRARY) diff --git a/external/cwiid/wminput/plugins/ir_ptr/Android.mk b/external/cwiid/wminput/plugins/ir_ptr/Android.mk new file mode 100644 index 0000000..7d51a2a --- /dev/null +++ b/external/cwiid/wminput/plugins/ir_ptr/Android.mk @@ -0,0 +1,30 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES:= \ + external/bluez/libs/include \ + external/bluez/utils/common \ + $(LOCAL_PATH)/../../../common/include \ + $(LOCAL_PATH)/../../../libcwiid \ + $(LOCAL_PATH)/../../../wminput + +LOCAL_CFLAGS := \ + -DVERSION=\"1.0.0\" + +LOCAL_SRC_FILES:= \ + ir_ptr.c + +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libcutils \ + libwminput \ + libcwiid + +LOCAL_PRELINK_MODULE := false + +LOCAL_MODULE_TAGS := user +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/cwiid-plugin +LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/cwiid-plugin +LOCAL_MODULE := ir_ptr + +include $(BUILD_SHARED_LIBRARY) diff --git a/external/cwiid/wminput/uinput.c b/external/cwiid/wminput/uinput.c index e3fceae..3cd8c58 100644 --- a/external/cwiid/wminput/uinput.c +++ b/external/cwiid/wminput/uinput.c @@ -289,4 +289,7 @@ void *uinput_listen(struct uinput_listen_data *data) break; } } while (-1); +#ifdef ANDROID + return 0; +#endif } diff --git a/system/core/init/devices.c b/system/core/init/devices.c --- a/system/core/init/devices.c +++ b/system/core/init/devices.c @@ -105,7 +105,7 @@ static struct perms_ devperms[] = { { "/dev/tty0", 0660, AID_ROOT, AID_SYSTEM, 0 }, { "/dev/graphics/", 0660, AID_ROOT, AID_GRAPHICS, 1 }, { "/dev/hw3d", 0660, AID_SYSTEM, AID_GRAPHICS, 0 }, - { "/dev/input/", 0660, AID_ROOT, AID_INPUT, 1 }, + { "/dev/input/", 0666, AID_ROOT, AID_INPUT, 1 }, { "/dev/eac", 0660, AID_ROOT, AID_AUDIO, 0 }, { "/dev/cam", 0660, AID_ROOT, AID_CAMERA, 0 }, { "/dev/pmem", 0660, AID_SYSTEM, AID_GRAPHICS, 0 }, diff --git a/system/core/rootdir/init.rc b/system/core/rootdir/init.rc --- a/system/core/rootdir/init.rc +++ b/system/core/rootdir/init.rc @@ -322,3 +322,9 @@ service keystore /system/bin/keystore group keystore socket keystore stream 666 +service wminput /system/xbin/daemonize -d 10 /system/bin/wminput -w -c /etc/cwiid/wminput/acc_ptr + disabled + oneshot + +on property:init.svc.hcid=running + start wminput