summaryrefslogtreecommitdiff
path: root/utils/nwztools/plattools
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-10-26 20:40:53 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2016-10-26 20:46:57 +0200
commit794104dd17a28a2db09ca1ed44ba7dfb18a1f0ca (patch)
treea872c56f765c61623a6ddf90914f0d1647b70bf7 /utils/nwztools/plattools
parentd42b43c7860aacafbce97cccb3b2f19ad8812d56 (diff)
downloadrockbox-794104dd17a28a2db09ca1ed44ba7dfb18a1f0ca.tar.gz
rockbox-794104dd17a28a2db09ca1ed44ba7dfb18a1f0ca.zip
nwztools/plattools: switch to BACK key to quit
The power off/option does not exist on some models. Change-Id: Ifb45293b3b3faa96d9fece2340cbd98299a4a0b7
Diffstat (limited to 'utils/nwztools/plattools')
-rw-r--r--utils/nwztools/plattools/test_adc.c4
-rw-r--r--utils/nwztools/plattools/test_bl.c16
-rw-r--r--utils/nwztools/plattools/test_keys.c16
-rw-r--r--utils/nwztools/plattools/test_power.c4
-rw-r--r--utils/nwztools/plattools/test_ts.c4
5 files changed, 22 insertions, 22 deletions
diff --git a/utils/nwztools/plattools/test_adc.c b/utils/nwztools/plattools/test_adc.c
index 52c0bffe1b..a0b12f55cc 100644
--- a/utils/nwztools/plattools/test_adc.c
+++ b/utils/nwztools/plattools/test_adc.c
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
24{ 24{
25 /* clear screen and display welcome message */ 25 /* clear screen and display welcome message */
26 nwz_lcdmsg(true, 0, 0, "test_adc"); 26 nwz_lcdmsg(true, 0, 0, "test_adc");
27 nwz_lcdmsg(false, 0, 2, "PWR OFF: quit"); 27 nwz_lcdmsg(false, 0, 2, "BACK: quit");
28 /* open input device */ 28 /* open input device */
29 int input_fd = nwz_key_open(); 29 int input_fd = nwz_key_open();
30 if(input_fd < 0) 30 if(input_fd < 0)
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
55 struct input_event evt; 55 struct input_event evt;
56 if(nwz_key_read_event(input_fd, &evt) != 1) 56 if(nwz_key_read_event(input_fd, &evt) != 1)
57 continue; 57 continue;
58 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_OPTION && !nwz_key_event_is_press(&evt)) 58 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_BACK && !nwz_key_event_is_press(&evt))
59 break; 59 break;
60 } 60 }
61 /* finish nicely */ 61 /* finish nicely */
diff --git a/utils/nwztools/plattools/test_bl.c b/utils/nwztools/plattools/test_bl.c
index b70f81b957..f97162fc4f 100644
--- a/utils/nwztools/plattools/test_bl.c
+++ b/utils/nwztools/plattools/test_bl.c
@@ -24,10 +24,10 @@ int main(int argc, char **argv)
24{ 24{
25 /* clear screen and display welcome message */ 25 /* clear screen and display welcome message */
26 nwz_lcdmsg(true, 0, 0, "test_bl"); 26 nwz_lcdmsg(true, 0, 0, "test_bl");
27 nwz_lcdmsg(false, 0, 2, "UP/DOWN: level"); 27 nwz_lcdmsg(false, 0, 2, "LEFT/RIGHT: level");
28 nwz_lcdmsg(false, 0, 3, "LEFT/RIGHT: step"); 28 nwz_lcdmsg(false, 0, 3, "UP/DOWN: step");
29 nwz_lcdmsg(false, 0, 4, "VOL UP/DOWN: period"); 29 nwz_lcdmsg(false, 0, 4, "VOL UP/DOWN: period");
30 nwz_lcdmsg(false, 0, 5, "PWR OFF: quit"); 30 nwz_lcdmsg(false, 0, 5, "BACK: quit");
31 /* open input and framebuffer device */ 31 /* open input and framebuffer device */
32 int input_fd = nwz_key_open(); 32 int input_fd = nwz_key_open();
33 if(input_fd < 0) 33 if(input_fd < 0)
@@ -65,25 +65,25 @@ int main(int argc, char **argv)
65 /* only act on release */ 65 /* only act on release */
66 if(press) 66 if(press)
67 continue; 67 continue;
68 if(code == NWZ_KEY_OPTION) 68 if(code == NWZ_KEY_BACK)
69 break; /* quit */ 69 break; /* quit */
70 bool change_bl = false; 70 bool change_bl = false;
71 if(code == NWZ_KEY_UP && bl.level < NWZ_FB_BL_MAX_LEVEL) 71 if(code == NWZ_KEY_RIGHT && bl.level < NWZ_FB_BL_MAX_LEVEL)
72 { 72 {
73 change_bl = true; 73 change_bl = true;
74 bl.level++; 74 bl.level++;
75 } 75 }
76 else if(code == NWZ_KEY_DOWN && bl.level > NWZ_FB_BL_MIN_LEVEL) 76 else if(code == NWZ_KEY_LEFT && bl.level > NWZ_FB_BL_MIN_LEVEL)
77 { 77 {
78 change_bl = true; 78 change_bl = true;
79 bl.level--; 79 bl.level--;
80 } 80 }
81 else if(code == NWZ_KEY_RIGHT && bl.step < NWZ_FB_BL_MAX_STEP) 81 else if(code == NWZ_KEY_UP && bl.step < NWZ_FB_BL_MAX_STEP)
82 { 82 {
83 change_bl = true; 83 change_bl = true;
84 bl.step++; 84 bl.step++;
85 } 85 }
86 else if(code == NWZ_KEY_LEFT && bl.step > NWZ_FB_BL_MIN_STEP) 86 else if(code == NWZ_KEY_DOWN && bl.step > NWZ_FB_BL_MIN_STEP)
87 { 87 {
88 change_bl = true; 88 change_bl = true;
89 bl.step--; 89 bl.step--;
diff --git a/utils/nwztools/plattools/test_keys.c b/utils/nwztools/plattools/test_keys.c
index 3640e007fc..bfeadbb42b 100644
--- a/utils/nwztools/plattools/test_keys.c
+++ b/utils/nwztools/plattools/test_keys.c
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
24{ 24{
25 /* clear screen and display welcome message */ 25 /* clear screen and display welcome message */
26 nwz_lcdmsg(true, 0, 0, "test_keys"); 26 nwz_lcdmsg(true, 0, 0, "test_keys");
27 nwz_lcdmsg(false, 0, 2, "hold PWR OFF for 3 seconds to quit"); 27 nwz_lcdmsg(false, 0, 2, "hold BACK for 3 seconds to quit");
28 /* open input device */ 28 /* open input device */
29 int input_fd = nwz_key_open(); 29 int input_fd = nwz_key_open();
30 if(input_fd < 0) 30 if(input_fd < 0)
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
34 return 1; 34 return 1;
35 } 35 }
36 /* display input state in a loop */ 36 /* display input state in a loop */
37 int pwr_off_pressed = 0; /* 0 = no pressed, >0 = number of seconds pressed - 1 */ 37 int back_pressed = 0; /* 0 = no pressed, >0 = number of seconds pressed - 1 */
38 while(1) 38 while(1)
39 { 39 {
40 /* display HOLD status */ 40 /* display HOLD status */
@@ -43,9 +43,9 @@ int main(int argc, char **argv)
43 int ret = nwz_key_wait_event(input_fd, 1000000); 43 int ret = nwz_key_wait_event(input_fd, 1000000);
44 if(ret != 1) 44 if(ret != 1)
45 { 45 {
46 if(pwr_off_pressed > 0) 46 if(back_pressed > 0)
47 pwr_off_pressed++; 47 back_pressed++;
48 if(pwr_off_pressed >= 4) 48 if(back_pressed >= 4)
49 break; 49 break;
50 continue; 50 continue;
51 } 51 }
@@ -56,10 +56,10 @@ int main(int argc, char **argv)
56 nwz_key_get_name(nwz_key_event_get_keycode(&evt)), 56 nwz_key_get_name(nwz_key_event_get_keycode(&evt)),
57 nwz_key_event_is_press(&evt) ? "pressed" : "released", 57 nwz_key_event_is_press(&evt) ? "pressed" : "released",
58 nwz_key_event_get_hold_status(&evt)); 58 nwz_key_event_get_hold_status(&evt));
59 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_OPTION && nwz_key_event_is_press(&evt)) 59 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_BACK && nwz_key_event_is_press(&evt))
60 pwr_off_pressed = 1; 60 back_pressed = 1;
61 else 61 else
62 pwr_off_pressed = 0; 62 back_pressed = 0;
63 } 63 }
64 /* close input device */ 64 /* close input device */
65 close(input_fd); 65 close(input_fd);
diff --git a/utils/nwztools/plattools/test_power.c b/utils/nwztools/plattools/test_power.c
index c02f689b17..9c429b989a 100644
--- a/utils/nwztools/plattools/test_power.c
+++ b/utils/nwztools/plattools/test_power.c
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
63{ 63{
64 /* clear screen and display welcome message */ 64 /* clear screen and display welcome message */
65 nwz_lcdmsg(true, 0, 0, "test_power"); 65 nwz_lcdmsg(true, 0, 0, "test_power");
66 nwz_lcdmsg(false, 0, 2, "PWR OFF: quit"); 66 nwz_lcdmsg(false, 0, 2, "BACK: quit");
67 /* open input device */ 67 /* open input device */
68 int input_fd = nwz_key_open(); 68 int input_fd = nwz_key_open();
69 if(input_fd < 0) 69 if(input_fd < 0)
@@ -126,7 +126,7 @@ int main(int argc, char **argv)
126 struct input_event evt; 126 struct input_event evt;
127 if(nwz_key_read_event(input_fd, &evt) != 1) 127 if(nwz_key_read_event(input_fd, &evt) != 1)
128 continue; 128 continue;
129 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_OPTION && !nwz_key_event_is_press(&evt)) 129 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_BACK && !nwz_key_event_is_press(&evt))
130 break; 130 break;
131 } 131 }
132 /* finish nicely */ 132 /* finish nicely */
diff --git a/utils/nwztools/plattools/test_ts.c b/utils/nwztools/plattools/test_ts.c
index 73e729a093..af6c741e00 100644
--- a/utils/nwztools/plattools/test_ts.c
+++ b/utils/nwztools/plattools/test_ts.c
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
24{ 24{
25 /* clear screen and display welcome message */ 25 /* clear screen and display welcome message */
26 nwz_lcdmsg(true, 0, 0, "test_ts"); 26 nwz_lcdmsg(true, 0, 0, "test_ts");
27 nwz_lcdmsg(false, 0, 2, "PWR OFF: quit"); 27 nwz_lcdmsg(false, 0, 2, "BACK: quit");
28 /* open input device */ 28 /* open input device */
29 int key_fd = nwz_key_open(); 29 int key_fd = nwz_key_open();
30 if(key_fd < 0) 30 if(key_fd < 0)
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
61 struct input_event evt; 61 struct input_event evt;
62 if(nwz_key_read_event(key_fd, &evt) == 1) 62 if(nwz_key_read_event(key_fd, &evt) == 1)
63 { 63 {
64 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_OPTION && 64 if(nwz_key_event_get_keycode(&evt) == NWZ_KEY_BACK &&
65 nwz_key_event_is_press(&evt)) 65 nwz_key_event_is_press(&evt))
66 break; /* quit */ 66 break; /* quit */
67 } 67 }