diff options
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r-- | firmware/target/hosted/sonynwz/debug-nwz.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/firmware/target/hosted/sonynwz/debug-nwz.c b/firmware/target/hosted/sonynwz/debug-nwz.c index e9044beca9..0c0b494330 100644 --- a/firmware/target/hosted/sonynwz/debug-nwz.c +++ b/firmware/target/hosted/sonynwz/debug-nwz.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <sys/types.h> | 36 | #include <sys/types.h> |
37 | #include <fcntl.h> | 37 | #include <fcntl.h> |
38 | #include <sys/ioctl.h> | 38 | #include <sys/ioctl.h> |
39 | #include "nwzlinux_codec.h" | ||
39 | 40 | ||
40 | /* NOTE: some targets with touchscreen don't have the usual keypad, on those | 41 | /* NOTE: some targets with touchscreen don't have the usual keypad, on those |
41 | * we use a mixture of rewind/forward/volume+/- to emulate it */ | 42 | * we use a mixture of rewind/forward/volume+/- to emulate it */ |
@@ -44,6 +45,8 @@ | |||
44 | #define ACT_OK 2 | 45 | #define ACT_OK 2 |
45 | #define ACT_PREV 3 | 46 | #define ACT_PREV 3 |
46 | #define ACT_NEXT 4 | 47 | #define ACT_NEXT 4 |
48 | #define ACT_DEC 5 | ||
49 | #define ACT_INC 6 | ||
47 | #define ACT_REPEAT 0x1000 | 50 | #define ACT_REPEAT 0x1000 |
48 | 51 | ||
49 | int xlate_button(int btn) | 52 | int xlate_button(int btn) |
@@ -58,13 +61,21 @@ int xlate_button(int btn) | |||
58 | case BUTTON_PLAY: | 61 | case BUTTON_PLAY: |
59 | return ACT_OK; | 62 | return ACT_OK; |
60 | case BUTTON_UP: | 63 | case BUTTON_UP: |
61 | case BUTTON_LEFT: | 64 | #ifdef BUTTON_FF |
62 | case BUTTON_VOL_UP: | 65 | case BUTTON_FF: |
66 | #endif | ||
63 | return ACT_PREV; | 67 | return ACT_PREV; |
64 | case BUTTON_DOWN: | ||
65 | case BUTTON_RIGHT: | 68 | case BUTTON_RIGHT: |
66 | case BUTTON_VOL_DOWN: | 69 | case BUTTON_VOL_UP: |
70 | return ACT_INC; | ||
71 | case BUTTON_DOWN: | ||
72 | #ifdef BUTTON_FF | ||
73 | case BUTTON_REW: | ||
74 | #endif | ||
67 | return ACT_NEXT; | 75 | return ACT_NEXT; |
76 | case BUTTON_LEFT: | ||
77 | case BUTTON_VOL_DOWN: | ||
78 | return ACT_DEC; | ||
68 | default: | 79 | default: |
69 | return ACT_NONE; | 80 | return ACT_NONE; |
70 | } | 81 | } |
@@ -96,8 +107,6 @@ bool dbg_hw_info_adc(void) | |||
96 | int button = my_get_action(HZ / 25); | 107 | int button = my_get_action(HZ / 25); |
97 | switch(button) | 108 | switch(button) |
98 | { | 109 | { |
99 | case ACT_NEXT: | ||
100 | case ACT_PREV: | ||
101 | case ACT_OK: | 110 | case ACT_OK: |
102 | lcd_setfont(FONT_UI); | 111 | lcd_setfont(FONT_UI); |
103 | return true; | 112 | return true; |
@@ -166,8 +175,6 @@ bool dbg_hw_info_power(void) | |||
166 | int button = my_get_action(HZ / 25); | 175 | int button = my_get_action(HZ / 25); |
167 | switch(button) | 176 | switch(button) |
168 | { | 177 | { |
169 | case ACT_NEXT: | ||
170 | case ACT_PREV: | ||
171 | case ACT_OK: | 178 | case ACT_OK: |
172 | lcd_setfont(FONT_UI); | 179 | lcd_setfont(FONT_UI); |
173 | return true; | 180 | return true; |
@@ -335,6 +342,7 @@ bool dbg_hw_info_audio(void) | |||
335 | { | 342 | { |
336 | lcd_setfont(FONT_SYSFIXED); | 343 | lcd_setfont(FONT_SYSFIXED); |
337 | int vol = 0; | 344 | int vol = 0; |
345 | enum { VOL, ACOUSTIC, CUEREV, NR_SETTINGS } setting = VOL; | ||
338 | 346 | ||
339 | while(1) | 347 | while(1) |
340 | { | 348 | { |
@@ -342,12 +350,10 @@ bool dbg_hw_info_audio(void) | |||
342 | switch(btn) | 350 | switch(btn) |
343 | { | 351 | { |
344 | case ACT_PREV: | 352 | case ACT_PREV: |
345 | vol--; | 353 | setting = (setting + NR_SETTINGS - 1) % NR_SETTINGS; |
346 | pcm_alsa_set_digital_volume(vol); | ||
347 | break; | 354 | break; |
348 | case ACT_NEXT: | 355 | case ACT_NEXT: |
349 | vol++; | 356 | setting = (setting + 1) % NR_SETTINGS; |
350 | pcm_alsa_set_digital_volume(vol); | ||
351 | break; | 357 | break; |
352 | case ACT_OK: | 358 | case ACT_OK: |
353 | lcd_setfont(FONT_UI); | 359 | lcd_setfont(FONT_UI); |
@@ -356,11 +362,38 @@ bool dbg_hw_info_audio(void) | |||
356 | lcd_setfont(FONT_UI); | 362 | lcd_setfont(FONT_UI); |
357 | return false; | 363 | return false; |
358 | } | 364 | } |
365 | if(btn == ACT_INC || btn == ACT_DEC) | ||
366 | { | ||
367 | bool inc = (btn == ACT_INC); | ||
368 | switch(setting) | ||
369 | { | ||
370 | case VOL: | ||
371 | vol += inc ? 1 : -1; | ||
372 | pcm_alsa_set_digital_volume(vol); | ||
373 | break; | ||
374 | case ACOUSTIC: | ||
375 | audiohw_enable_acoustic(!audiohw_acoustic_enabled()); | ||
376 | break; | ||
377 | case CUEREV: | ||
378 | audiohw_enable_cuerev(!audiohw_cuerev_enabled()); | ||
379 | break; | ||
380 | default: | ||
381 | break; | ||
382 | } | ||
383 | } | ||
359 | 384 | ||
360 | lcd_clear_display(); | 385 | lcd_clear_display(); |
361 | int line = 0; | 386 | int line = 0; |
387 | #define SEL_COL(item) lcd_set_foreground(item == setting ? LCD_RGBPACK(255, 0, 0) : LCD_WHITE); | ||
362 | 388 | ||
389 | SEL_COL(VOL) | ||
363 | lcd_putsf(0, line++, "vol: %d dB", vol); | 390 | lcd_putsf(0, line++, "vol: %d dB", vol); |
391 | SEL_COL(ACOUSTIC) | ||
392 | lcd_putsf(0, line++, "acoustic: %s", audiohw_acoustic_enabled() ? "on" : "off"); | ||
393 | SEL_COL(CUEREV) | ||
394 | lcd_putsf(0, line++, "cue/rev: %s", audiohw_cuerev_enabled() ? "on" : "off"); | ||
395 | lcd_set_foreground(LCD_WHITE); | ||
396 | #undef SEL_COL | ||
364 | 397 | ||
365 | lcd_update(); | 398 | lcd_update(); |
366 | yield(); | 399 | yield(); |