diff options
-rw-r--r-- | apps/plugin.c | 4 | ||||
-rw-r--r-- | apps/plugin.h | 7 | ||||
-rw-r--r-- | firmware/drivers/button.c | 32 | ||||
-rw-r--r-- | firmware/export/button.h | 5 | ||||
-rw-r--r-- | firmware/export/config-ipod4g.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodcolor.h | 3 | ||||
-rwxr-xr-x | firmware/export/config-ipodmini2g.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodnano.h | 3 | ||||
-rw-r--r-- | firmware/export/config-ipodvideo.h | 3 |
9 files changed, 58 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 04a4d1c735..a908016703 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -468,6 +468,10 @@ static const struct plugin_api rockbox_api = { | |||
468 | the API gets incompatible */ | 468 | the API gets incompatible */ |
469 | 469 | ||
470 | strtok_r, | 470 | strtok_r, |
471 | #ifdef HAVE_WHEEL_POSITION | ||
472 | wheel_status, | ||
473 | wheel_send_events, | ||
474 | #endif | ||
471 | }; | 475 | }; |
472 | 476 | ||
473 | int plugin_load(const char* plugin, void* parameter) | 477 | int plugin_load(const char* plugin, void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index b0221c489d..25bbeb2324 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -105,7 +105,7 @@ | |||
105 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 105 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
106 | 106 | ||
107 | /* increase this every time the api struct changes */ | 107 | /* increase this every time the api struct changes */ |
108 | #define PLUGIN_API_VERSION 31 | 108 | #define PLUGIN_API_VERSION 32 |
109 | 109 | ||
110 | /* update this to latest version if a change to the api struct breaks | 110 | /* update this to latest version if a change to the api struct breaks |
111 | backwards compatibility (and please take the opportunity to sort in any | 111 | backwards compatibility (and please take the opportunity to sort in any |
@@ -547,6 +547,11 @@ struct plugin_api { | |||
547 | the API gets incompatible */ | 547 | the API gets incompatible */ |
548 | 548 | ||
549 | char* (*strtok_r)(char *ptr, const char *sep, char **end); | 549 | char* (*strtok_r)(char *ptr, const char *sep, char **end); |
550 | |||
551 | #ifdef HAVE_WHEEL_POSITION | ||
552 | int (*wheel_status)(void); | ||
553 | void (*wheel_send_events)(bool send); | ||
554 | #endif | ||
550 | }; | 555 | }; |
551 | 556 | ||
552 | /* plugin header */ | 557 | /* plugin header */ |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 20b725c3d4..599c22bc80 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -90,6 +90,10 @@ static bool remote_button_hold_only(void); | |||
90 | #if CONFIG_KEYPAD == IPOD_4G_PAD | 90 | #if CONFIG_KEYPAD == IPOD_4G_PAD |
91 | /* Variable to use for setting button status in interrupt handler */ | 91 | /* Variable to use for setting button status in interrupt handler */ |
92 | int int_btn = BUTTON_NONE; | 92 | int int_btn = BUTTON_NONE; |
93 | #ifdef HAVE_WHEEL_POSITION | ||
94 | static int wheel_position = -1; | ||
95 | static bool send_events = true; | ||
96 | #endif | ||
93 | #endif | 97 | #endif |
94 | 98 | ||
95 | #ifdef HAVE_HEADPHONE_DETECTION | 99 | #ifdef HAVE_HEADPHONE_DETECTION |
@@ -131,6 +135,8 @@ static void opto_i2c_init(void) | |||
131 | 135 | ||
132 | static inline int ipod_4g_button_read(void) | 136 | static inline int ipod_4g_button_read(void) |
133 | { | 137 | { |
138 | int whl = -1; | ||
139 | |||
134 | /* The ipodlinux source had a udelay(250) here, but testing has shown that | 140 | /* The ipodlinux source had a udelay(250) here, but testing has shown that |
135 | it is not needed - tested on Nano, Color/Photo and Video. */ | 141 | it is not needed - tested on Nano, Color/Photo and Video. */ |
136 | /* udelay(250);*/ | 142 | /* udelay(250);*/ |
@@ -160,6 +166,7 @@ static inline int ipod_4g_button_read(void) | |||
160 | if (status & 0x40000000) { | 166 | if (status & 0x40000000) { |
161 | /* NB: highest wheel = 0x5F, clockwise increases */ | 167 | /* NB: highest wheel = 0x5F, clockwise increases */ |
162 | int new_wheel_value = (status << 9) >> 25; | 168 | int new_wheel_value = (status << 9) >> 25; |
169 | whl = new_wheel_value; | ||
163 | backlight_on(); | 170 | backlight_on(); |
164 | /* The queue should have no other events when scrolling */ | 171 | /* The queue should have no other events when scrolling */ |
165 | if (queue_empty(&button_queue) && old_wheel_value >= 0) { | 172 | if (queue_empty(&button_queue) && old_wheel_value >= 0) { |
@@ -180,9 +187,14 @@ static inline int ipod_4g_button_read(void) | |||
180 | wheel_keycode = BUTTON_SCROLL_BACK; | 187 | wheel_keycode = BUTTON_SCROLL_BACK; |
181 | } else goto wheel_end; | 188 | } else goto wheel_end; |
182 | 189 | ||
183 | data = (wheel_delta << 16) | new_wheel_value; | 190 | #ifdef HAVE_WHEEL_POSITION |
184 | queue_post(&button_queue, wheel_keycode | wheel_repeat, | 191 | if (send_events) |
185 | (void *)data); | 192 | #endif |
193 | { | ||
194 | data = (wheel_delta << 16) | new_wheel_value; | ||
195 | queue_post(&button_queue, wheel_keycode | wheel_repeat, | ||
196 | (void *)data); | ||
197 | } | ||
186 | 198 | ||
187 | if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT; | 199 | if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT; |
188 | } | 200 | } |
@@ -205,6 +217,8 @@ wheel_end: | |||
205 | outl(0xffffffff, 0x7000c120); | 217 | outl(0xffffffff, 0x7000c120); |
206 | outl(0xffffffff, 0x7000c124); | 218 | outl(0xffffffff, 0x7000c124); |
207 | } | 219 | } |
220 | /* Save the new absolute wheel position */ | ||
221 | wheel_position = whl; | ||
208 | return btn; | 222 | return btn; |
209 | } | 223 | } |
210 | 224 | ||
@@ -1343,6 +1357,18 @@ int button_status(void) | |||
1343 | return lastbtn; | 1357 | return lastbtn; |
1344 | } | 1358 | } |
1345 | 1359 | ||
1360 | #ifdef HAVE_WHEEL_POSITION | ||
1361 | int wheel_status(void) | ||
1362 | { | ||
1363 | return wheel_position; | ||
1364 | } | ||
1365 | |||
1366 | void wheel_send_events(bool send) | ||
1367 | { | ||
1368 | send_events = send; | ||
1369 | } | ||
1370 | #endif | ||
1371 | |||
1346 | void button_clear_queue(void) | 1372 | void button_clear_queue(void) |
1347 | { | 1373 | { |
1348 | queue_clear(&button_queue); | 1374 | queue_clear(&button_queue); |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 39dfbff6fa..4ff04202d5 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -57,7 +57,10 @@ bool remote_button_hold(void); | |||
57 | #ifdef HAVE_HEADPHONE_DETECTION | 57 | #ifdef HAVE_HEADPHONE_DETECTION |
58 | bool headphones_inserted(void); | 58 | bool headphones_inserted(void); |
59 | #endif | 59 | #endif |
60 | 60 | #ifdef HAVE_WHEEL_POSITION | |
61 | int wheel_status(void); | ||
62 | void wheel_send_events(bool send); | ||
63 | #endif | ||
61 | 64 | ||
62 | #define BUTTON_NONE 0x00000000 | 65 | #define BUTTON_NONE 0x00000000 |
63 | 66 | ||
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 2e8c4dcc33..2b603987f4 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -112,6 +112,9 @@ | |||
112 | /* Define this if you can detect headphones */ | 112 | /* Define this if you can detect headphones */ |
113 | #define HAVE_HEADPHONE_DETECTION | 113 | #define HAVE_HEADPHONE_DETECTION |
114 | 114 | ||
115 | /* Define this if you can read an absolute wheel position */ | ||
116 | #define HAVE_WHEEL_POSITION | ||
117 | |||
115 | #define BOOTFILE_EXT "ipod" | 118 | #define BOOTFILE_EXT "ipod" |
116 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 119 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
117 | 120 | ||
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 964f103214..0bcb25b56c 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -108,6 +108,9 @@ | |||
108 | /* Define this if you can detect headphones */ | 108 | /* Define this if you can detect headphones */ |
109 | #define HAVE_HEADPHONE_DETECTION | 109 | #define HAVE_HEADPHONE_DETECTION |
110 | 110 | ||
111 | /* Define this if you can read an absolute wheel position */ | ||
112 | #define HAVE_WHEEL_POSITION | ||
113 | |||
111 | #define BOOTFILE_EXT "ipod" | 114 | #define BOOTFILE_EXT "ipod" |
112 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 115 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
113 | 116 | ||
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 342742ea43..bac60e3e72 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h | |||
@@ -115,6 +115,9 @@ | |||
115 | /* Define this if you can detect headphones */ | 115 | /* Define this if you can detect headphones */ |
116 | #define HAVE_HEADPHONE_DETECTION | 116 | #define HAVE_HEADPHONE_DETECTION |
117 | 117 | ||
118 | /* Define this if you can read an absolute wheel position */ | ||
119 | #define HAVE_WHEEL_POSITION | ||
120 | |||
118 | #define BOOTFILE_EXT "ipod" | 121 | #define BOOTFILE_EXT "ipod" |
119 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 122 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
120 | 123 | ||
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 03f5b8c753..c24aa43e55 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -113,6 +113,9 @@ | |||
113 | /* Define this if you can detect headphones */ | 113 | /* Define this if you can detect headphones */ |
114 | #define HAVE_HEADPHONE_DETECTION | 114 | #define HAVE_HEADPHONE_DETECTION |
115 | 115 | ||
116 | /* Define this if you can read an absolute wheel position */ | ||
117 | #define HAVE_WHEEL_POSITION | ||
118 | |||
116 | #define BOOTFILE_EXT "ipod" | 119 | #define BOOTFILE_EXT "ipod" |
117 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 120 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
118 | 121 | ||
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 4781a2c887..cd8f1eea11 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -113,6 +113,9 @@ | |||
113 | /* Define this if you can detect headphones */ | 113 | /* Define this if you can detect headphones */ |
114 | #define HAVE_HEADPHONE_DETECTION | 114 | #define HAVE_HEADPHONE_DETECTION |
115 | 115 | ||
116 | /* Define this if you can read an absolute wheel position */ | ||
117 | #define HAVE_WHEEL_POSITION | ||
118 | |||
116 | #define BOOTFILE_EXT "ipod" | 119 | #define BOOTFILE_EXT "ipod" |
117 | #define BOOTFILE "rockbox." BOOTFILE_EXT | 120 | #define BOOTFILE "rockbox." BOOTFILE_EXT |
118 | 121 | ||