frontend: input driver and volume control for Wiz
authornotaz <notasas@gmail.com>
Sun, 30 Oct 2011 19:29:01 +0000 (21:29 +0200)
committernotaz <notasas@gmail.com>
Sun, 30 Oct 2011 21:57:12 +0000 (23:57 +0200)
13 files changed:
.gitignore
Makefile
frontend/gp2x/in_gp2x.c [new file with mode: 0644]
frontend/gp2x/in_gp2x.h [new file with mode: 0644]
frontend/main.c
frontend/main.h
frontend/menu.c
frontend/menu.h
frontend/plat.h
frontend/plat_dummy.c
frontend/plat_omap.c
frontend/plat_pollux.c
maemo/hildon.c

index 6199832..b59cf68 100644 (file)
@@ -3,6 +3,7 @@ frontend/revision.h
 frontend/linux
 frontend/common
 frontend/X11
+frontend/gp2x
 tags
 cscope.out
 pandora
index b25c861..7288ef1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -132,7 +132,7 @@ OBJS += frontend/plat_pandora.o
 else
 ifeq "$(PLATFORM)" "caanoo"
 OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
-OBJS += frontend/warm/warm.o
+OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o
 else
 OBJS += frontend/plat_dummy.o
 endif
diff --git a/frontend/gp2x/in_gp2x.c b/frontend/gp2x/in_gp2x.c
new file mode 100644 (file)
index 0000000..b750e68
--- /dev/null
@@ -0,0 +1,324 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "../common/input.h"
+#include "in_gp2x.h"
+
+#define IN_GP2X_PREFIX "gp2x:"
+#define IN_GP2X_NBUTTONS 32
+
+/* note: in_gp2x hadles combos (if 2 btns have the same bind,
+ * both must be pressed for action to happen) */
+static int in_gp2x_combo_keys = 0;
+static int in_gp2x_combo_acts = 0;
+static int gpiodev = -1;       /* Wiz only */
+
+static int (*in_gp2x_get_bits)(void);
+
+static const char *in_gp2x_keys[IN_GP2X_NBUTTONS] = {
+       [0 ... IN_GP2X_NBUTTONS-1] = NULL,
+       [GP2X_BTN_UP]    = "Up",    [GP2X_BTN_LEFT]   = "Left",
+       [GP2X_BTN_DOWN]  = "Down",  [GP2X_BTN_RIGHT]  = "Right",
+       [GP2X_BTN_START] = "Start", [GP2X_BTN_SELECT] = "Select",
+       [GP2X_BTN_L]     = "L",     [GP2X_BTN_R]      = "R",
+       [GP2X_BTN_A]     = "A",     [GP2X_BTN_B]      = "B",
+       [GP2X_BTN_X]     = "X",     [GP2X_BTN_Y]      = "Y",
+       [GP2X_BTN_VOL_DOWN] = "VOL DOWN",
+       [GP2X_BTN_VOL_UP]   = "VOL UP",
+       [GP2X_BTN_PUSH]     = "PUSH"
+};
+
+
+static int in_gp2x_get_mmsp2_bits(void)
+{
+       extern volatile unsigned short *gp2x_memregs;
+       int value;
+       value = gp2x_memregs[0x1198>>1] & 0xff; // GPIO M
+       if (value == 0xFD) value = 0xFA;
+       if (value == 0xF7) value = 0xEB;
+       if (value == 0xDF) value = 0xAF;
+       if (value == 0x7F) value = 0xBE;
+       value |= gp2x_memregs[0x1184>>1] & 0xFF00; // GPIO C
+       value |= gp2x_memregs[0x1186>>1] << 16; // GPIO D
+       value = ~value & 0x08c0ff55;
+
+       return value;
+}
+
+static int in_gp2x_get_wiz_bits(void)
+{
+       int r, value = 0;
+       r = read(gpiodev, &value, 4);
+       if (value & 0x02)
+               value |= 0x05;
+       if (value & 0x08)
+               value |= 0x14;
+       if (value & 0x20)
+               value |= 0x50;
+       if (value & 0x80)
+               value |= 0x41;
+
+       /* convert to GP2X style */
+       value &= 0x7ff55;
+       if (value & (1 << 16))
+               value |= 1 << GP2X_BTN_VOL_UP;
+       if (value & (1 << 17))
+               value |= 1 << GP2X_BTN_VOL_DOWN;
+       if (value & (1 << 18))
+               value |= 1 << GP2X_BTN_PUSH;
+       value &= ~0x70000;
+
+       return value;
+}
+
+#ifdef FAKE_IN_GP2X
+volatile unsigned short *gp2x_memregs;
+int gp2x_dev_id = -1;
+
+static int in_gp2x_get_fake_bits(void)
+{
+       extern int current_keys;
+       return current_keys;
+}
+#endif
+
+static void in_gp2x_probe(void)
+{
+       switch (gp2x_dev_id)
+       {
+       case GP2X_DEV_GP2X:
+               in_gp2x_get_bits = in_gp2x_get_mmsp2_bits;
+               break;
+       case GP2X_DEV_WIZ:
+               gpiodev = open("/dev/GPIO", O_RDONLY);
+               if (gpiodev < 0) {
+                       perror("in_gp2x: couldn't open /dev/GPIO");
+                       return;
+               }
+               in_gp2x_get_bits = in_gp2x_get_wiz_bits;
+               break;
+       // we'll use evdev for Caanoo
+       default:
+#ifdef FAKE_IN_GP2X
+               in_gp2x_get_bits = in_gp2x_get_fake_bits;
+               break;
+#endif
+               return;
+       }
+
+       in_register(IN_GP2X_PREFIX "GP2X pad", -1, NULL,
+               IN_GP2X_NBUTTONS, in_gp2x_keys, 1);
+}
+
+static void in_gp2x_free(void *drv_data)
+{
+       if (gpiodev >= 0) {
+               close(gpiodev);
+               gpiodev = -1;
+       }
+}
+
+static const char * const *
+in_gp2x_get_key_names(int *count)
+{
+       *count = IN_GP2X_NBUTTONS;
+       return in_gp2x_keys;
+}
+
+/* ORs result with pressed buttons */
+static int in_gp2x_update(void *drv_data, const int *binds, int *result)
+{
+       int type_start = 0;
+       int i, t, keys;
+
+       keys = in_gp2x_get_bits();
+
+       if (keys & in_gp2x_combo_keys) {
+               result[IN_BINDTYPE_EMU] = in_combos_do(keys, binds, GP2X_BTN_PUSH,
+                                               in_gp2x_combo_keys, in_gp2x_combo_acts);
+               type_start = IN_BINDTYPE_PLAYER12;
+       }
+
+       for (i = 0; keys; i++, keys >>= 1) {
+               if (!(keys & 1))
+                       continue;
+
+               for (t = type_start; t < IN_BINDTYPE_COUNT; t++)
+                       result[t] |= binds[IN_BIND_OFFS(i, t)];
+       }
+
+       return 0;
+}
+
+int in_gp2x_update_keycode(void *data, int *is_down)
+{
+       static int old_val = 0;
+       int val, diff, i;
+
+       val = in_gp2x_get_bits();
+       diff = val ^ old_val;
+       if (diff == 0)
+               return -1;
+
+       /* take one bit only */
+       for (i = 0; i < sizeof(diff)*8; i++)
+               if (diff & (1<<i))
+                       break;
+
+       old_val ^= 1 << i;
+
+       if (is_down)
+               *is_down = !!(val & (1<<i));
+       return i;
+}
+
+static const struct {
+       short key;
+       short pbtn;
+} key_pbtn_map[] =
+{
+       { GP2X_BTN_UP,          PBTN_UP },
+       { GP2X_BTN_DOWN,        PBTN_DOWN },
+       { GP2X_BTN_LEFT,        PBTN_LEFT },
+       { GP2X_BTN_RIGHT,       PBTN_RIGHT },
+       { GP2X_BTN_B,           PBTN_MOK },
+       { GP2X_BTN_X,           PBTN_MBACK },
+       { GP2X_BTN_A,           PBTN_MA2 },
+       { GP2X_BTN_Y,           PBTN_MA3 },
+       { GP2X_BTN_L,           PBTN_L },
+       { GP2X_BTN_R,           PBTN_R },
+       { GP2X_BTN_SELECT,      PBTN_MENU },
+};
+
+#define KEY_PBTN_MAP_SIZE (sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]))
+
+static int in_gp2x_menu_translate(void *drv_data, int keycode)
+{
+       int i;
+       if (keycode < 0)
+       {
+               /* menu -> kc */
+               keycode = -keycode;
+               for (i = 0; i < KEY_PBTN_MAP_SIZE; i++)
+                       if (key_pbtn_map[i].pbtn == keycode)
+                               return key_pbtn_map[i].key;
+       }
+       else
+       {
+               for (i = 0; i < KEY_PBTN_MAP_SIZE; i++)
+                       if (key_pbtn_map[i].key == keycode)
+                               return key_pbtn_map[i].pbtn;
+       }
+
+       return 0;
+}
+
+#if 0 // TODO: move to pico
+static const struct {
+       short code;
+       char btype;
+       char bit;
+} in_gp2x_defbinds[] =
+{
+       /* MXYZ SACB RLDU */
+       { BTN_UP,       IN_BINDTYPE_PLAYER12, 0 },
+       { BTN_DOWN,     IN_BINDTYPE_PLAYER12, 1 },
+       { BTN_LEFT,     IN_BINDTYPE_PLAYER12, 2 },
+       { BTN_RIGHT,    IN_BINDTYPE_PLAYER12, 3 },
+       { BTN_X,        IN_BINDTYPE_PLAYER12, 4 },      /* B */
+       { BTN_B,        IN_BINDTYPE_PLAYER12, 5 },      /* C */
+       { BTN_A,        IN_BINDTYPE_PLAYER12, 6 },      /* A */
+       { BTN_START,    IN_BINDTYPE_PLAYER12, 7 },
+       { BTN_SELECT,   IN_BINDTYPE_EMU, PEVB_MENU },
+//     { BTN_Y,        IN_BINDTYPE_EMU, PEVB_SWITCH_RND },
+       { BTN_L,        IN_BINDTYPE_EMU, PEVB_STATE_SAVE },
+       { BTN_R,        IN_BINDTYPE_EMU, PEVB_STATE_LOAD },
+       { BTN_VOL_UP,   IN_BINDTYPE_EMU, PEVB_VOL_UP },
+       { BTN_VOL_DOWN, IN_BINDTYPE_EMU, PEVB_VOL_DOWN },
+       { 0, 0, 0 },
+};
+#endif
+
+static void in_gp2x_get_def_binds(int *binds)
+{
+       int i;
+
+       for (i = 0; 1; i++) {
+               if (in_gp2x_defbinds[i].bit == 0 && in_gp2x_defbinds[i].code == 0)
+                       break;
+               binds[IN_BIND_OFFS(in_gp2x_defbinds[i].code, in_gp2x_defbinds[i].btype)] =
+                       1 << in_gp2x_defbinds[i].bit;
+       }
+}
+
+/* remove binds of missing keys, count remaining ones */
+static int in_gp2x_clean_binds(void *drv_data, int *binds, int *def_binds)
+{
+       int i, count = 0;
+//     int eb, have_vol = 0, have_menu = 0;
+
+       for (i = 0; i < IN_GP2X_NBUTTONS; i++) {
+               int t, offs;
+               for (t = 0; t < IN_BINDTYPE_COUNT; t++) {
+                       offs = IN_BIND_OFFS(i, t);
+                       if (in_gp2x_keys[i] == NULL)
+                               binds[offs] = def_binds[offs] = 0;
+                       if (binds[offs])
+                               count++;
+               }
+#if 0
+               eb = binds[IN_BIND_OFFS(i, IN_BINDTYPE_EMU)];
+               if (eb & (PEV_VOL_DOWN|PEV_VOL_UP))
+                       have_vol = 1;
+               if (eb & PEV_MENU)
+                       have_menu = 1;
+#endif
+       }
+
+       // TODO: move to pico
+#if 0
+       /* autobind some important keys, if they are unbound */
+       if (!have_vol && binds[GP2X_BTN_VOL_UP] == 0 && binds[GP2X_BTN_VOL_DOWN] == 0) {
+               binds[IN_BIND_OFFS(GP2X_BTN_VOL_UP, IN_BINDTYPE_EMU)]   = PEV_VOL_UP;
+               binds[IN_BIND_OFFS(GP2X_BTN_VOL_DOWN, IN_BINDTYPE_EMU)] = PEV_VOL_DOWN;
+               count += 2;
+       }
+
+       if (!have_menu) {
+               binds[IN_BIND_OFFS(GP2X_BTN_SELECT, IN_BINDTYPE_EMU)] = PEV_MENU;
+               count++;
+       }
+#endif
+
+       in_combos_find(binds, GP2X_BTN_PUSH, &in_gp2x_combo_keys, &in_gp2x_combo_acts);
+
+       return count;
+}
+
+static const in_drv_t in_gp2x_drv = {
+       .prefix         = IN_GP2X_PREFIX,
+       .probe          = in_gp2x_probe,
+       .free           = in_gp2x_free,
+       .get_key_names  = in_gp2x_get_key_names,
+       .get_def_binds  = in_gp2x_get_def_binds,
+       .clean_binds    = in_gp2x_clean_binds,
+       .update         = in_gp2x_update,
+       .update_keycode = in_gp2x_update_keycode,
+       .menu_translate = in_gp2x_menu_translate,
+};
+
+void in_gp2x_init(void)
+{
+       if (gp2x_dev_id == GP2X_DEV_WIZ)
+               in_gp2x_keys[GP2X_BTN_START] = "MENU";
+       
+       in_gp2x_combo_keys = in_gp2x_combo_acts = 0;
+
+       in_register_driver(&in_gp2x_drv);
+}
+
diff --git a/frontend/gp2x/in_gp2x.h b/frontend/gp2x/in_gp2x.h
new file mode 100644 (file)
index 0000000..6428a63
--- /dev/null
@@ -0,0 +1,18 @@
+
+void in_gp2x_init(void);
+
+/* to be set somewhere in platform code */
+extern struct in_default_bind in_gp2x_defbinds[];
+
+enum  { GP2X_BTN_UP = 0,      GP2X_BTN_LEFT = 2,      GP2X_BTN_DOWN = 4,  GP2X_BTN_RIGHT = 6,
+        GP2X_BTN_START = 8,   GP2X_BTN_SELECT = 9,    GP2X_BTN_L = 10,    GP2X_BTN_R = 11,
+        GP2X_BTN_A = 12,      GP2X_BTN_B = 13,        GP2X_BTN_X = 14,    GP2X_BTN_Y = 15,
+        GP2X_BTN_VOL_UP = 23, GP2X_BTN_VOL_DOWN = 22, GP2X_BTN_PUSH = 27 };
+
+/* FIXME */
+#ifndef GP2X_DEV_GP2X
+extern int gp2x_dev_id;
+#define GP2X_DEV_GP2X 1
+#define GP2X_DEV_WIZ 2
+#define GP2X_DEV_CAANOO 3
+#endif
index b699659..41e48b7 100644 (file)
@@ -245,6 +245,10 @@ void do_emu_action(void)
                                snprintf(hud_msg, sizeof(hud_msg), "SCREENSHOT TAKEN");
                        break;
                }
