summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhoj <vishal.bhoj@linaro.org>2015-10-06 15:50:14 +0530
committerVishal Bhoj <vishal.bhoj@linaro.org>2015-10-06 15:50:37 +0530
commit3fdcb256434e53c263f44f604908e5d8f445096f (patch)
tree52ec2f1053e8eb9a3cae01f21667ae280387e27b
parent75cb82c863fdb19ee514f75f841454c9a9fc7c72 (diff)
downloadlinaro-android-kernel-test-3fdcb256434e53c263f44f604908e5d8f445096f.tar.gz
Remove Evdevtest as Android doesn't support modules
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org> Change-Id: I9ccbdc3dd644bf06db00458e76055fbafccc2d20
-rw-r--r--Makefile2
-rw-r--r--evdevtest/Android.mk11
-rw-r--r--evdevtest/Makefile26
-rw-r--r--evdevtest/juice_evtest.c407
-rwxr-xr-xevdevtest/juice_evtest.sh46
-rw-r--r--evdevtest/kernel_module/Makefile11
-rw-r--r--evdevtest/kernel_module/juice_input_test_module.c166
7 files changed, 1 insertions, 668 deletions
diff --git a/Makefile b/Makefile
index e10781e..b8d222e 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@
# Linaro <linaro-dev@lists.linaro.org>
#############################################################################
-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 f736ed3..0000000
--- a/evdevtest/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-ifeq ($(strip $(TARGET_PREBUILT_KERNEL)),)
-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)
-endif
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 <linaro-dev@lists.linaro.org>
-#############################################################################
-
-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 d110cb8..0000000
--- a/evdevtest/juice_evtest.c
+++ /dev/null
@@ -1,407 +0,0 @@
-#include <linux/input.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <getopt.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-
-#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 ##: %s\n", X, __FUNCTION__, __LINE__, strerror(errno)); \
- 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;
- unsigned int 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]: test failed\n");
- else
- printf("[EVDEV_EVIOCGSUSPENDBLOCK_READ]: test passed\n");
-
- if (0 == lockvalue) /*default lock value*/
- printf("[EVDEV_EVIOCGSUSPENDBLOCK_VALUE_ZERO]: test passed\n");
- else
- printf("[EVDEV_EVIOCGSUSPENDBLOCK_VALUE_ZERO]: test failed\n");
-
- /*Set user_wake_lock*/
- if (ioctl(fd, EVIOCSSUSPENDBLOCK, enable_lock))
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET]: test failed\n");
- else
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_SET]: test passed\n");
-
- /*Verfify the lock value equals what we set*/
- ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue);
- if (enable_lock == lockvalue)
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_ENABLED]: test passed\n");
- else {
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_ENABLED]: 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]: test passed\n");
- else
- printf("[EVDEV_CMD_DISABLE_SUSPEND]: test failed\n");
-
- /*Disable evdev usr_wake_lock*/
- ioctl(fd, EVIOCSSUSPENDBLOCK, disable_lock);
- ioctl(fd, EVIOCGSUSPENDBLOCK, &lockvalue);
- if ( disable_lock == lockvalue )
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_DISABLED]: test passed\n");
- else
- printf("[EVDEV_EVIOCSSUSPENDBLOCK_DISABLED]: test failed\n");
-
- /*Judge the system can be suspend resume*/
- ret = suspend_resume_test(DELAY);
- if (0 == ret)
- printf("[EVDEV_ENABLE_SUSPEND_RESUME]: test passed\n");
- else
- printf("[EVDEV_ENABLE_SUSPEND_RESUME]: 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_PARA_EVIOCGSUSPENDBLOCK_NULL]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_NULL]: test failed\n");
-
- ret = ioctl(fd, EVIOCSSUSPENDBLOCK, NULL);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_NULL]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_NULL]: test failed\n");
-
- /* byte parameters test*/
- ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter1);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_CHAR]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_CHAR]: test failed\n");
-
- ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter1);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_CHAR]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_CHAR]: test failed\n");
-
- /* int parameters test*/
- ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter2);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_INT]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_INT]: test failed\n");
-
- ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter2);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_INT]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_INT]: test failed\n");
-
- /* 64bit parameters test*/
- ret = ioctl(fd, EVIOCGSUSPENDBLOCK, &parameter3);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_LONG_LONG]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCGSUSPENDBLOCK_LONG_LONG]: test failed\n");
-
- ret = ioctl(fd, EVIOCSSUSPENDBLOCK, parameter3);
- if (!ret)
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_LONG_LONG]: test passed\n");
- else
- printf("[EVDEV_PARA_EVIOCSSUSPENDBLOCK_LONG_LONG]: 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_EVIOCSCLOCKID_CLOCK_REALTIME_ALARM]: test passed\n");
- else
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME_ALARM]: test failed\n");
-
- clk = CLOCK_BOOTTIME;
- ret = ioctl(fd, EVIOCSCLOCKID, &clk);
- if (ret < 0)
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_BOOTTIME]: test passed\n");
- else
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_BOOTTIME]: test failed\n");
-
- ret = ioctl(fd, EVIOCSCLOCKID, NULL);
- if (ret < 0)
- printf("[EVDEV_EVIOCSCLOCKID_NULL]: test passed\n");
- else
- printf("[EVDEV_EVIOCSCLOCKID_NULL]: test failed\n");
-
-
- /*EVIOCSCLOCKID with CLOCK_REALTIME test start*/
- clk = CLOCK_REALTIME;
- ret = ioctl(fd, EVIOCSCLOCKID, &clk);
- if (ret < 0)
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME]: test failed\n");
- else
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_REALTIME]: 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_CLOCK_REALTIME]: test passed\n");
- else
- printf("[EVDEV_CLOCK_REALTIME]: 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_EVIOCSCLOCKID_CLOCK_MONOTONIC]: test failed\n");
- else
- printf("[EVDEV_EVIOCSCLOCKID_CLOCK_MONOTONIC]: 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_CLOCK_MONOTONIC]: test passed\n");
- else
- printf("[EVDEV_CLOCK_MONOTONIC]: 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 9c3dd20..0000000
--- a/evdevtest/juice_evtest.sh
+++ /dev/null
@@ -1,46 +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
-
-rmmod juice_input_test_module
-
-insmod /system/modules/juice_input_test_module.ko
-rc=$?
-if [ $rc -ne 0 ]; then
- echo "Insmod juice input kernel module failed!"
- exit
-fi
-
-input_dev=""
-for dev in $(ls /dev/input/event*);do
- if getevent -i "${dev}"|grep -q "Juice EVDEV Test Module"; then
- input_dev=${dev}
- break
- fi
-done
-
-if [ -z "${input_dev}" ]; then
- echo "Failed to find the input device for kernel evdev test"
- exit 1
-fi
-
-echo "Evdev IOCTL CMD TEST START"
-juice_evtest -p ${input_dev}
-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 10b04d9..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 $(realpath $(TOP))/$(KERNEL_SRC) 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 8873134..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 <linaro-dev@lists.linaro.org>
- *
- * Test module for test new evdev ioctl commands:
- * EVIOCGSUSPENDBLOCK, EVIOCSSUSPENDBLOCK, EVIOCSCLOCKID
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/input.h>
-#include <linux/delay.h>
-#include <linux/workqueue.h>
-
-MODULE_AUTHOR("Bintian Wang <bintian.wang@linaro.org>");
-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, 0775, run_show, run_store);
-
-static struct kobj_attribute interval_attr =
- __ATTR(interval, 0775, 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);