summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lib/keymaps.h
blob: 2865f9cdd7233f2dd94f46f86edf18cfc76e18d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/***************************************************************************
*             __________               __   ___.
*   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
*   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
*   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
*   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
*                     \/            \/     \/    \/            \/
* $Id$
*
* Copyright (C) 2017 Franklin Wei
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/

/* The purpose of this file is to provide a supplement to the
 * functionality provided by PLA (pluginlib_actions), not to replace
 * it. Using PLA benefits both the plugin author, who no longer needs
 * to manually create keymaps, as well as the author of a new port,
 * who can easily adjust a centralized keymap. However, it lacks
 * flexibility for plugin authors in multiple aspects, namely the lack
 * of release detection and simultaneous button presses, leading some
 * plugins to rely upon individual keymaps, which complicates a new port.
 *
 * This file aims to remedy this by providing a centralized keymap of
 * the most basic keys: 4 directions, "fire" or select, and a
 * menu/pause/meta key.
 *
 * If you are writing a new plugin, *please* consider using these
 * keymaps instead of rolling your own!
 */

#ifndef __PLUGINLIB_KEYMAPS_H__
#define __PLUGINLIB_KEYMAPS_H__

#if (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)  || \
    (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)  || \
    (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)   || \
    (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD) || \
    (CONFIG_KEYPAD == SANSA_CONNECT_PAD)    || \
    (CONFIG_KEYPAD == SANSA_C200_PAD)       || \
    (CONFIG_KEYPAD == SANSA_CLIP_PAD)       || \
    (CONFIG_KEYPAD == SANSA_E200_PAD)       || \
    (CONFIG_KEYPAD == SANSA_FUZE_PAD)       || \
    (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)   || \
    (CONFIG_KEYPAD == GIGABEAT_PAD)         || \
    (CONFIG_KEYPAD == GIGABEAT_S_PAD)       || \
    (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)    || \
    (CONFIG_KEYPAD == SAMSUNG_YH820_PAD)    || \
    (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)      || \
    (CONFIG_KEYPAD == CREATIVE_ZEN_PAD)     || \
    (CONFIG_KEYPAD == SONY_NWZ_PAD)         || \
    (CONFIG_KEYPAD == CREATIVEZVM_PAD)      || \
    (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)     || \
    (CONFIG_KEYPAD == IRIVER_H300_PAD)      || \
    (CONFIG_KEYPAD == HM801_PAD)            || \
    (CONFIG_KEYPAD == HM60X_PAD)            || \
    (CONFIG_KEYPAD == AGPTEK_ROCKER_PAD)
#define BTN_UP         BUTTON_UP
#define BTN_DOWN       BUTTON_DOWN
#define BTN_LEFT       BUTTON_LEFT
#define BTN_RIGHT      BUTTON_RIGHT

#if (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
#define BTN_HAVE_DIAGONAL
#define BTN_UP_LEFT    BUTTON_BACK
#define BTN_UP_RIGHT   BUTTON_PLAYPAUSE
#define BTN_DOWN_LEFT  BUTTON_BOTTOMLEFT
#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
#endif

/* X-Fi doesn't have a separate *_PAD macro */
#ifdef CREATIVE_ZENXFI
#define BTN_HAVE_DIAGONAL
#define BTN_DOWN_LEFT  BUTTON_BOTTOMLEFT
#define BTN_DOWN_RIGHT BUTTON_BOTTOMRIGHT
#define BTN_UP_LEFT    BUTTON_TOPLEFT
#define BTN_UP_RIGHT   BUTTON_TOPRIGHT
#endif

#if (CONFIG_KEYPAD == AGPTEK_ROCKER_PAD)
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      BUTTON_POWER
#endif

#if (CONFIG_KEYPAD == HM60X_PAD)
#define BTN_FIRE       BUTTON_POWER
#define BTN_PAUSE      BUTTON_SELECT
#endif

