blob: 8bbdba915341f3f99039594ac0be0a0e82a41405 [file] [log] [blame]
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2006 Jonathan Gordon
10 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000011 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000015 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21/* *
22 * Button Code Definitions for archos player targets
23 *
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000024 */
25
26#include "config.h"
27#include "action.h"
28#include "button.h"
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000029
Jens Arnoldf39add32006-08-16 20:12:27 +000030static const struct button_mapping button_context_standard[] = {
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000031 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000032 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000033 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000034 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000035
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000036 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
37 { ACTION_STD_CANCEL, BUTTON_STOP, BUTTON_NONE },
Jens Arnold2cf98682007-03-18 14:19:18 +000038 { ACTION_STD_OK, BUTTON_ON, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000039 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
40 { ACTION_STD_MENU, BUTTON_MENU, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000041
42 LAST_ITEM_IN_LIST
43};
44
Jens Arnoldf39add32006-08-16 20:12:27 +000045static const struct button_mapping button_context_wps[] = {
Jens Arnold80876fd2006-10-08 18:47:32 +000046 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000047 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
48 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
49 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
50 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing1526fd72006-08-15 21:27:53 +000051 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
52 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
53 { ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000054
Jens Arnold2cf98682007-03-18 14:19:18 +000055 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000056 { ACTION_WPS_VOLDOWN, BUTTON_MENU|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Jens Arnold2cf98682007-03-18 14:19:18 +000057 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT, BUTTON_NONE },
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000058 { ACTION_WPS_VOLUP, BUTTON_MENU|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000059
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000060 { ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
61 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
62 { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
63 { ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
Jens Arnold80876fd2006-10-08 18:47:32 +000064 { ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, BUTTON_NONE },
Jens Arnold2cf98682007-03-18 14:19:18 +000065
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000066 LAST_ITEM_IN_LIST
67};
68
Jens Arnoldf39add32006-08-16 20:12:27 +000069static const struct button_mapping button_context_settings[] = {
Jonathan Gordon814683e2006-10-12 07:25:35 +000070 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
71 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
73 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000074
Jonathan Gordon56a16d72006-08-21 11:28:29 +000075 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000076};
77
Jens Arnoldf39add32006-08-16 20:12:27 +000078static const struct button_mapping button_context_tree[] = {
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000079 { ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE },
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000080
Jonathan Gordon56a16d72006-08-21 11:28:29 +000081 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000082}; /* button_context_listtree */
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000083
Jens Arnoldf39add32006-08-16 20:12:27 +000084static const struct button_mapping button_context_yesno[] = {
Jens Arnold1fdb5bf2006-08-16 00:32:45 +000085 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
Jens Arnoldf39add32006-08-16 20:12:27 +000086
Jonathan Gordon56a16d72006-08-21 11:28:29 +000087 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000088}; /* button_context_settings_yesno */
89
Jens Arnolda0f31132006-12-12 07:55:17 +000090static const struct button_mapping button_context_bmark[] = {
Jonathan Gordon2e3cfaf2006-08-23 08:53:38 +000091 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_PLAY },
92 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_ON, BUTTON_ON },
Jonathan Gordon2e3cfaf2006-08-23 08:53:38 +000093
Magnus Holmgrene676b812007-05-26 10:44:38 +000094 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
Jonathan Gordon2e3cfaf2006-08-23 08:53:38 +000095}; /* button_context_settings_bmark */
96
Jens Arnoldf39add32006-08-16 20:12:27 +000097/*****************************************************************************
98 * Remote control mappings
99 *****************************************************************************/
100
101static const struct button_mapping remote_button_context_standard[] = {
102 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
103 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
104 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
105 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
106
Jonathan Gordonfe5e56c2006-08-22 09:00:27 +0000107 LAST_ITEM_IN_LIST
Jens Arnoldf39add32006-08-16 20:12:27 +0000108};
109
110static const struct button_mapping remote_button_context_wps[] = {
111 { ACTION_WPS_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
112 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
113 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
114 { ACTION_WPS_STOP, BUTTON_RC_STOP, BUTTON_NONE },
115
116 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
117 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
118
Jonathan Gordon56a16d72006-08-21 11:28:29 +0000119 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
Jens Arnoldf39add32006-08-16 20:12:27 +0000120};
121
122
123static const struct button_mapping* get_context_mapping_remote( int context )
124{
125 context ^= CONTEXT_REMOTE;
126
127 switch (context)
128 {
129 case CONTEXT_WPS:
130 return remote_button_context_wps;
131
132 default:
133 return remote_button_context_standard;
134 }
135}
136
Jens Arnold1fdb5bf2006-08-16 00:32:45 +0000137const struct button_mapping* get_context_mapping( int context )
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000138{
Jens Arnoldf39add32006-08-16 20:12:27 +0000139 if (context&CONTEXT_REMOTE)
140 return get_context_mapping_remote(context);
141
142 switch (context)
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000143 {
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000144 case CONTEXT_WPS:
145 return button_context_wps;
146
147 case CONTEXT_SETTINGS:
148 return button_context_settings;
149
150 case CONTEXT_YESNOSCREEN:
151 return button_context_yesno;
152
153 case CONTEXT_TREE:
Jonathan Gordona053e582007-04-08 01:33:01 +0000154 case CONTEXT_MAINMENU:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000155 return button_context_tree;
Jonathan Gordon2e3cfaf2006-08-23 08:53:38 +0000156 case CONTEXT_BOOKMARKSCREEN:
157 return button_context_bmark;
Jens Arnoldf39add32006-08-16 20:12:27 +0000158 case CONTEXT_STD:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000159 case CONTEXT_LIST:
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +0000160 default:
161 return button_context_standard;
162 }
163}