Add conf files 29/197429/2
authorpr.jung <pr.jung@samsung.com>
Fri, 11 Jan 2019 06:49:09 +0000 (15:49 +0900)
committerpr.jung <pr.jung@samsung.com>
Thu, 17 Jan 2019 04:53:44 +0000 (13:53 +0900)
- Add level3 and level6 conf files
- Modify not to change the value of input parameter
- Change strncmp to strcmp for pattern string comparison

Change-Id: I1e2a00cb211fd6d1fb4fdf8b9ad72eaee86a65c1
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/haptic/conf/haptic-level3.conf [new file with mode: 0644]
src/haptic/conf/haptic-level6.conf [new file with mode: 0644]
src/haptic/standard-vibcore.c
src/haptic/standard.c

diff --git a/src/haptic/conf/haptic-level3.conf b/src/haptic/conf/haptic-level3.conf
new file mode 100644 (file)
index 0000000..6e52318
--- /dev/null
@@ -0,0 +1,15 @@
+[Haptic]
+# level
+#   how much does the vibration level to subdivide.
+#   The max value of vibration level fixed at 100.
+#   The min value of vibration level fixed at 0.
+level=3
+
+[level0]
+value=0
+
+[level1]
+value=58
+
+[level2]
+value=100
diff --git a/src/haptic/conf/haptic-level6.conf b/src/haptic/conf/haptic-level6.conf
new file mode 100644 (file)
index 0000000..84271f1
--- /dev/null
@@ -0,0 +1,24 @@
+[Haptic]
+# level
+#   how much does the vibration level to subdivide.
+#   The max value of vibration level fixed at 100.
+#   The min value of vibration level fixed at 0.
+level=6
+
+[level0]
+value=0
+
+[level1]
+value=20
+
+[level2]
+value=40
+
+[level3]
+value=60
+
+[level4]
+value=80
+
+[level5]
+value=100
index 0d8f5c0..2a1cf3e 100644 (file)
@@ -84,7 +84,6 @@ static int insert_conf_data(dd_list **conf_data, struct duration_data *update)
        // to debug :
        // _D("%dD%dI%dF%dO%dW", data->duration, data->intensity, data->frequency, data->overdriving, data->wait);
        DD_LIST_APPEND(*conf_data, data);
-       memset(update, 0, sizeof(struct duration_data));
        return 0;
 }
 
@@ -240,6 +239,7 @@ static int load_standard_format(char *pattern)
 
                                if (insert_conf_data(&conf->data, &update) < 0)
                                        goto error_out;
+                               memset(&update, 0, sizeof(struct duration_data));
                                break;
                        case 3: /* F */
                                if (intensity != 0)
@@ -410,7 +410,7 @@ int standard_is_supported(const char *pattern)
        DD_LIST_FOREACH(vib_conf_list, elem, conf) {
                if (!conf->pattern || conf->len != len)
                        continue;
-               if (!strncmp(conf->pattern, pattern, len)) {
+               if (!strcmp(conf->pattern, pattern)) {
                        ret = true;
                        break;
                }
@@ -495,7 +495,6 @@ int standard_vibrate_effect(int device_handle, const char *requested_pattern, in
 {
        dd_list *elem;
        struct vibration_config *conf;
-       size_t len;
        char pattern[PATH_MAX];
        int ret;
        int unlimit = 0;
@@ -510,16 +509,14 @@ int standard_vibrate_effect(int device_handle, const char *requested_pattern, in
        }
 
        snprintf(pattern, sizeof(pattern), "%s", requested_pattern);
-       len = strlen(pattern) + 1;
        DD_LIST_FOREACH(vib_conf_list, elem, conf) {
-               if (!conf->pattern || conf->len != len)
+               if (!conf->pattern)
                        continue;
-               if (strncmp(conf->pattern, pattern, len))
+               if (strcmp(conf->pattern, pattern))
                        continue;
                if (conf->standard) {
                        unlimit = conf->unlimit;
                        snprintf(pattern, sizeof(pattern), "%s", conf->standard);
-                       len = strlen(pattern) + 1;
                        continue;
                }
 
index dd162b2..d43f965 100644 (file)
@@ -76,6 +76,7 @@ static char ff_path[PATH_MAX];
 static int unique_number;
 
 static int stop_device(int device_handle);
+
 struct ff_info *read_from_list(int handle)
 {
        struct ff_info *temp;