#if (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)  || \
    (CONFIG_KEYPAD == SANSA_CONNECT_PAD)    || \
    (CONFIG_KEYPAD == SANSA_C200_PAD)       || \
    (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)   || \
    (CONFIG_KEYPAD == ONDAVX747_PAD)
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      BUTTON_POWER

#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD)   || \
      (CONFIG_KEYPAD == PHILIPS_HDD6330_PAD)  || \
      (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD)
#define BTN_FIRE       BUTTON_VOL_UP
#define BTN_PAUSE      BUTTON_VOL_DOWN

#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      BUTTON_HOME

#elif (CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
#define BTN_FIRE       BUTTON_FFWD
#define BTN_PAUSE      BUTTON_REW

#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
#define BTN_FIRE       BUTTON_REC
#define BTN_PAUSE      BUTTON_POWER

#elif (CONFIG_KEYPAD == SANSA_CLIP_PAD)
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      BUTTON_POWER

#elif (CONFIG_KEYPAD == CREATIVE_ZEN_PAD)
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      BUTTON_BACK

#elif (CONFIG_KEYPAD == CREATIVEZVM_PAD)
#define BTN_FIRE       BUTTON_PLAY
#define BTN_PAUSE      BUTTON_MENU

#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define BTN_FIRE       BUTTON_USER
#define BTN_PAUSE      BUTTON_MENU

#elif (CONFIG_KEYPAD == SONY_NWZ_PAD)
#define BTN_FIRE       BUTTON_PLAY
#define BTN_PAUSE      BUTTON_BACK

#elif (CONFIG_KEYPAD == IRIVER_H300_PAD)
#define BTN_FIRE       BUTTON_REC
#define BTN_PAUSE      BUTTON_MODE

#elif (CONFIG_KEYPAD == HM801_PAD)
#define BTN_FIRE       BUTTON_PREV
#define BTN_PAUSE      BUTTON_NEXT