+       case SACTION_VOLUME_UP:
+       case SACTION_VOLUME_DOWN:
+               plat_step_volume(emu_action == SACTION_VOLUME_UP);
+               return;
        default:
                return;
        }
index ffed68b..bc6c267 100644 (file)
@@ -58,6 +58,8 @@ enum sched_action {
        SACTION_PREV_SSLOT,
        SACTION_TOGGLE_FSKIP,
        SACTION_SCREENSHOT,
+       SACTION_VOLUME_UP,
+       SACTION_VOLUME_DOWN,
        SACTION_GUN_TRIGGER = 16,
        SACTION_GUN_A,
        SACTION_GUN_B,
index 60cf0c4..cfdc62d 100644 (file)
@@ -79,7 +79,8 @@ static char last_selected_fname[MAXPATHLEN];
 static int warned_about_bios, region, in_type_sel1, in_type_sel2;
 static int psx_clock;
 static int memcard1_sel, memcard2_sel;
-int g_opts, analog_deadzone;
+int g_opts;
+int analog_deadzone; // for Caanoo
 
 #ifdef __ARM_ARCH_7A__
 #define DEFAULT_PSX_CLOCK 57
@@ -724,6 +725,10 @@ me_bind_action emuctrl_actions[] =
        { "Gun A button     ", 1 << SACTION_GUN_A },
        { "Gun B button     ", 1 << SACTION_GUN_B },
        { "Gun Offscreen Trigger", 1 << SACTION_GUN_TRIGGER2 },
+#ifndef __ARM_ARCH_7A__ /* XXX */
+       { "Volume Up        ", 1 << SACTION_VOLUME_UP },
+       { "Volume Down      ", 1 << SACTION_VOLUME_DOWN },
+#endif
        { NULL,                0 }
 };
 
