aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/320240/haptic_s.cfg (renamed from frontend/320240/haptic.txt)0
-rw-r--r--frontend/320240/haptic_w.cfg3
-rw-r--r--frontend/plat_dummy.c2
-rw-r--r--frontend/plat_omap.c2
-rw-r--r--frontend/plat_pollux.c37
5 files changed, 31 insertions, 13 deletions
diff --git a/frontend/320240/haptic.txt b/frontend/320240/haptic_s.cfg
index 624056d..624056d 100644
--- a/frontend/320240/haptic.txt
+++ b/frontend/320240/haptic_s.cfg
diff --git a/frontend/320240/haptic_w.cfg b/frontend/320240/haptic_w.cfg
new file mode 100644
index 0000000..3585a71
--- /dev/null
+++ b/frontend/320240/haptic_w.cfg
@@ -0,0 +1,3 @@
+0 54
+100 -126
+105 0
diff --git a/frontend/plat_dummy.c b/frontend/plat_dummy.c
index 7929015..6249df5 100644
--- a/frontend/plat_dummy.c
+++ b/frontend/plat_dummy.c
@@ -68,7 +68,7 @@ void plat_step_volume(int is_up)
{
}
-void plat_trigger_vibrate(void)
+void plat_trigger_vibrate(int is_strong)
{
}
diff --git a/frontend/plat_omap.c b/frontend/plat_omap.c
index 998e1df..3a6a948 100644
--- a/frontend/plat_omap.c
+++ b/frontend/plat_omap.c
@@ -132,7 +132,7 @@ void plat_step_volume(int is_up)
{
}
-void plat_trigger_vibrate(void)
+void plat_trigger_vibrate(int is_strong)
{
}
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index d402e84..c03173e 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -689,21 +689,22 @@ struct haptic_data {
#define HAPTIC_SET_VIB_LEVEL _IOW(HAPTIC_IOCTL_MAGIC, 9, unsigned int)
static int hapticdev = -1;
-static struct haptic_data haptic_seq;
+static struct haptic_data haptic_seq[2];
-static int haptic_init(void)
+static int haptic_read(const char *fname, struct haptic_data *data)
{
int i, ret, v1, v2;
char buf[128], *p;
FILE *f;
- f = fopen("haptic.txt", "r");
+ f = fopen(fname, "r");
if (f == NULL) {
- perror("fopen(haptic.txt)");
+ fprintf("fopen(%s)", fname);
+ perror("");
return -1;
}
- for (i = 0; i < sizeof(haptic_seq.actions) / sizeof(haptic_seq.actions[0]); ) {
+ for (i = 0; i < sizeof(data->actions) / sizeof(data->actions[0]); ) {
p = fgets(buf, sizeof(buf), f);
if (p == NULL)
break;
@@ -718,17 +719,31 @@ static int haptic_init(void)
continue;
}
- haptic_seq.actions[i].time = v1;
- haptic_seq.actions[i].strength = v2;
+ data->actions[i].time = v1;
+ data->actions[i].strength = v2;
i++;
}
fclose(f);
if (i == 0) {
- fprintf(stderr, "bad haptic.txt\n");
+ fprintf(stderr, "bad haptic file: %s\n", fname);
return -1;
}
- haptic_seq.count = i;
+ data->count = i;
+
+ return 0;
+}
+
+static int haptic_init(void)
+{
+ int ret, i;
+
+ ret = haptic_read("haptic_w.cfg", &haptic_seq[0]);
+ if (ret != 0)
+ return -1;
+ ret = haptic_read("haptic_s.cfg", &haptic_seq[1]);
+ if (ret != 0)
+ return -1;
hapticdev = open("/dev/isa1200", O_RDWR | O_NONBLOCK);
if (hapticdev == -1) {
@@ -750,7 +765,7 @@ static int haptic_init(void)
return 0;
}
-void plat_trigger_vibrate(void)
+void plat_trigger_vibrate(int is_strong)
{
int ret;
@@ -764,7 +779,7 @@ void plat_trigger_vibrate(void)
}
}
- ioctl(hapticdev, HAPTIC_PLAY_PATTERN, &haptic_seq);
+ ioctl(hapticdev, HAPTIC_PLAY_PATTERN, &haptic_seq[!!is_strong]);
}
/* Wiz stuff */