#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
      (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
#define BTN_FIRE       BUTTON_REC
#define BTN_PAUSE      BUTTON_PLAY

#elif (CONFIG_KEYPAD == GIGABEAT_PAD)      || \
      (CONFIG_KEYPAD == GIGABEAT_S_PAD)
#define BTN_FIRE       BUTTON_VOL_UP
#define BTN_PAUSE      BUTTON_MENU
/* #if CONFIG_KEYPAD == PHILIPS_HDD1630_PAD */
#endif

/* ... and now for the bad ones that don't have
 * standard names for the directional buttons */
#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
#define BTN_UP         BUTTON_OK
#define BTN_DOWN       BUTTON_CANCEL
#define BTN_LEFT       BUTTON_MENU
#define BTN_RIGHT      BUTTON_PLAY
#define BTN_FIRE       BUTTON_POWER
#define BTN_PAUSE      BUTTON_REC

#elif (CONFIG_KEYPAD == IRIVER_H10_PAD)
#define BTN_UP         BUTTON_SCROLL_UP
#define BTN_DOWN       BUTTON_SCROLL_DOWN
#define BTN_LEFT       BUTTON_LEFT
#define BTN_RIGHT      BUTTON_RIGHT
#define BTN_FIRE       BUTTON_REW
#define BTN_PAUSE      BUTTON_PLAY

#elif (CONFIG_KEYPAD == MROBE500_PAD)
#define BTN_FIRE      BUTTON_POWER

#elif (CONFIG_KEYPAD == MROBE_REMOTE)
#define BTN_UP         BUTTON_RC_PLAY
#define BTN_DOWN       BUTTON_RC_DOWN
#define BTN_LEFT       BUTTON_RC_REW
#define BTN_RIGHT      BUTTON_RC_FF

#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
      (CONFIG_KEYPAD == IPOD_3G_PAD) || \
      (CONFIG_KEYPAD == IPOD_1G2G_PAD)
#define BTN_UP         BUTTON_MENU
#define BTN_DOWN       BUTTON_PLAY
#define BTN_LEFT       BUTTON_LEFT
#define BTN_RIGHT      BUTTON_RIGHT
#define BTN_FIRE       BUTTON_SELECT
#define BTN_PAUSE      (BUTTON_MENU | BUTTON_SELECT)

#elif (CONFIG_KEYPAD == ONDAVX777_PAD)
#define BTN_FIRE       BUTTON_POWER

#elif (CONFIG_KEYPAD == COWON_D2_PAD)
#define BTN_FIRE       BUTTON_PLUS
#define BTN_PAUSE      BUTTON_MINUS

#elif (CONFIG_KEYPAD == ONDAVX747_PAD) || \
      (CONFIG_KEYPAD == DX50_PAD)
#define BTN_LEFT       BUTTON_LEFT
#define BTN_RIGHT      BUTTON_RIGHT
#define BTN_FIRE       BUTTON_BOTTOMLEFT
#define BTN_PAUSE      BUTTON_TOPLEFT

#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
#define BTN_FIRE       BUTTON_MENU
#define BTN_PAUSE      BUTTON_POWER

#elif (CONFIG_KEYPAD == XDUOO_X3_PAD)
#define BTN_UP           BUTTON_VOL_UP
#define BTN_DOWN         BUTTON_VOL_DOWN
#define BTN_LEFT         BUTTON_PREV
#define BTN_RIGHT        BUTTON_NEXT
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD)
#define BTN_UP           BUTTON_VOL_UP
#define BTN_DOWN         BUTTON_VOL_DOWN
#define BTN_LEFT         BUTTON_PREV
#define BTN_RIGHT        BUTTON_NEXT
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#elif (CONFIG_KEYPAD == XDUOO_X20_PAD)
#define BTN_UP           BUTTON_VOL_UP
#define BTN_DOWN         BUTTON_VOL_DOWN
#define BTN_LEFT         BUTTON_PREV
#define BTN_RIGHT        BUTTON_NEXT
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#elif (CONFIG_KEYPAD == FIIO_M3K_PAD)
#define BTN_UP           BUTTON_VOL_UP
#define BTN_DOWN         BUTTON_VOL_DOWN
#define BTN_LEFT         BUTTON_PREV
#define BTN_RIGHT        BUTTON_NEXT
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#elif (CONFIG_KEYPAD == IHIFI_770_PAD)
#define BTN_UP           BUTTON_PREV
#define BTN_DOWN         BUTTON_NEXT
#define BTN_LEFT         BUTTON_HOME
#define BTN_RIGHT        BUTTON_VOL_DOWN
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#elif (CONFIG_KEYPAD == IHIFI_800_PAD)
#define BTN_UP           BUTTON_PREV
#define BTN_DOWN         BUTTON_NEXT
#define BTN_LEFT         BUTTON_HOME
#define BTN_RIGHT        BUTTON_VOL_DOWN
#define BTN_FIRE         BUTTON_PLAY
#define BTN_PAUSE        BUTTON_POWER

#else
#error Unsupported keypad
#endif

#ifdef HAVE_TOUCHSCREEN
#define BTN_UP         BUTTON_TOPMIDDLE
#define BTN_DOWN       BUTTON_BOTTOMMIDDLE
#define BTN_LEFT       BUTTON_LEFT
#define BTN_RIGHT      BUTTON_RIGHT

#if (CONFIG_KEYPAD == MROBE500_PAD) || \
    (CONFIG_KEYPAD == ONDAVX777_PAD)
#define BTN_PAUSE      BUTTON_BOTTOMLEFT

#elif (CONFIG_KEYPAD != COWON_D2_PAD) && \
      (CONFIG_KEYPAD != DX50_PAD)     && \
      (CONFIG_KEYPAD != ONDAVX777_PAD) && \
      (CONFIG_KEYPAD != CREATIVE_ZENXFI2_PAD)
#define BTN_FIRE       BUTTON_BOTTOMLEFT
#define BTN_PAUSE      BUTTON_TOPLEFT
#endif

/* HAVE_TOUCHSCREEN */
#endif

/* __PLUGINLIB_KEYMAPS_H__ */
#endif