@@ -801,7 +806,7 @@ static void keys_write_all(FILE *f)
                        }
 
                        kbinds = binds[IN_BIND_OFFS(k, IN_BINDTYPE_EMU)];
-                       for (i = 0; kbinds && i < ARRAY_SIZE(emuctrl_actions) - 1; i++) {
+                       for (i = 0; kbinds && emuctrl_actions[i].name != NULL; i++) {
                                mask = emuctrl_actions[i].mask;
                                if (mask & kbinds) {
                                        strncpy(act, emuctrl_actions[i].name, 31);
index 3326b69..16f85a9 100644 (file)
@@ -13,4 +13,5 @@ enum opts {
        OPT_TSGUN_NOTRIGGER = 1 << 4,
 };
 
-extern int g_opts, analog_deadzone;
+extern int g_opts;
+extern int analog_deadzone;
index 85290cd..af984b6 100644 (file)
@@ -1,5 +1,6 @@
 void *plat_prepare_screenshot(int *w, int *h, int *bpp);
-int plat_rescan_inputs(void);
-int plat_cpu_clock_get(void);
-int plat_cpu_clock_apply(int cpu_clock);
-int plat_get_bat_capacity(void);
+int  plat_rescan_inputs(void);
+void plat_step_volume(int is_up);
+int  plat_cpu_clock_get(void);
+int  plat_cpu_clock_apply(int cpu_clock);
+int  plat_get_bat_capacity(void);
index 058ef1b..957eb3e 100644 (file)
@@ -72,3 +72,7 @@ int plat_get_bat_capacity(void)
 {
        return -1;
 }
+
+void plat_step_volume(int is_up)
+{
+}
index c9f576b..f168a5f 100644 (file)
@@ -116,6 +116,10 @@ void plat_video_menu_leave(void)
                fprintf(stderr, "warning: vout_fbdev_resize failed\n");
 }
 
+void plat_step_volume(int is_up)
+{
+}
+
 void plat_init(void)
 {
        const char *main_fb_name, *layer_fb_name;
index fd9c325..3d43f83 100644 (file)
 #include <unistd.h>
 #include <linux/fb.h>
 #include <sys/mman.h>
+#include <linux/soundcard.h>
 
 #include "common/input.h"
+#include "gp2x/in_gp2x.h"
 #include "common/menu.h"
 #include "warm/warm.h"
 #include "plugin_lib.h"
+#include "pl_gun_ts.h"
 #include "cspace.h"
 #include "blit320.h"
 #include "in_tsbutton.h"
@@ -28,7 +31,9 @@
 #include "plat.h"
 #include "pcnt.h"
 
-static int fbdev = -1, memdev = -1, battdev = -1;
+int gp2x_dev_id;
+
+static int fbdev = -1, memdev = -1, battdev = -1, mixerdev = -1;
 static volatile unsigned short *memregs;
 static volatile unsigned int   *memregl;
 static void *fb_vaddrs[2];
@@ -234,7 +239,8 @@ void plat_video_menu_leave(void)
                exit(1);
        }
 
-       in_set_config_int(in_name_to_id("evdev:pollux-analog"),
+       if (gp2x_dev_id == GP2X_DEV_CAANOO)
+               in_set_config_int(in_name_to_id("evdev:pollux-analog"),
                        IN_CFG_ABS_DEAD_ZONE, analog_deadzone);
 
        memset(g_menuscreen_ptr, 0, 320*240 * psx_bpp/8);
@@ -431,6 +437,8 @@ static void *pl_vout_set_mode(int w, int h, int bpp)
 
        pollux_changemode(bpp, 1);
 
+       pl_set_gun_rect(fb_offset_x, fb_offset_y, w > 320 ? 320 : w, h);
+
        return NULL;
 }
 
@@ -463,6 +471,7 @@ void plat_init(void)
        struct fb_fix_screeninfo fbfix;
        int rate, timer_div, timer_div2;
        int fbdev, ret, warm_ret;
+       FILE *f;
 
        memdev = open("/dev/mem", O_RDWR);
        if (memdev == -1) {
@@ -565,6 +574,22 @@ void plat_init(void)
        if (battdev < 0)
                perror("Warning: could't open pollux_batt");
 
+       f = fopen("/dev/accel", "rb");
+       if (f) {
+               printf("detected Caanoo\n");
+               gp2x_dev_id = GP2X_DEV_CAANOO;
+               fclose(f);
+       }
+       else {
+               printf("detected Wiz\n");
+               gp2x_dev_id = GP2X_DEV_WIZ;
+               in_gp2x_init();
+       }
+
+       mixerdev = open("/dev/mixer", O_RDWR);
+       if (mixerdev == -1)
+               perror("open(/dev/mixer)");
+
        pl_rearmed_cbs.pl_vout_flip = pl_vout_flip;
        pl_rearmed_cbs.pl_vout_raw_flip = have_warm ? raw_flip_dma : raw_flip_soft;
        pl_rearmed_cbs.pl_vout_set_mode = pl_vout_set_mode;
@@ -592,6 +617,8 @@ void plat_finish(void)
 
        if (battdev >= 0)
                close(battdev);
+       if (mixerdev >= 0)
+               close(mixerdev);
        munmap((void *)memregs, 0x20000);
        close(memdev);
 }
@@ -639,10 +666,60 @@ static const char * const caanoo_keys[KEY_MAX + 1] = {
        [BTN_BASE5]     = "Push",
 };
 
+/* Wiz stuff */
+struct in_default_bind in_gp2x_defbinds[] =
+{
+       /* MXYZ SACB RLDU */
+       { GP2X_BTN_UP,          IN_BINDTYPE_PLAYER12, DKEY_UP },
+       { GP2X_BTN_DOWN,        IN_BINDTYPE_PLAYER12, DKEY_DOWN },
+       { GP2X_BTN_LEFT,        IN_BINDTYPE_PLAYER12, DKEY_LEFT },
+       { GP2X_BTN_RIGHT,       IN_BINDTYPE_PLAYER12, DKEY_RIGHT },
+       { GP2X_BTN_X,           IN_BINDTYPE_PLAYER12, DKEY_CROSS },
+       { GP2X_BTN_B,           IN_BINDTYPE_PLAYER12, DKEY_CIRCLE },
+       { GP2X_BTN_A,           IN_BINDTYPE_PLAYER12, DKEY_SQUARE },
+       { GP2X_BTN_Y,           IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE },
+       { GP2X_BTN_L,           IN_BINDTYPE_PLAYER12, DKEY_L1 },
+       { GP2X_BTN_R,           IN_BINDTYPE_PLAYER12, DKEY_R1 },
+       { GP2X_BTN_START,       IN_BINDTYPE_PLAYER12, DKEY_START },
+       { GP2X_BTN_SELECT,      IN_BINDTYPE_EMU, SACTION_ENTER_MENU },
+       { GP2X_BTN_VOL_UP,      IN_BINDTYPE_EMU, SACTION_VOLUME_UP },
+       { GP2X_BTN_VOL_DOWN,    IN_BINDTYPE_EMU, SACTION_VOLUME_DOWN },
+       { 0, 0, 0 },
+};
+
+void plat_step_volume(int is_up)
+{
+       static int volume = 50;
+       int ret, val;
+
+       if (mixerdev < 0)
+               return;
+
+       if (is_up) {
+               volume += 5;
+               if (volume > 255) volume = 255;
+       }
+       else {
+               volume -= 5;
+               if (volume < 0) volume = 0;
+       }
+       val = volume;
+       val |= val << 8;
+
+       ret = ioctl(mixerdev, SOUND_MIXER_WRITE_PCM, &val);
+       if (ret == -1)
+               perror("WRITE_PCM");
+}
+
+// unused dummy for in_gp2x
+volatile unsigned short *gp2x_memregs;
+
 int plat_rescan_inputs(void)
 {
        in_probe();
-       in_set_config(in_name_to_id("evdev:pollux-analog"), IN_CFG_KEY_NAMES,
-                     caanoo_keys, sizeof(caanoo_keys));
+       if (gp2x_dev_id == GP2X_DEV_CAANOO)
+               in_set_config(in_name_to_id("evdev:pollux-analog"), IN_CFG_KEY_NAMES,
+                             caanoo_keys, sizeof(caanoo_keys));
+
        return 0;
 }
index dc5e497..f66d884 100644 (file)
@@ -258,3 +258,7 @@ void *plat_prepare_screenshot(int *w, int *h, int *bpp)
        return NULL;
 }
 
+void plat_step_volume(int is_up)
+{
+}
+