diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config.h | 3 | ||||
-rw-r--r-- | firmware/export/config/sonynwza860.h | 24 | ||||
-rw-r--r-- | firmware/target/hosted/sonynwz/button-nwz.c | 25 | ||||
-rw-r--r-- | firmware/target/hosted/sonynwz/button-target.h | 39 |
4 files changed, 87 insertions, 4 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h index f98ccbd853..abe815d70d 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -165,6 +165,7 @@ | |||
165 | #define SAMSUNG_YPR1_PAD 61 | 165 | #define SAMSUNG_YPR1_PAD 61 |
166 | #define SAMSUNG_YH92X_PAD 62 | 166 | #define SAMSUNG_YH92X_PAD 62 |
167 | #define DX50_PAD 63 | 167 | #define DX50_PAD 63 |
168 | #define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */ | ||
168 | 169 | ||
169 | /* CONFIG_REMOTE_KEYPAD */ | 170 | /* CONFIG_REMOTE_KEYPAD */ |
170 | #define H100_REMOTE 1 | 171 | #define H100_REMOTE 1 |
@@ -594,6 +595,8 @@ Lyre prototype 1 */ | |||
594 | #include "config/sonynwa20.h" | 595 | #include "config/sonynwa20.h" |
595 | #elif defined(SONY_NWZE470) | 596 | #elif defined(SONY_NWZE470) |
596 | #include "config/sonynwze470.h" | 597 | #include "config/sonynwze470.h" |
598 | #elif defined(SONY_NWZA860) | ||
599 | #include "config/sonynwza860.h" | ||
597 | #else | 600 | #else |
598 | /* no known platform */ | 601 | /* no known platform */ |
599 | #endif | 602 | #endif |
diff --git a/firmware/export/config/sonynwza860.h b/firmware/export/config/sonynwza860.h new file mode 100644 index 0000000000..f61dd7a4dd --- /dev/null +++ b/firmware/export/config/sonynwza860.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * This config file is for the Sony NWZ-A860 series | ||
3 | */ | ||
4 | |||
5 | /* For Rolo and boot loader */ | ||
6 | #define MODEL_NUMBER 107 | ||
7 | |||
8 | #define MODEL_NAME "Sony NWZ-A860 Series" | ||
9 | |||
10 | /* LCD dimensions */ | ||
11 | #define LCD_WIDTH 240 | ||
12 | #define LCD_HEIGHT 400 | ||
13 | /* sqrt(240^2 + 400^2) / 2.8 = 166 */ | ||
14 | #define LCD_DPI 166 | ||
15 | |||
16 | /* this device has a touchscreen */ | ||
17 | #define HAVE_TOUCHSCREEN | ||
18 | #define HAVE_BUTTON_DATA | ||
19 | |||
20 | #include "sonynwzlinux.h" | ||
21 | |||
22 | /* override keypad */ | ||
23 | #undef CONFIG_KEYPAD | ||
24 | #define CONFIG_KEYPAD SONY_NWZA860_PAD | ||
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) |
diff --git a/firmware/target/hosted/sonynwz/button-target.h b/firmware/target/hosted/sonynwz/button-target.h index 6cf915b4ad..5070728236 100644 --- a/firmware/target/hosted/sonynwz/button-target.h +++ b/firmware/target/hosted/sonynwz/button-target.h | |||
@@ -24,6 +24,40 @@ | |||
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | /* The NWZ-A860 is completely different, it has a touchscreen and some but not | ||
28 | * all keys of the other others */ | ||
29 | #if defined(SONY_NWZA860) | ||
30 | |||
31 | /* Main unit's buttons */ | ||
32 | #define BUTTON_BACK 0x00000001 /* HOME */ | ||
33 | #define BUTTON_PLAY 0x00000002 | ||
34 | #define BUTTON_REW 0x00000004 | ||
35 | #define BUTTON_FF 0x00000008 | ||
36 | #define BUTTON_VOL_DOWN 0x00000010 | ||
37 | #define BUTTON_VOL_UP 0x00000020 | ||
38 | /* For compatibility */ | ||
39 | #define BUTTON_LEFT BUTTON_MIDLEFT | ||
40 | #define BUTTON_RIGHT BUTTON_MIDRIGHT | ||
41 | #define BUTTON_UP BUTTON_TOPMIDDLE | ||
42 | #define BUTTON_DOWN BUTTON_BOTTOMMIDDLE | ||
43 | |||
44 | /* Touch Screen Area Buttons */ | ||
45 | #define BUTTON_TOPLEFT 0x00000040 | ||
46 | #define BUTTON_TOPMIDDLE 0x00000080 | ||
47 | #define BUTTON_TOPRIGHT 0x00000100 | ||
48 | #define BUTTON_MIDLEFT 0x00000200 | ||
49 | #define BUTTON_CENTER 0x00000400 | ||
50 | #define BUTTON_MIDRIGHT 0x00000800 | ||
51 | #define BUTTON_BOTTOMLEFT 0x00001000 | ||
52 | #define BUTTON_BOTTOMMIDDLE 0x00002000 | ||
53 | #define BUTTON_BOTTOMRIGHT 0x00004000 | ||
54 | |||
55 | #define BUTTON_MAIN 0x7fff | ||
56 | |||
57 | #define POWEROFF_BUTTON BUTTON_BACK | ||
58 | |||
59 | #else /* SONY_NWZA860 */ | ||
60 | |||
27 | /* Main unit's buttons */ | 61 | /* Main unit's buttons */ |
28 | #define BUTTON_POWER 0x00000001 | 62 | #define BUTTON_POWER 0x00000001 |
29 | #define BUTTON_BACK 0x00000002 | 63 | #define BUTTON_BACK 0x00000002 |
@@ -37,8 +71,11 @@ | |||
37 | 71 | ||
38 | #define BUTTON_MAIN 0x000001ff | 72 | #define BUTTON_MAIN 0x000001ff |
39 | 73 | ||
74 | #define POWEROFF_BUTTON BUTTON_POWER | ||
75 | |||
76 | #endif /* SONY_NWZA860 */ | ||
77 | |||
40 | /* Software power-off */ | 78 | /* Software power-off */ |
41 | #define POWEROFF_BUTTON BUTTON_POWER | ||
42 | #define POWEROFF_COUNT 10 | 79 | #define POWEROFF_COUNT 10 |
43 | 80 | ||
44 | /* force driver to reload button state (useful after suspend) */ | 81 | /* force driver to reload button state (useful after suspend) */ |