diff options
Diffstat (limited to 'firmware/target/hosted/sonynwz/button-nwz.c')
-rw-r--r-- | firmware/target/hosted/sonynwz/button-nwz.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/firmware/target/hosted/sonynwz/button-nwz.c b/firmware/target/hosted/sonynwz/button-nwz.c index 3be74fc924..2fb23e1471 100644 --- a/firmware/target/hosted/sonynwz/button-nwz.c +++ b/firmware/target/hosted/sonynwz/button-nwz.c | |||
@@ -18,7 +18,7 @@ | |||
18 | * | 18 | * |
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | #include "button.h" | 20 | #include "button.h" |
21 | #define LOGF_ENABLE | 21 | //#define LOGF_ENABLE |
22 | #include "logf.h" | 22 | #include "logf.h" |
23 | #include "panic.h" | 23 | #include "panic.h" |
24 | #include "backlight.h" | 24 | #include "backlight.h" |
@@ -192,6 +192,19 @@ static void open_input_device(const char *path) | |||
192 | poll_nfds++; | 192 | poll_nfds++; |
193 | } | 193 | } |
194 | 194 | ||
195 | #if defined(SONY_NWZA860) | ||
196 | /* keycode -> rockbox button mapping */ | ||
197 | static int button_map[NWZ_KEY_MASK + 1] = | ||
198 | { | ||
199 | [0 ... NWZ_KEY_MASK] = 0, | ||
200 | [NWZ_KEY_PLAY] = BUTTON_PLAY, | ||
201 | [NWZ_KEY_RIGHT] = BUTTON_FF, | ||
202 | [NWZ_KEY_LEFT] = BUTTON_REW, | ||
203 | [NWZ_KEY_VOL_DOWN] = BUTTON_VOL_DOWN, | ||
204 | [NWZ_KEY_VOL_UP] = BUTTON_VOL_UP, | ||
205 | [NWZ_KEY_BACK] = BUTTON_BACK, | ||
206 | }; | ||
207 | #else /* SONY_NWZA860 */ | ||
195 | /* keycode -> rockbox button mapping */ | 208 | /* keycode -> rockbox button mapping */ |
196 | static int button_map[NWZ_KEY_MASK + 1] = | 209 | static int button_map[NWZ_KEY_MASK + 1] = |
197 | { | 210 | { |
@@ -214,6 +227,7 @@ static int button_map[NWZ_KEY_MASK + 1] = | |||
214 | [NWZ_KEY_AD1_6] = 0, | 227 | [NWZ_KEY_AD1_6] = 0, |
215 | [NWZ_KEY_AD1_7] = 0, | 228 | [NWZ_KEY_AD1_7] = 0, |
216 | }; | 229 | }; |
230 | #endif /* SONY_NWZA860 */ | ||
217 | 231 | ||
218 | static void handle_key(struct input_event evt) | 232 | static void handle_key(struct input_event evt) |
219 | { | 233 | { |
@@ -296,11 +310,16 @@ int button_read_device( | |||
296 | #endif | 310 | #endif |
297 | } | 311 | } |
298 | } | 312 | } |
313 | int btns = button_bitmap; | ||
299 | #ifdef HAVE_TOUCHSCREEN | 314 | #ifdef HAVE_TOUCHSCREEN |
315 | /* WARNING we must call touchscreen_to_pixels even if there is no touch, | ||
316 | * otherwsise *data is not filled with the last position and it breaks | ||
317 | * everything */ | ||
318 | int touch_bitmap = touchscreen_to_pixels(touch_x, touch_y, data); | ||
300 | if(touch_detect) | 319 | if(touch_detect) |
301 | button_bitmap |= touchscreen_to_pixels(touch_x, touch_y, data); | 320 | btns |= touch_bitmap; |
302 | #endif | 321 | #endif |
303 | return hold_status ? 0 : button_bitmap; | 322 | return hold_status ? 0 : btns; |
304 | } | 323 | } |
305 | 324 | ||
306 | void nwz_button_reload_after_suspend(void) | 325 | void nwz_button_reload_after_suspend(void) |