summaryrefslogtreecommitdiff
path: root/utils/nwztools
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-11-11 16:01:14 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2016-11-11 16:07:14 +0100
commitc95e30b75d75b674f0d645b7c41377bbd0511213 (patch)
tree3a0d6253a0a5cab8cbc14b1258f0b2d7b4f74e0d /utils/nwztools
parent44bb2856a59be53ef5ede154a39c54a59b1cc6d0 (diff)
downloadrockbox-c95e30b75d75b674f0d645b7c41377bbd0511213.tar.gz
rockbox-c95e30b75d75b674f0d645b7c41377bbd0511213.zip
nwztools/plattools: use player database and rework stuff
Using the database, we can now safely read/write the NVP. I also add more support for Sony's "display" tool. Change-Id: I8439fe9bad391c7f29859d99f236781be7983625
Diffstat (limited to 'utils/nwztools')
-rw-r--r--utils/nwztools/plattools/Makefile5
-rw-r--r--utils/nwztools/plattools/dest_tool.c65
-rw-r--r--utils/nwztools/plattools/nwz_lib.c209
-rw-r--r--utils/nwztools/plattools/nwz_lib.h49
-rw-r--r--utils/nwztools/plattools/nwz_lib_devlist.c192
-rw-r--r--utils/nwztools/plattools/test_display.c20
6 files changed, 278 insertions, 262 deletions
diff --git a/utils/nwztools/plattools/Makefile b/utils/nwztools/plattools/Makefile
index 067b4a7033..3031bc72b4 100644
--- a/utils/nwztools/plattools/Makefile
+++ b/utils/nwztools/plattools/Makefile
@@ -2,9 +2,10 @@ PREFIX?=arm-sony-linux-gnueabi-
2CC=$(PREFIX)gcc 2CC=$(PREFIX)gcc
3LD=$(PREFIX)gcc 3LD=$(PREFIX)gcc
4CFLAGS=-std=gnu99 -Wall -O2 4CFLAGS=-std=gnu99 -Wall -O2
5INCLUDES=-I. 5NWZ_DB_DIR=../database
6INCLUDES=-I. -I$(NWZ_DB_DIR)
6 7
7LIB_FILES=nwz_lib.c nwz_lib_devlist.c 8LIB_FILES=nwz_lib.c $(NWZ_DB_DIR)/nwz_db.c
8TOOL_FILES=dest_tool.c test_adc.c test_adc.c test_bl.c test_display.c \ 9TOOL_FILES=dest_tool.c test_adc.c test_adc.c test_bl.c test_display.c \
9 test_keys.c test_power.c test_ts.c test_fb.c 10 test_keys.c test_power.c test_ts.c test_fb.c
10ALL_ELF=$(patsubst %.c,%.elf,$(TOOL_FILES)) all_tools.elf dualboot.elf 11ALL_ELF=$(patsubst %.c,%.elf,$(TOOL_FILES)) all_tools.elf dualboot.elf
diff --git a/utils/nwztools/plattools/dest_tool.c b/utils/nwztools/plattools/dest_tool.c
index d137239f7f..9fb075e9b3 100644
--- a/utils/nwztools/plattools/dest_tool.c
+++ b/utils/nwztools/plattools/dest_tool.c
@@ -23,29 +23,6 @@
23#include <stdlib.h> 23#include <stdlib.h>
24#include "nwz_plattools.h" 24#include "nwz_plattools.h"
25 25
26extern char **environ;
27
28static const char *white_list[] =
29{
30 "NWZ-E463", "NWZ-E464", "NWZ-E465",
31 "NWZ-A863", "NWZ-A864", "NWZ-A865", "NWZ-A866", "NWZ-A867",
32 NULL,
33};
34
35/* get model id from ICX_MODEL_ID environment variable */
36static unsigned long find_model_id(void)
37{
38 const char *mid = getenv("ICX_MODEL_ID");
39 if(mid == NULL)
40 return 0;
41 char *end;
42 unsigned long v = strtoul(mid, &end, 0);
43 if(*end)
44 return 0;
45 else
46 return v;
47}
48
49static unsigned long read32(unsigned char *buf) 26static unsigned long read32(unsigned char *buf)
50{ 27{
51 return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24; 28 return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24;
@@ -111,7 +88,7 @@ int NWZ_TOOL_MAIN(dest_tool)(int argc, char **argv)
111 sleep(2); 88 sleep(2);
112 return 1; 89 return 1;
113 } 90 }
114 unsigned long model_id = find_model_id(); 91 unsigned long model_id = nwz_get_model_id();
115 if(model_id == 0) 92 if(model_id == 0)
116 { 93 {
117 nwz_key_close(input_fd); 94 nwz_key_close(input_fd);
@@ -119,37 +96,39 @@ int NWZ_TOOL_MAIN(dest_tool)(int argc, char **argv)
119 sleep(2); 96 sleep(2);
120 return 1; 97 return 1;
121 } 98 }
122 const char *model_name = nwz_get_model_name(model_id); 99 const char *model_name = nwz_get_model_name();
123 if(model_name == NULL) 100 if(model_name == NULL)
124 model_name = "Unknown"; 101 model_name = "Unknown";
102 const char *series_name = "Unknown";
103 bool ok_model = false;
104 if(nwz_get_series() != -1)
105 {
106 series_name = nwz_series[nwz_get_series()].name;
107 ok_model = true;
108 }
125 nwz_lcdmsgf(false, 0, 2, "Model ID: %#x", model_id); 109 nwz_lcdmsgf(false, 0, 2, "Model ID: %#x", model_id);
126 nwz_lcdmsgf(false, 0, 3, "Model Name: %s", model_name); 110 nwz_lcdmsgf(false, 0, 3, "Model: %s", model_name);
111 nwz_lcdmsgf(false, 0, 4, "Series: %s", series_name);
127 nwz_lcdmsg(false, 0, 5, "BACK: quit"); 112 nwz_lcdmsg(false, 0, 5, "BACK: quit");
128 nwz_lcdmsg(false, 0, 6, "LEFT/RIGHT: change dest"); 113 nwz_lcdmsg(false, 0, 6, "LEFT/RIGHT: change dest");
129 nwz_lcdmsg(false, 0, 7, "PLAY/PAUSE: change sps"); 114 nwz_lcdmsg(false, 0, 7, "PLAY/PAUSE: change sps");
130 bool ok_model = false;
131 for(int i = 0; white_list[i]; i++)
132 if(strcmp(white_list[i], model_name) == 0)
133 ok_model = true;
134 /* display input state in a loop */ 115 /* display input state in a loop */
135 while(1) 116 while(1)
136 { 117 {
137 unsigned char nvp_buf[20]; 118 unsigned char nvp_buf[32];
138 bool ok_nvp = false; 119 bool ok_nvp = false;
139 if(ok_model) 120 if(ok_model)
140 { 121 {
141 int fd = open("/dev/icx_nvp/011", O_RDONLY); 122 /* make sure node has the right size... */
142 if(fd >= 0) 123 if(nwz_nvp_read(NWZ_NVP_SHP, NULL) == sizeof(nvp_buf))
143 { 124 {
144 ssize_t cnt = read(fd, nvp_buf, sizeof(nvp_buf)); 125 if(nwz_nvp_read(NWZ_NVP_SHP, nvp_buf) == sizeof(nvp_buf))
145 if(cnt == (ssize_t)sizeof(nvp_buf))
146 ok_nvp = true; 126 ok_nvp = true;
147 else 127 else
148 nwz_lcdmsg(false, 1, 9, "Cannot read NVP.\n"); 128 nwz_lcdmsg(false, 1, 9, "Cannot read NVP.\n");
149 close(fd);
150 } 129 }
151 else 130 else
152 nwz_lcdmsg(false, 1, 9, "Cannot open NVP.\n"); 131 nwz_lcdmsg(false, 1, 9, "NVP node has the wrong size.\n");
153 } 132 }
154 else 133 else
155 { 134 {
@@ -203,16 +182,8 @@ int NWZ_TOOL_MAIN(dest_tool)(int argc, char **argv)
203 /* write nvp */ 182 /* write nvp */
204 if(ok_nvp && write_nvp) 183 if(ok_nvp && write_nvp)
205 { 184 {
206 int fd = open("/dev/icx_nvp/011", O_RDWR); 185 if(nwz_nvp_write(NWZ_NVP_SHP, nvp_buf) != 0)
207 if(fd >= 0) 186 nwz_lcdmsg(false, 1, 12, "Cannot write NVP.\n");
208 {
209 ssize_t cnt = write(fd, nvp_buf, sizeof(nvp_buf));
210 if(cnt != (ssize_t)sizeof(nvp_buf))
211 nwz_lcdmsg(false, 1, 12, "Cannot write NVP.\n");
212 close(fd);
213 }
214 else
215 nwz_lcdmsg(false, 1, 12, "Cannot open NVP.\n");
216 } 187 }
217 } 188 }
218 /* finish nicely */ 189 /* finish nicely */
diff --git a/utils/nwztools/plattools/nwz_lib.c b/utils/nwztools/plattools/nwz_lib.c
index 43dc977d42..70dc070fc9 100644
--- a/utils/nwztools/plattools/nwz_lib.c
+++ b/utils/nwztools/plattools/nwz_lib.c
@@ -19,16 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "nwz_lib.h" 21#include "nwz_lib.h"
22 22#include "nwz_db.h"
23extern struct nwz_dev_info_t g_nwz_dev_list[];
24
25const char *nwz_get_model_name(unsigned long model_id)
26{
27 for(int i = 0; g_nwz_dev_list[i].name; i++)
28 if(g_nwz_dev_list[i].model_id == model_id)
29 return g_nwz_dev_list[i].name;
30 return NULL;
31}
32 23
33int nwz_run(const char *file, const char *args[], bool wait) 24int nwz_run(const char *file, const char *args[], bool wait)
34{ 25{
@@ -91,7 +82,7 @@ void nwz_lcdmsg(bool clear, int x, int y, const char *msg)
91 const char *args[16]; 82 const char *args[16];
92 int index = 0; 83 int index = 0;
93 char locate[32]; 84 char locate[32];
94 args[index++] = path_lcdmsg; 85 args[index++] = "lcdmsg";
95 if(clear) 86 if(clear)
96 args[index++] = "-c"; 87 args[index++] = "-c";
97 args[index++] = "-f"; 88 args[index++] = "-f";
@@ -116,6 +107,96 @@ void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...)
116 nwz_lcdmsg(clear, x, y, buffer); 107 nwz_lcdmsg(clear, x, y, buffer);
117} 108}
118 109
110#define NWZ_COLOR_RGB(col) \
111 NWZ_COLOR_RED(col), NWZ_COLOR_GREEN(col), NWZ_COLOR_BLUE(col)
112
113void nwz_display_clear(nwz_color_t color)
114{
115 const char *path_display = "/usr/local/bin/display";
116 const char *args[16];
117 int index = 0;
118 char col[32];
119 args[index++] = "display";
120 args[index++] = "lcd";
121 args[index++] = "clear";
122 sprintf(col, "%d,%d,%d", NWZ_COLOR_RGB(color));
123 args[index++] = col;
124 args[index++] = NULL;
125 /* wait for lcdmsg to finish to avoid any race conditions in framebuffer
126 * accesses */
127 nwz_run(path_display, args, true);
128}
129
130void nwz_display_text(int x, int y, bool big_font, nwz_color_t foreground_col,
131 nwz_color_t background_col, int alpha, const char *text)
132{
133 const char *path_display = "/usr/local/bin/display";
134 const char *args[16];
135 int index = 0;
136 char fg[32],bg[32], pos[32], transp[16];
137 args[index++] = "display";
138 args[index++] = "lcd";
139 args[index++] = "text";
140 sprintf(pos, "%d,%d", x, y);
141 args[index++] = pos;
142 if(big_font)
143 args[index++] = "/usr/local/bin/font_14x24.bmp";
144 else
145 args[index++] = "/usr/local/bin/font_08x12.bmp";
146 sprintf(fg, "%d,%d,%d", NWZ_COLOR_RGB(foreground_col));
147 args[index++] = fg;
148 sprintf(bg, "%d,%d,%d", NWZ_COLOR_RGB(background_col));
149 args[index++] = bg;
150 sprintf(transp, "%d", alpha);
151 args[index++] = transp;
152 args[index++] = text;
153 args[index++] = NULL;
154 /* wait for lcdmsg to finish to avoid any race conditions in framebuffer
155 * accesses */
156 nwz_run(path_display, args, true);
157}
158
159void nwz_display_textf(int x, int y, bool big_font, nwz_color_t foreground_col,
160 nwz_color_t background_col, int alpha, const char *fmt, ...)
161{
162 char buffer[1024];
163 va_list args;
164 va_start(args, fmt);
165 vsprintf(buffer, fmt, args);
166 va_end(args);
167 nwz_display_text(x, y, big_font, foreground_col, background_col, alpha, buffer);
168}
169
170void nwz_display_bitmap(int x, int y, const char *file, int left, int top,
171 int width, int height, nwz_color_t key_col, int bmp_alpha)
172{
173 const char *path_display = "/usr/local/bin/display";
174 const char *args[16];
175 int index = 0;
176 char pos[32], topleft[32], dim[32], key[32], transp[16];
177 args[index++] = "display";
178 args[index++] = "lcd";
179 args[index++] = "bitmap";
180 sprintf(pos, "%d,%d", x, y);
181 args[index++] = pos;
182 args[index++] = file;
183 sprintf(topleft, "%d,%d", left, top);
184 args[index++] = topleft;
185 sprintf(dim, "%d,%d", width, height);
186 args[index++] = dim;
187 if(key_col == NWZ_COLOR_NO_KEY)
188 sprintf(key, "no");
189 else
190 sprintf(key, "%d,%d,%d", NWZ_COLOR_RGB(key_col));
191 args[index++] = key;
192 sprintf(transp, "%d", bmp_alpha);
193 args[index++] = transp;
194 args[index++] = NULL;
195 /* wait for lcdmsg to finish to avoid any race conditions in framebuffer
196 * accesses */
197 nwz_run(path_display, args, true);
198}
199
119int nwz_input_open(const char *requested_name) 200int nwz_input_open(const char *requested_name)
120{ 201{
121 /* try all /dev/input/eventX, there can't a lot of them */ 202 /* try all /dev/input/eventX, there can't a lot of them */
@@ -259,6 +340,20 @@ int nwz_fb_set_standard_mode(int fd)
259 return 0; 340 return 0;
260} 341}
261 342
343int nwz_fb_get_resolution(int fd, int *x, int *y, int *bpp)
344{
345 struct fb_var_screeninfo vinfo;
346 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
347 return -1;
348 if(x)
349 *x = vinfo.xres;
350 if(y)
351 *y = vinfo.yres;
352 if(bpp)
353 *bpp = vinfo.bits_per_pixel;
354 return 0;
355}
356
262int nwz_adc_open(void) 357int nwz_adc_open(void)
263{ 358{
264 return open(NWZ_ADC_DEV, O_RDONLY); 359 return open(NWZ_ADC_DEV, O_RDONLY);
@@ -560,3 +655,95 @@ unsigned int nwz_pminfo_get_factor(int fd)
560 else 655 else
561 return val; 656 return val;
562} 657}
658
659static unsigned long find_model_id(void)
660{
661 /* try with the environment variable */
662 const char *mid = getenv("ICX_MODEL_ID");
663 if(mid == NULL)
664 return 0;
665 char *end;
666 unsigned long v = strtoul(mid, &end, 0);
667 if(*end)
668 return 0;
669 else
670 return v;
671}
672
673unsigned long nwz_get_model_id(void)
674{
675 static unsigned long model_id = 0xffffffff;
676 if(model_id == 0xffffffff)
677 model_id = find_model_id();
678 return model_id;
679}
680
681const char *nwz_get_model_name()
682{
683 for(int i = 0; i < NWZ_MODEL_COUNT; i++)
684 if(nwz_model[i].mid == nwz_get_model_id())
685 return nwz_model[i].name;
686 return NULL;
687}
688
689static int find_series(void)
690{
691 for(int i = 0; i < NWZ_SERIES_COUNT; i++)
692 for(int j = 0; j < nwz_series[i].mid_count; j++)
693 if(nwz_series[i].mid[j] == nwz_get_model_id())
694 return i;
695 return -1;
696}
697
698int nwz_get_series(void)
699{
700 static int series = -2;
701 if(series == -2)
702 series = find_series();
703 return series;
704}
705
706static nwz_nvp_index_t *get_nvp_index(void)
707{
708 static nwz_nvp_index_t *index = 0;
709 if(index == 0)
710 {
711 int series = nwz_get_series();
712 index = series < 0 ? 0 : nwz_series[series].nvp_index;
713 }
714 return index;
715}
716
717int nwz_nvp_read(enum nwz_nvp_node_t node, void *data)
718{
719 int size = nwz_nvp[node].size;
720 if(data == 0)
721 return size;
722 nwz_nvp_index_t *index = get_nvp_index();
723 if(index == 0 || (*index)[node] == NWZ_NVP_INVALID)
724 return -1;
725 char nvp_path[32];
726 snprintf(nvp_path, sizeof(nvp_path), "/dev/icx_nvp/%03d", (*index)[node]);
727 int fd = open(nvp_path, O_RDONLY);
728 if(fd < 0)
729 return -1;
730 int cnt = read(fd, data, size);
731 close(fd);
732 return cnt == size ? size : -1;
733}
734
735int nwz_nvp_write(enum nwz_nvp_node_t node, void *data)
736{
737 int size = nwz_nvp[node].size;
738 nwz_nvp_index_t *index = get_nvp_index();
739 if(index == 0 || (*index)[node] == NWZ_NVP_INVALID)
740 return -1;
741 char nvp_path[32];
742 snprintf(nvp_path, sizeof(nvp_path), "/dev/icx_nvp/%03d", (*index)[node]);
743 int fd = open(nvp_path, O_WRONLY);
744 if(fd < 0)
745 return -1;
746 int cnt = write(fd, data, size);
747 close(fd);
748 return cnt == size ? 0 : -1;
749}
diff --git a/utils/nwztools/plattools/nwz_lib.h b/utils/nwztools/plattools/nwz_lib.h
index 9e7b8f16c2..18d7f9dd07 100644
--- a/utils/nwztools/plattools/nwz_lib.h
+++ b/utils/nwztools/plattools/nwz_lib.h
@@ -28,6 +28,7 @@
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/wait.h> 29#include <sys/wait.h>
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/fb.h>
31#include <fcntl.h> 32#include <fcntl.h>
32#include <string.h> 33#include <string.h>
33#include <stdlib.h> 34#include <stdlib.h>
@@ -37,14 +38,16 @@
37#include "nwz_adc.h" 38#include "nwz_adc.h"
38#include "nwz_ts.h" 39#include "nwz_ts.h"
39#include "nwz_power.h" 40#include "nwz_power.h"
41#include "nwz_db.h"
40 42
41struct nwz_dev_info_t 43/* get model ID, either from ICX_MODEL_ID env var or using nvpflag, return 0
42{ 44 * in case of error; note that the result is cached so this function is only
43 unsigned long model_id; 45 * expensive the first time it is called */
44 const char *name; 46unsigned long nwz_get_model_id(void);
45}; 47/* get series (index into nwz_series, or -1 on error) */
46 48int nwz_get_series(void);
47const char *nwz_get_model_name(unsigned long model_id); 49/* get model name, or null on error */
50const char *nwz_get_model_name(void);
48 51
49/* run a program and exit with nonzero status in case of error 52/* run a program and exit with nonzero status in case of error
50 * argument list must be NULL terminated */ 53 * argument list must be NULL terminated */
@@ -52,10 +55,30 @@ int nwz_run(const char *file, const char *args[], bool wait);
52/* run a program and return program output */ 55/* run a program and return program output */
53char *nwz_run_pipe(const char *file, const char *args[], int *status); 56char *nwz_run_pipe(const char *file, const char *args[], int *status);
54 57
55/* invoke /usr/bin/lcdmsg to display a message using the small font, optionally 58/* invoke /usr/local/bin/lcdmsg to display a message using the small font, optionally
56 * clearing the screen before */ 59 * clearing the screen before */
57void nwz_lcdmsg(bool clear, int x, int y, const char *msg); 60void nwz_lcdmsg(bool clear, int x, int y, const char *msg);
58void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...); 61void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...);
62/* invoke /usr/local/bin/display to do various things:
63 * - clear screen
64 * - display text
65 * - display bitmap
66 * Currently all operations are performed on the LCD only.
67 * The small text font is 8x12 and the big one is 14x24 */
68typedef int nwz_color_t;
69#define NWZ_COLOR(r, g, b) /* each component between 0 and 255 */ \
70 ((r) << 16 | (g) << 8 | (b))
71#define NWZ_COLOR_RED(col) ((col) >> 16)
72#define NWZ_COLOR_GREEN(col) (((col) >> 8) & 0xff)
73#define NWZ_COLOR_BLUE(col) ((col) & 0xff)
74#define NWZ_COLOR_NO_KEY (1 << 24)
75void nwz_display_clear(nwz_color_t color);
76void nwz_display_text(int x, int y, bool big_font, nwz_color_t foreground_col,
77 nwz_color_t background_col, int background_alpha, const char *text);
78void nwz_display_textf(int x, int y, bool big_font, nwz_color_t foreground_col,
79 nwz_color_t background_col, int background_alpha, const char *fmt, ...);
80void nwz_display_bitmap(int x, int y, const char *file, int left, int top,
81 int width, int height, nwz_color_t key, int bmp_alpha);
59 82
60/* open icx_key input device and return file descriptor */ 83/* open icx_key input device and return file descriptor */
61int nwz_key_open(void); 84int nwz_key_open(void);
@@ -81,6 +104,8 @@ const char *nwz_key_get_name(int keycode);
81int nwz_fb_open(bool lcd); 104int nwz_fb_open(bool lcd);
82/* close framebuffer device */ 105/* close framebuffer device */
83void nwz_fb_close(int fb); 106void nwz_fb_close(int fb);
107/* get screen resolution, parameters are allowed to be NULL */
108int nwz_fb_get_resolution(int fd, int *x, int *y, int *bpp);
84/* get backlight brightness (return -1 on error, 1 on success) */ 109/* get backlight brightness (return -1 on error, 1 on success) */
85int nwz_fb_get_brightness(int fd, struct nwz_fb_brightness *bl); 110int nwz_fb_get_brightness(int fd, struct nwz_fb_brightness *bl);
86/* set backlight brightness (return -1 on error, 1 on success) */ 111/* set backlight brightness (return -1 on error, 1 on success) */
@@ -171,4 +196,12 @@ void nwz_pminfo_close(int fd);
171/* get pminfo factor (or 0 on error) */ 196/* get pminfo factor (or 0 on error) */
172unsigned int nwz_pminfo_get_factor(int fd); 197unsigned int nwz_pminfo_get_factor(int fd);
173 198
199/* read a nvp node and return its size, if the data pointer is null, then simply
200 * return the size, return -1 on error */
201int nwz_nvp_read(enum nwz_nvp_node_t node, void *data);
202/* write a nvp node, return 0 on success and -1 on error, the size of the buffer
203 * must be the one returned by nwz_nvp_read */
204int nwz_nvp_write(enum nwz_nvp_node_t node, void *data);
205
206
174#endif /* _NWZLIB_H_ */ 207#endif /* _NWZLIB_H_ */
diff --git a/utils/nwztools/plattools/nwz_lib_devlist.c b/utils/nwztools/plattools/nwz_lib_devlist.c
deleted file mode 100644
index 1631a0cbc5..0000000000
--- a/utils/nwztools/plattools/nwz_lib_devlist.c
+++ /dev/null
@@ -1,192 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2016 Amaury Pouly
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22/* NOTE: this file was automatically generated */
23#include "nwz_lib.h"
24
25struct nwz_dev_info_t g_nwz_dev_list[] =
26{
27 { 0x10000, "NWZ-A815" },
28 { 0x10001, "NWZ-A816" },
29 { 0x10002, "NWZ-A818" },
30 { 0x1000000, "NW-S615F" },
31 { 0x1000001, "NW-S616F" },
32 { 0x1010000, "NW-S715F" },
33 { 0x1010001, "NW-S716F" },
34 { 0x1010002, "NW-S718F" },
35 { 0x1020000, "NWZ-S615F" },
36 { 0x1020001, "NWZ-S616F" },
37 { 0x1020002, "NWZ-S618F" },
38 { 0x1030000, "NWZ-S515" },
39 { 0x1030001, "NWZ-S516" },
40 { 0x1040000, "NWZ-S715F" },
41 { 0x1040001, "NWZ-S716F" },
42 { 0x1040002, "NWZ-S718F" },
43 { 0x2000001, "NW-A916" },
44 { 0x2000002, "NW-A918" },
45 { 0x2000004, "NW-A919" },
46 { 0x3000001, "NWZ-A826" },
47 { 0x3000002, "NWZ-A828" },
48 { 0x3000004, "NWZ-A829" },
49 { 0x3010001, "NW-A826" },
50 { 0x3010002, "NW-A828" },
51 { 0x3010004, "NW-A829" },
52 { 0x3020001, "NWZ-A726B" },
53 { 0x3020002, "NWZ-A728B" },
54 { 0x3020004, "NWZ-A729B" },
55 { 0x3030001, "NWZ-A726" },
56 { 0x3030002, "NWZ-A728" },
57 { 0x3030004, "NWZ-A729" },
58 { 0x4000001, "NW-S636F" },
59 { 0x4000002, "NW-S638F" },
60 { 0x4000004, "NW-S639F" },
61 { 0x4010001, "NW-S736F" },
62 { 0x4010002, "NW-S738F" },
63 { 0x4010004, "NW-S739F" },
64 { 0x4020001, "NWZ-S636F" },
65 { 0x4020002, "NWZ-S638F" },
66 { 0x4020004, "NWZ-S639F" },
67 { 0x4030001, "NWZ-S736F" },
68 { 0x4030002, "NWZ-S738F" },
69 { 0x4030004, "NWZ-S739F" },
70 { 0x5000002, "NW-X1040" },
71 { 0x5000004, "NW-X1050" },
72 { 0x5000005, "NW-X1060" },
73 { 0x5010002, "NWZ-NONAME" },
74 { 0x5010004, "NWZ-NONAME" },
75 { 0x5010005, "NWZ-NONAME" },
76 { 0x5020002, "NWZ-X1040" },
77 { 0x5020004, "NWZ-X1050" },
78 { 0x5020005, "NWZ-X1060" },
79 { 0x5040002, "NWZ-X1041" },
80 { 0x5040004, "NWZ-X1051" },
81 { 0x5040005, "NWZ-X1061" },
82 { 0x6010002, "NW-S644" },
83 { 0x6010004, "NW-S645" },
84 { 0x6010005, "NW-S646" },
85 { 0x6020002, "NWZ-S744" },
86 { 0x6020004, "NWZ-S745" },
87 { 0x6020005, "NWZ-S746" },
88 { 0x6030002, "NW-S744" },
89 { 0x6030004, "NW-S745" },
90 { 0x6030005, "NW-S746" },
91 { 0x7000004, "NWZ-A845" },
92 { 0x7000005, "NWZ-A846" },
93 { 0x7000006, "NWZ-A847" },
94 { 0x7010004, "NW-A845" },
95 { 0x7010005, "NW-A846" },
96 { 0x7010006, "NW-A847" },
97 { 0x9000002, "NW-S754" },
98 { 0x9000004, "NW-S755" },
99 { 0x9000005, "NW-S756" },
100 { 0x8000000, "NW-E052" },
101 { 0x8000001, "NW-E053" },
102 { 0x8000002, "NW-E054" },
103 { 0xb000001, "NWZ-E453" },
104 { 0xb000002, "NWZ-E454" },
105 { 0xb000004, "NWZ-E455" },
106 { 0xc000001, "NWZ-E353" },
107 { 0xc000002, "NWZ-E354" },
108 { 0xc000004, "NWZ-E355" },
109 { 0xd000001, "NWZ-E553" },
110 { 0xd000002, "NWZ-E554" },
111 { 0xd000004, "NWZ-E555" },
112 { 0xd000005, "NWZ-E556" },
113 { 0xe000004, "NWZ-A855" },
114 { 0xe000005, "NWZ-A856" },
115 { 0xe000006, "NWZ-A857" },
116 { 0xf000002, "NWZ-S754" },
117 { 0xf000004, "NWZ-S755" },
118 { 0x10000000, "NWZ-E052" },
119 { 0x10000001, "NWZ-E053" },
120 { 0x11000001, "NW-A863" },
121 { 0x11000002, "NW-A864" },
122 { 0x11000004, "NW-A865" },
123 { 0x11000005, "NW-A866" },
124 { 0x11000006, "NW-A867" },
125 { 0x11010001, "NWZ-A863" },
126 { 0x11010002, "NWZ-A864" },
127 { 0x11010004, "NWZ-A865" },
128 { 0x11010005, "NWZ-A866" },
129 { 0x11010006, "NWZ-A867" },
130 { 0x11020001, "NWZ-A863" },
131 { 0x11020002, "NWZ-A864" },
132 { 0x11020004, "NWZ-A865" },
133 { 0x11020005, "NWZ-A866" },
134 { 0x11020006, "NWZ-A867" },
135 { 0x12000001, "NW-S763" },
136 { 0x12000002, "NW-S764" },
137 { 0x12000004, "NW-S765" },
138 { 0x12000005, "NW-S766" },
139 { 0x12000006, "NW-S767" },
140 { 0x12010001, "NWZ-S763" },
141 { 0x12010002, "NWZ-S764" },
142 { 0x12010004, "NWZ-S765" },
143 { 0x12010005, "NWZ-S766" },
144 { 0x12010006, "NWZ-S767" },
145 { 0x13000001, "NWZ-E463" },
146 { 0x13000002, "NWZ-E464" },
147 { 0x13000004, "NWZ-E465" },
148 { 0x14000000, "NW-E062" },
149 { 0x14000001, "NW-E063" },
150 { 0x14000002, "NW-E064" },
151 { 0x14000004, "NW-E065" },
152 { 0x14000005, "NW-E066" },
153 { 0x15000001, "NWZ-E473" },
154 { 0x15000002, "NWZ-E474" },
155 { 0x15000004, "NWZ-E475" },
156 { 0x15000005, "NWZ-E476" },
157 { 0x15010001, "NWZ-E573" },
158 { 0x15010002, "NWZ-E574" },
159 { 0x15010004, "NWZ-E575" },
160 { 0x15010005, "NWZ-E576" },
161 { 0x16000001, "NW-S773" },
162 { 0x16000002, "NW-S774" },
163 { 0x16000004, "NW-S775" },
164 { 0x16000005, "NW-S776" },
165 { 0x16010001, "NWZ-S773" },
166 { 0x16010002, "NWZ-S774" },
167 { 0x16010004, "NWZ-S775" },
168 { 0x16010005, "NWZ-S776" },
169 { 0x19000001, "NW-S783" },
170 { 0x19000002, "NW-S784" },
171 { 0x19000004, "NW-S785" },
172 { 0x19000005, "NW-S786" },
173 { 0x19010001, "NW-E083" },
174 { 0x19010002, "NW-E084" },
175 { 0x19010004, "NW-E085" },
176 { 0x19010005, "NW-E086" },
177 { 0x19020001, "NWZ-E583" },
178 { 0x19020002, "NWZ-E584" },
179 { 0x19020004, "NWZ-E585" },
180 { 0x19020005, "NWZ-E586" },
181 { 0x1a000001, "NW-A13" },
182 { 0x1a000002, "NW-A14" },
183 { 0x1a000004, "NW-A15" },
184 { 0x1a000005, "NW-A16" },
185 { 0x1a000006, "NW-A17" },
186 { 0x1a010001, "NWZ-A13" },
187 { 0x1a010002, "NWZ-A14" },
188 { 0x1a010004, "NWZ-A15" },
189 { 0x1a010005, "NWZ-A16" },
190 { 0x1a010006, "NWZ-A17" },
191 { 0, NULL },
192};
diff --git a/utils/nwztools/plattools/test_display.c b/utils/nwztools/plattools/test_display.c
index 0a8089eca9..b05b246b6f 100644
--- a/utils/nwztools/plattools/test_display.c
+++ b/utils/nwztools/plattools/test_display.c
@@ -24,8 +24,24 @@
24int NWZ_TOOL_MAIN(test_display)(int argc, char **argv) 24int NWZ_TOOL_MAIN(test_display)(int argc, char **argv)
25{ 25{
26 /* clear screen and display welcome message */ 26 /* clear screen and display welcome message */
27 nwz_lcdmsg(true, 0, 0, "test_display"); 27 nwz_display_clear(NWZ_COLOR(128, 128, 0));
28 nwz_lcdmsg(false, 0, 1, "BACK: quit"); 28 nwz_display_text(0, 0, true, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 0,
29 "Hello");
30 nwz_display_text(0, 30, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 128,
31 "BACK: quit");
32 nwz_display_text(0, 50, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 255,
33 "BACK: quit");
34 /* display /contents/display.bmp if any */
35 const char *bmp_fname = "/contents/display.bmp";
36 if(access(bmp_fname, R_OK) != -1)
37 {
38 nwz_display_bitmap(10, 70, bmp_fname, 0, 0, 200, 200, NWZ_COLOR_NO_KEY, 255);
39 }
40 else
41 {
42 nwz_display_text(0, 70, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 0), 0,
43 "Cannot find display.bmp");
44 }
29 /* wait for key */ 45 /* wait for key */
30 int input_fd = nwz_key_open(); 46 int input_fd = nwz_key_open();
31 if(input_fd < 0) 47 if(input_fd < 0)