Skip to content

Instantly share code, notes, and snippets.

@axsddlr
Created February 23, 2014 20:19
Show Gist options
  • Save axsddlr/9176655 to your computer and use it in GitHub Desktop.
Save axsddlr/9176655 to your computer and use it in GitHub Desktop.
From 1173fb6012c082e683bf155645d56a1cc37012c3 Mon Sep 17 00:00:00 2001
From: Andre Saddler <[email protected]>
Date: Sun, 23 Feb 2014 07:19:12 -0500
Subject: [PATCH] Make only S2s hook available
--
S2S: change sysfs to sweep2sleep directory
---
drivers/input/touchscreen/sweep2wake.c | 58 ++++++++++------------------------
1 file changed, 16 insertions(+), 42 deletions(-)
diff --git a/drivers/input/touchscreen/sweep2wake.c b/drivers/input/touchscreen/sweep2wake.c
index 1aa6b0f..c762716 100644
--- a/drivers/input/touchscreen/sweep2wake.c
+++ b/drivers/input/touchscreen/sweep2wake.c
@@ -43,7 +43,7 @@
/* Version, author, desc, etc */
#define DRIVER_AUTHOR "Dennis Rassmann <[email protected]>"
#define DRIVER_DESCRIPTION "Sweep2wake for almost any device"
-#define DRIVER_VERSION "1.5"
+#define DRIVER_VERSION "1.5-Modded for G2 as sweep2sleep only by Ayysir"
#define LOGTAG "[sweep2wake]: "
MODULE_AUTHOR(DRIVER_AUTHOR);
@@ -54,7 +54,7 @@ MODULE_LICENSE("GPLv2");
/* Tuneables */
#define S2W_DEBUG 0
#define S2W_DEFAULT 0
-#define S2W_S2SONLY_DEFAULT 0
+#define S2S_DEFAULT 0
#define S2W_PWRKEY_DUR 60
#define DEFAULT_S2W_Y_MAX 1920
@@ -65,7 +65,7 @@ MODULE_LICENSE("GPLv2");
#define DEFAULT_S2W_X_FINAL 250
/* Resources */
-int s2w_switch = S2W_DEFAULT, s2w_s2sonly = S2W_S2SONLY_DEFAULT;
+int s2w_switch = S2W_DEFAULT, s2s = S2S_DEFAULT;
static int touch_x = 0, touch_y = 0;
static bool touch_x_called = false, touch_y_called = false;
static bool scr_suspended = false, exec_count = true;
@@ -475,7 +475,7 @@ static struct power_suspend s2w_power_suspend_handler = {
/*
* SYSFS stuff below here
*/
-static ssize_t s2w_sweep2wake_show(struct device *dev,
+static ssize_t s2w_sweep2sleep_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
size_t count = 0;
@@ -485,7 +485,7 @@ static ssize_t s2w_sweep2wake_show(struct device *dev,
return count;
}
-static ssize_t s2w_sweep2wake_dump(struct device *dev,
+static ssize_t s2w_sweep2sleep_dump(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
if (buf[0] >= '0' && buf[0] <= '1' && buf[1] == '\n')
@@ -495,31 +495,9 @@ static ssize_t s2w_sweep2wake_dump(struct device *dev,
return count;
}
-static DEVICE_ATTR(sweep2wake, (S_IWUSR|S_IRUGO),
- s2w_sweep2wake_show, s2w_sweep2wake_dump);
+static DEVICE_ATTR(sweep2sleep, (S_IWUSR|S_IRUGO),
+ s2w_sweep2sleep_show, s2w_sweep2sleep_dump);
-static ssize_t s2w_s2w_s2sonly_show(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- size_t count = 0;
-
- count += sprintf(buf, "%d\n", s2w_s2sonly);
-
- return count;
-}
-
-static ssize_t s2w_s2w_s2sonly_dump(struct device *dev,
- struct device_attribute *attr, const char *buf, size_t count)
-{
- if (buf[0] >= '0' && buf[0] <= '1' && buf[1] == '\n')
- if (s2w_s2sonly != buf[0] - '0')
- s2w_s2sonly = buf[0] - '0';
-
- return count;
-}
-
-static DEVICE_ATTR(s2w_s2sonly, (S_IWUSR|S_IRUGO),
- s2w_s2w_s2sonly_show, s2w_s2w_s2sonly_dump);
static ssize_t s2w_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -544,10 +522,10 @@ static DEVICE_ATTR(sweep2wake_version, (S_IWUSR|S_IRUGO),
* INIT / EXIT stuff below here
*/
#ifdef ANDROID_TOUCH_DECLARED
-extern struct kobject *android_touch_kobj;
+extern struct kobject *sweep2sleep_kobj;
#else
-struct kobject *android_touch_kobj;
-EXPORT_SYMBOL_GPL(android_touch_kobj);
+struct kobject *sweep2sleep_kobj;
+EXPORT_SYMBOL_GPL(sweep2sleep_kobj);
#endif
static int __init sweep2wake_init(void)
@@ -599,20 +577,16 @@ static int __init sweep2wake_init(void)
#endif
#ifndef ANDROID_TOUCH_DECLARED
- android_touch_kobj = kobject_create_and_add("android_touch", NULL) ;
- if (android_touch_kobj == NULL) {
- pr_warn("%s: android_touch_kobj create_and_add failed\n", __func__);
+ sweep2sleep_kobj = kobject_create_and_add("sweep2sleep", NULL) ;
+ if (sweep2sleep_kobj == NULL) {
+ pr_warn("%s: sweep2sleep_kobj create_and_add failed\n", __func__);
}
#endif
- rc = sysfs_create_file(android_touch_kobj, &dev_attr_sweep2wake.attr);
+ rc = sysfs_create_file(sweep2sleep_kobj, &dev_attr_sweep2sleep.attr);
if (rc) {
pr_warn("%s: sysfs_create_file failed for sweep2wake\n", __func__);
}
- rc = sysfs_create_file(android_touch_kobj, &dev_attr_s2w_s2sonly.attr);
- if (rc) {
- pr_warn("%s: sysfs_create_file failed for s2w_s2sonly\n", __func__);
- }
- rc = sysfs_create_file(android_touch_kobj, &dev_attr_sweep2wake_version.attr);
+ rc = sysfs_create_file(sweep2sleep_kobj, &dev_attr_sweep2wake_version.attr);
if (rc) {
pr_warn("%s: sysfs_create_file failed for sweep2wake_version\n", __func__);
}
@@ -628,7 +602,7 @@ err_alloc_dev:
static void __exit sweep2wake_exit(void)
{
#ifndef ANDROID_TOUCH_DECLARED
- kobject_del(android_touch_kobj);
+ kobject_del(sweep2sleep_kobj);
#endif
input_unregister_handler(&s2w_input_handler);
destroy_workqueue(s2w_input_wq);
--
1.9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment