aboutsummaryrefslogtreecommitdiff
path: root/frontend/plat_pandora.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/plat_pandora.c')
-rw-r--r--frontend/plat_pandora.c141
1 files changed, 139 insertions, 2 deletions
diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c
index 20abd68..fb33056 100644
--- a/frontend/plat_pandora.c
+++ b/frontend/plat_pandora.c
@@ -14,13 +14,16 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/input.h>
+#include <dirent.h>
#include <errno.h>
#include "common/input.h"
#include "linux/in_evdev.h"
#include "plugin_lib.h"
#include "plat.h"
+#include "plat_omap.h"
#include "main.h"
+#include "menu.h"
static const char * const pandora_gpio_keys[KEY_MAX + 1] = {
[0 ... KEY_MAX] = NULL,
@@ -65,10 +68,85 @@ static const struct in_default_bind in_evdev_defbinds[] = {
{ 0, 0, 0 }
};
-int plat_pandora_init(void)
+static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
+static char **pnd_filter_list;
+
+static void scan_for_filters(void)
+{
+ struct dirent *ent;
+ int i, count = 0;
+ char **mfilters;
+ char buff[64];
+ DIR *dir;
+
+ dir = opendir("/etc/pandora/conf/dss_fir");
+ if (dir == NULL) {
+ perror("filter opendir");
+ return;
+ }
+
+ while (1) {
+ errno = 0;
+ ent = readdir(dir);
+ if (ent == NULL) {
+ if (errno != 0)
+ perror("readdir");
+ break;
+ }
+
+ if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
+ continue;
+
+ count++;
+ }
+
+ if (count == 0)
+ return;
+
+ mfilters = calloc(count + 1, sizeof(mfilters[0]));
+ if (mfilters == NULL)
+ return;
+
+ rewinddir(dir);
+ for (i = 0; (ent = readdir(dir)); ) {
+ size_t len;
+
+ if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
+ continue;
+
+ len = strlen(ent->d_name);
+
+ // skip pre-HF5 extra files
+ if (len >= 3 && strcmp(ent->d_name + len - 3, "_v3") == 0)
+ continue;
+ if (len >= 3 && strcmp(ent->d_name + len - 3, "_v5") == 0)
+ continue;
+
+ // have to cut "_up_h" for pre-HF5
+ if (len > 5 && strcmp(ent->d_name + len - 5, "_up_h") == 0)
+ len -= 5;
+
+ if (len > sizeof(buff) - 1)
+ continue;
+
+ strncpy(buff, ent->d_name, len);
+ buff[len] = 0;
+ mfilters[i] = strdup(buff);
+ if (mfilters[i] != NULL)
+ i++;
+ }
+ closedir(dir);
+
+ pnd_filter_list = mfilters;
+ menu_set_filter_list((void *)mfilters);
+}
+
+int plat_init(void)
{
int gpiokeys_id;
+ plat_omap_init();
+
in_evdev_init(in_evdev_defbinds);
in_probe();
gpiokeys_id = in_name_to_id("evdev:gpio-keys");
@@ -78,10 +156,60 @@ int plat_pandora_init(void)
in_adev[0] = in_name_to_id("evdev:nub0");
in_adev[1] = in_name_to_id("evdev:nub1");
+ scan_for_filters();
+
return 0;
}
-static const char pnd_script_base[] = "sudo -n /usr/pandora/scripts";
+void plat_finish(void)
+{
+ plat_omap_finish();
+}
+
+static void apply_lcdrate(int pal)
+{
+ char buf[128];
+
+ snprintf(buf, sizeof(buf), "%s/op_lcdrate.sh %d",
+ pnd_script_base, pal ? 50 : 60);
+ system(buf);
+}
+
+static void apply_filter(int which)
+{
+ char buf[128];
+ int i;
+
+ if (pnd_filter_list == NULL)
+ return;
+
+ for (i = 0; i < which; i++)
+ if (pnd_filter_list[i] == NULL)
+ return;
+
+ if (pnd_filter_list[i] == NULL)
+ return;
+
+ snprintf(buf, sizeof(buf), "%s/op_videofir.sh %s",
+ pnd_script_base, pnd_filter_list[i]);
+ system(buf);
+}
+
+void plat_gvideo_open(int is_pal)
+{
+ static int old_pal = -1, old_filter = -1;
+
+ if (is_pal != old_pal) {
+ apply_lcdrate(is_pal);
+ old_pal = is_pal;
+ }
+ if (filter != old_filter) {
+ apply_filter(filter);
+ old_filter = filter;
+ }
+
+ plat_omap_gvideo_open();
+}
int plat_cpu_clock_get(void)
{
@@ -118,3 +246,12 @@ int plat_get_bat_capacity(void)
}
return ret;
}
+
+void plat_step_volume(int is_up)
+{
+}
+
+void plat_trigger_vibrate(int is_strong)
+{
+}
+