From 15120adcdfd38486243296ad5baf5eb0ed30e14c Mon Sep 17 00:00:00 2001 From: Vishal Bhoj Date: Tue, 6 Oct 2015 15:13:21 +0530 Subject: Remove Evdevtest as Android doesn't support modules Signed-off-by: Vishal Bhoj Change-Id: I0e136cab9f4b9056dbb9cb939cbee6c29855cb1b --- Makefile | 2 +- evdevtest/Android.mk | 9 - evdevtest/Makefile | 26 -- evdevtest/juice_evtest.c | 408 ---------------------- evdevtest/juice_evtest.sh | 33 -- evdevtest/kernel_module/Makefile | 11 - evdevtest/kernel_module/juice_input_test_module.c | 166 --------- 7 files changed, 1 insertion(+), 654 deletions(-) delete mode 100644 evdevtest/Android.mk delete mode 100644 evdevtest/Makefile delete mode 100644 evdevtest/juice_evtest.c delete mode 100755 evdevtest/juice_evtest.sh delete mode 100644 evdevtest/kernel_module/Makefile delete mode 100644 evdevtest/kernel_module/juice_input_test_module.c diff --git a/Makefile b/Makefile index e10781e..b8d222e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ # Linaro ############################################################################# -DIRS = alarmdevtest ashmemtest-basic ashmemtest-expanded logger evdevtest #sync-basic does not build atm +DIRS = alarmdevtest ashmemtest-basic ashmemtest-expanded logger #sync-basic does not build atm CLEANDIRS = $(foreach dir,$(DIRS),clean-$(dir)) .PHONY: all clean $(DIRS) $(CLEANDIRS) diff --git a/evdevtest/Android.mk b/evdevtest/Android.mk deleted file mode 100644 index 1d74d14..0000000 --- a/evdevtest/Android.mk +++ /dev/null @@ -1,9 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) -include $(LOCAL_PATH)/kernel_module/Makefile -$(PRODUCT_OUT)/system/bin/juice_evtest: evdevtest_driver -LOCAL_SRC_FILES := juice_evtest.c -LOCAL_MODULE := juice_evtest -LOCAL_MODULE_TAGS := optional tests - -include $(BUILD_EXECUTABLE) diff --git a/evdevtest/Makefile b/evdevtest/Makefile deleted file mode 100644 index e006ac9..0000000 --- a/evdevtest/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################# -# Copyright (c) 2013 Linaro -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Linaro -############################################################################# - -CC = $(CROSS_COMPILE)gcc -CFLAGS = -O2 -g -EXE = juice_evtest -Q = @ - -$(EXE): juice_evtest.c - @echo -ne "\tCC\t" - @echo $< - $(Q)$(CC) $(CFLAGS) -I. -o $@ $< -lrt - $(MAKE) -C kernel_module - -clean: - @echo -ne "\tRM\t" - @echo $(EXE) - $(Q)$(RM) $(EXE) diff --git a/evdevtest/juice_evtest.c b/evdevtest/juice_evtest.c deleted file mode 100644 index 66f98e4..0000000 --- a/evdevtest/juice_evtest.c +++ /dev/null @@ -1,408 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define debug 0 -#define JUICE_DEBUG() if (debug) \ - do \ - printf("##Juice debug in %s and line ##\n", __FUNCTION__, __LINE__); \ - while(0) - -#define JUICE_ERROR(X) \ - do \ - printf("##Juice error: %s in %s at line %d ##\n", X, __FUNCTION__, __LINE__); \ - while(0) - -#define DELAY 10 -#define CLOCK_REALTIME_ALARM 8 -#define CLOCK_BOOTTIME_ALARM 9 - -#ifndef EVIOCGSUSPENDBLOCK -/* Those calls aren't part of the official kernel - but we're likely - * using Bionic's kernel headers */ -#define EVIOCGSUSPENDBLOCK _IOR('E', 0x91, int) -#define EVIOCSSUSPENDBLOCK _IOW('E', 0x91, int) -#endif - -void sigalarm(int signumber) -{ - /*We just want to test the suspend and resuem - * nothing need to be done here! - */ -} - -static int suspend_resume_test(const int seconds) -{ - int ret; - timer_t timerid; - struct itimerspec its; - struct timespec t1, t2; - struct sigevent se; - struct sigaction act; - sigset_t sigmask; - int signum = SIGRTMAX; - - /* Set up signal handler */ - sigfillset(&act.sa_mask); - act.sa_flags = 0; - act.sa_handler = sigalarm; - sigaction(signum, &act, NULL); - - /* Set up timer */ - memset(&se, 0, sizeof(se)); - se.sigev_notify = SIGEV_SIGNAL; - se.sigev_signo = signum; - se.sigev_value.sival_int = 0; - - if (seconds < 6) { - JUICE_ERROR("Input suspend time less than 6 seconds"); - return -1; - } - - ret = timer_create(CLOCK_REALTIME_ALARM, &se, &timerid); - if (ret < 0) { - JUICE_ERROR("Create alarm timer failed"); - return -1; - } - - memset(&its, 0, sizeof(struct itimerspec)); - ret = clock_gettime(CLOCK_REALTIME_ALARM, &its.it_value); - if (ret < 0) { - JUICE_ERROR("Get time failed"); - return -1; - } - - its.it_value.tv_sec += seconds; - - ret = timer_settime(timerid, TIMER_ABSTIME, &its, NULL); - if (ret < 0) { - JUICE_ERROR("Set alarm timer failed"); - return -1; - } - - /*record the suspend start time*/ - ret = clock_gettime(CLOCK_REALTIME, &t1); - if (ret < 0) { - JUICE_ERROR("Get start time of suspend failed"); - return -1; - } - - /*start suspend the system now*/ - ret = system("echo mem > /sys/power/state"); - if (ret < 0) { - JUICE_ERROR("echo mem to power state failed"); - return -1; - } - - /*record the system resume time*/ - ret = clock_gettime(CLOCK_REALTIME, &t2); - if (ret < 0) { - JUICE_ERROR("Get the suspend end time failed"); - return -1; - } - - if (t2.tv_sec - t1.tv_sec >= seconds) - return 0; - else - return 1; -} - -int main (int argc, char **argv) -{ - struct option lopt[] = { - { "path", required_argument, NULL, 'p' }, - { "help", no_argument, NULL, 'h' }, - { NULL, 0, NULL, 0 }, - }; - - char parameter1 = 0; - int parameter2 = 0; - long long parameter3 = 0; - - char * shopt = "p:h"; - char *evdevice = NULL; - long enable_lock = 1, disable_lock = 0, lockvalue = -1; - int fd, c, opti = 0, ret; - unsigned int clk; - struct input_event ev[64]; - struct timespec tp1, tp2; - - if(getuid()) { - JUICE_ERROR("Not run this test as root"); - return -1; - } - - while ((c = getopt_long(argc, argv, shopt, lopt, &opti)) != -1 ) { - switch (c) { - case 'h': - fprintf(stdout, "Userage:\n" "juice_evtest -p /dev/input/eventX \n"); - break; - case 'p': - evdevice = strdup(optarg); - break; - default: - JUICE_ERROR("Warning, unknown option!"); - break; - } - } - - if (!evdevice) { - JUICE_ERROR("No input device"); - return -1; - } - - /*Open the evdev input device*/ - if ((fd = open(evdevice, O_RDONLY)) < 0) { - JUICE_ERROR("Open input device failed"); - return -1; - } - - - printf("===========================\n"); - printf("Starting input ioctl cmd EVIOCGSUSPENDBLOCK/EVIOCCSUSPENDBLOCK test:\n"); - /* Read lock command */ - if (ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue)) - printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ_TEST1]: test failed\n"); - else - printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ_TEST1]: test passed\n"); - - if (0 == lockvalue) /*default lock value*/ - printf("[EVDEV_TEST2]: test passed\n"); - else - printf("[EVDEV_TEST2]: test failed\n"); - - /*Set user_wake_lock*/ - if (ioctl(fd, EVIOCSSUSPENDBLOCK, enable_lock)) - printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET_TEST3]: test failed\n"); - else - printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET_TEST3]: test passed\n"); - - /*Verfify the lock value equals what we set*/ - ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue); - if (enable_lock == lockvalue) - printf("[EVDEV_TEST4]: test passed\n"); - else { - printf("[EVDEV_TEST4]: test failed\n"); - goto para_test; - } - - /*Start generating input event*/ - ret = system("echo 1 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Enable generate input event failed"); - goto para_test; - } - - /*Judge the system can not suspend*/ - ret = suspend_resume_test(DELAY); - if (1 == ret) - printf("[EVDEV_CMD_DISABLE_SUSPEND_TEST5]: test passed\n"); - else - printf("[EVDEV_CMD_DISABLE_SUSPEND_TEST5]: test failed\n"); - - /*Disable evdev usr_wake_lock*/ - ioctl(fd, EVIOCSSUSPENDBLOCK, disable_lock); - ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue); - if ( disable_lock == lockvalue ) - printf("[EVDEV_TEST6]: test passed\n"); - else - printf("[EVDEV_TEST6]: test failed\n"); - - /*Judge the system can be suspend resume*/ - ret = suspend_resume_test(DELAY); - if (0 == ret) - printf("[EVDEV_ENABLE_SUSPEND_RESUME_TEST7]: test passed\n"); - else - printf("[EVDEV_ENABLE_SUSPEND_RESUME_TEST7]: test failed\n"); - - /*Stop generateing input event*/ - ret = system("echo 0 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Disable generate input event failed"); - goto para_test; - } - - - - /*The followings are the test cases for verifying different parameters*/ -para_test: - /* Null parameters test!*/ - printf("Starting test EVIOCGSUSPENDBLOCK/EVIOCSSUSPENDBLOCK with different parameters:\n"); - ret = ioctl(fd, EVIOCGSUSPENDBLOCK, NULL); - if (ret < 0) - printf("[EVDEV_TEST8]: test passed\n"); - else - printf("[EVDEV_TEST8]: test failed\n"); - - ret = ioctl(fd, EVIOCSSUSPENDBLOCK, NULL); - if (!ret) - printf("[EVDEV_TEST9]: test passed\n"); - else - printf("[EVDEV_TEST9]: test failed\n"); - - /* byte parameters test*/ - ret = ioctl(fd, EVIOCGSUSPENDBLOCK, ¶meter1); - if (!ret) - printf("[EVDEV_TEST10]: test passed\n"); - else - printf("[EVDEV_TEST10]: test failed\n"); - - ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter1); - if (!ret) - printf("[EVDEV_TEST11]: test passed\n"); - else - printf("[EVDEV_TEST11]: test failed\n"); - - /* int parameters test*/ - ret = ioctl(fd, EVIOCGSUSPENDBLOCK, ¶meter2); - if (!ret) - printf("[EVDEV_TEST12]: test passed\n"); - else - printf("[EVDEV_TEST12]: test failed\n"); - - ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter2); - if (!ret) - printf("[EVDEV_TEST13]: test passed\n"); - else - printf("[EVDEV_TEST13]: test failed\n"); - - /* 64bit parameters test*/ - ret = ioctl(fd, EVIOCGSUSPENDBLOCK, ¶meter3); - if (!ret) - printf("[EVDEV_TEST14]: test passed\n"); - else - printf("[EVDEV_TEST14]: test failed\n"); - - ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter3); - if (!ret) - printf("[EVDEV_TEST15]: test passed\n"); - else - printf("[EVDEV_TEST15]: test failed\n"); - - - -/*The followings are testcases for ioctl cmd EVIOCSCLOCKID*/ - printf("Starting EVIOCSCLOCKID test:\n"); - - clk = CLOCK_REALTIME_ALARM; - ret = ioctl(fd, EVIOCSCLOCKID, &clk); - if (ret < 0) - printf("[EVDEV_TEST16]: test passed\n"); - else - printf("[EVDEV_TEST16]: test failed\n"); - - clk = CLOCK_BOOTTIME; - ret = ioctl(fd, EVIOCSCLOCKID, &clk); - if (ret < 0) - printf("[EVDEV_TEST17]: test passed\n"); - else - printf("[EVDEV_TEST17]: test failed\n"); - - ret = ioctl(fd, EVIOCSCLOCKID, NULL); - if (ret < 0) - printf("[EVDEV_TEST18]: test passed\n"); - else - printf("[EVDEV_TEST18]: test failed\n"); - - - /*EVIOCSCLOCKID with CLOCK_REALTIME test start*/ - clk = CLOCK_REALTIME; - ret = ioctl(fd, EVIOCSCLOCKID, &clk); - if (ret < 0) - printf("[EVDEV_TEST19]: test failed\n"); - else - printf("[EVDEV_TEST19]: test passed\n"); - - /*Start generate event*/ - ret = system("echo 1 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Enable generating input event failed"); - goto finish; - } - - ret = clock_gettime(CLOCK_REALTIME, &tp1); - if (ret < 0) - JUICE_ERROR("Get time with clock id REALTIME failed"); - - /*Get event here!*/ - ret = read(fd, ev, sizeof(struct input_event)); - if (ret < (int) sizeof(struct input_event)) - JUICE_ERROR("Reading input event failed"); - - ret = clock_gettime(CLOCK_REALTIME, &tp2); - if (ret < 0) - JUICE_ERROR("Get time with clock id REALTIME failed"); - - if (tp1.tv_sec <= ev[0].time.tv_sec && ev[0].time.tv_sec <= tp2.tv_sec) - printf("[EVDEV_TEST20]: test passed\n"); - else - printf("[EVDEV_TEST20]: test failed\n"); - - /*Stop generate input event*/ - ret = system("echo 0 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Disable generating input event failed"); - goto finish; - } - /*EVIOCSCLOCKID with CLOCK_REALTIME test end*/ - - - /*EVIOCSCLOCKID with CLOCK_MONOTONIC test start*/ - close(fd); - if ((fd = open(evdevice, O_RDONLY)) < 0) { - JUICE_ERROR("Open input device failed"); - return -1; - } - - clk = CLOCK_MONOTONIC; - ret = ioctl(fd, EVIOCSCLOCKID, &clk); - if (ret < 0) - printf("[EVDEV_TEST21]: test failed\n"); - else - printf("[EVDEV_TEST21]: test passed\n"); - - ret = system("echo 1 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Enable generating input event failed"); - goto finish; - } - - ret = clock_gettime(CLOCK_MONOTONIC, &tp1); - if (ret < 0) - JUICE_ERROR("Get time with clock id MONOTONIC failed"); - - /*Get event here!*/ - ret = read(fd, ev, sizeof(struct input_event)); - if (ret < (int) sizeof(struct input_event)) - JUICE_ERROR("Reading input event failed"); - - ret = clock_gettime(CLOCK_MONOTONIC, &tp2); - if (ret < 0) - JUICE_ERROR("Get time with clock id MONOTONIC failed"); - - if (tp1.tv_sec <= ev[0].time.tv_sec && ev[0].time.tv_sec<= tp2.tv_sec) - printf("[EVDEV_TEST22]: test passed\n"); - else - printf("[EVDEV_TEST22]: test failed\n"); - - /*Stop generate input event*/ - ret = system("echo 0 > /sys/juice_input/run"); - if (ret < 0) { - JUICE_ERROR("Disable generating input event failed"); - goto finish; - } - /*EVIOCSCLOCKID with CLOCK_MONOTONIC test end*/ - -finish: - close(fd); - printf("===========================\n"); - return 0; -} diff --git a/evdevtest/juice_evtest.sh b/evdevtest/juice_evtest.sh deleted file mode 100755 index 4f5f2e0..0000000 --- a/evdevtest/juice_evtest.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/system/bin/sh - -rc=0 - -if [ ! -e /system/modules/juice_input_test_module.ko ]; then - echo "juice input kernel module doesn't exist!" - exit -fi - -insmod /system/modules/juice_input_test_module.ko -rc=$? -if [ $rc -ne 0 ]; then - echo "Insmod juice input kernel module failed!" - exit -fi - -N=`dmesg |grep Juice|awk -F '' '{print $NF}'` - -echo "Evdev IOCTL CMD TEST START" -juice_evtest -p /dev/input/event$N -rc=$? -if [ $rc -ne 0 ]; then - echo "Evdev IOCTL CMD TEST FAIL!" -else - echo "EVDEV IOCTL CMD TEST FINISH" -fi - -rmmod juice_input_test_module -rc=$? -if [ $rc -ne 0 ]; then - echo "Remove juice input kernel module failed!" -fi - diff --git a/evdevtest/kernel_module/Makefile b/evdevtest/kernel_module/Makefile deleted file mode 100644 index cd62ba4..0000000 --- a/evdevtest/kernel_module/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -obj-m := juice_input_test_module.o - -KERNELDIR ?= $(PRODUCT_OUT)/obj/kernel/ - -evdevtest_driver: android_kernel_modules $(INSTALLED_KERNEL_TARGET) $(ACP) - export PATH=$(KERNEL_COMPILER_PATHS):$(PATH) &&\ - cd $(TOP)/external/linaro-android-kernel-test/evdevtest/kernel_module &&\ - if [ -e $(KERNEL_TOOLS_PREFIX)ld.bfd ]; then LD=$(KERNEL_TOOLS_PREFIX)ld.bfd; else LD=$(KERNEL_TOOLS_PREFIX)ld; fi && \ - $(MAKE) O=$(KERNEL_OUT) ARCH=$(ARCH) CROSS_COMPILE=$(KERNEL_TOOLS_PREFIX) LD=$$LD KCFLAGS="$(TARGET_EXTRA_CFLAGS) -fno-pic $(LOCAL_CFLAGS)" -C $(KERNEL_PATH) M=`pwd` modules - mkdir -p $(TARGET_OUT)/modules - find $(TOP)/external/linaro-android-kernel-test/evdevtest/kernel_module -name "*.ko" -exec $(ACP) -fpt {} $(TARGET_OUT)/modules/ \; diff --git a/evdevtest/kernel_module/juice_input_test_module.c b/evdevtest/kernel_module/juice_input_test_module.c deleted file mode 100644 index 6472d7f..0000000 --- a/evdevtest/kernel_module/juice_input_test_module.c +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 Linaro - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Linaro - * - * Test module for test new evdev ioctl commands: - * EVIOCGSUSPENDBLOCK, EVIOCSSUSPENDBLOCK, EVIOCSCLOCKID - */ - -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Bintian Wang "); -MODULE_DESCRIPTION("Linaro Juice ioctl evdev test"); -MODULE_LICENSE("GPL"); - -static unsigned char juice_keycode[10] = { - [0] = KEY_1, - [1] = KEY_2, - [2] = KEY_3, - [3] = KEY_4, - [4] = KEY_5, - [5] = KEY_6, - [6] = KEY_7, - [7] = KEY_8, - [8] = KEY_9, - [9] = KEY_0, -}; - -static struct input_dev *juice_testkbd; - -static unsigned int run = 0; -static unsigned int interval = 500; /*Defualt interval for reporting key to up layer*/ - -struct workqueue_struct *juice_kbd_wq; - -struct kobject *juice_sys; - -static void juice_key_report(struct work_struct *work) -{ - while(1) - { - if(run) - { - /*For test, just report KEY8 and KEY_9 here*/ - input_report_key(juice_testkbd, KEY_8, 1); - input_report_key(juice_testkbd, KEY_8, 0); - input_report_key(juice_testkbd, KEY_9, 1); - input_report_key(juice_testkbd, KEY_9, 0); - input_sync(juice_testkbd); - msleep(interval); - } else { - break; - } - } -} - -static DECLARE_WORK(juice_kbd_wk, &juice_key_report); - -static ssize_t run_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) -{ - return sprintf(buf, "%d \n", run); -} - -static ssize_t run_store(struct kobject *kobj, struct kobj_attribute *attr, - const char *buf, size_t count) -{ - int err; - - err = kstrtouint(buf, 10, &run); - if (err) - return err; - - if(1 == run) - queue_work(juice_kbd_wq, &juice_kbd_wk); - - return count; -} - -static ssize_t interval_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) -{ - return sprintf(buf, "%d ms \n", interval); -} - -static ssize_t interval_store(struct kobject *kobj, struct kobj_attribute *attr, - const char *buf, size_t count) -{ - int err; - - err = kstrtouint(buf, 10, &interval); - if (err) - return err; - - if (interval > 1000) - interval = 1000; - - return count; -} - -static struct kobj_attribute run_attr = - __ATTR(run, 0777, run_show, run_store); - -static struct kobj_attribute interval_attr = - __ATTR(interval, 0777, interval_show, interval_store); - - -static int __init juice_testkbd_init(void) -{ - int i, error; - - juice_testkbd = input_allocate_device(); - if (!juice_testkbd) - return -ENOMEM; - - juice_testkbd->name = "Juice EVDEV Test Module"; - - juice_testkbd->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); - juice_testkbd->keycode = juice_keycode; - juice_testkbd->keycodesize = sizeof(unsigned char); - juice_testkbd->keycodemax = ARRAY_SIZE(juice_keycode); - - for (i = 0; i < 10; i++) - set_bit(juice_keycode[i], juice_testkbd->keybit); - - error = input_register_device(juice_testkbd); - if (error) { - input_free_device(juice_testkbd); - return error; - } - - juice_kbd_wq = create_workqueue("juice_input_test_wq"); - - juice_sys = kobject_create_and_add("juice_input", NULL); - if (!juice_sys) - return -ENOMEM; - - sysfs_create_file(juice_sys, &run_attr.attr); - - sysfs_create_file(juice_sys, &interval_attr.attr); - - return 0; -} - -static void __exit juice_testkbd_exit(void) -{ - sysfs_remove_file(juice_sys, &run_attr.attr); - sysfs_remove_file(juice_sys, &interval_attr.attr); - kobject_del(juice_sys); - - flush_workqueue(juice_kbd_wq); - destroy_workqueue(juice_kbd_wq); - juice_kbd_wq = NULL; - - input_unregister_device(juice_testkbd); -} - -module_init(juice_testkbd_init); -module_exit(juice_testkbd_exit); -- cgit v1.2.3