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
This commit is contained in:
parent
44bb2856a5
commit
c95e30b75d
6 changed files with 278 additions and 262 deletions
|
@ -2,9 +2,10 @@ PREFIX?=arm-sony-linux-gnueabi-
|
|||
CC=$(PREFIX)gcc
|
||||
LD=$(PREFIX)gcc
|
||||
CFLAGS=-std=gnu99 -Wall -O2
|
||||
INCLUDES=-I.
|
||||
NWZ_DB_DIR=../database
|
||||
INCLUDES=-I. -I$(NWZ_DB_DIR)
|
||||
|
||||
LIB_FILES=nwz_lib.c nwz_lib_devlist.c
|
||||
LIB_FILES=nwz_lib.c $(NWZ_DB_DIR)/nwz_db.c
|
||||
TOOL_FILES=dest_tool.c test_adc.c test_adc.c test_bl.c test_display.c \
|
||||
test_keys.c test_power.c test_ts.c test_fb.c
|
||||
ALL_ELF=$(patsubst %.c,%.elf,$(TOOL_FILES)) all_tools.elf dualboot.elf
|
||||
|
|
|
@ -23,29 +23,6 @@
|
|||
#include <stdlib.h>
|
||||
#include "nwz_plattools.h"
|
||||
|
||||
extern char **environ;
|
||||
|
||||
static const char *white_list[] =
|
||||
{
|
||||
"NWZ-E463", "NWZ-E464", "NWZ-E465",
|
||||
"NWZ-A863", "NWZ-A864", "NWZ-A865", "NWZ-A866", "NWZ-A867",
|
||||
NULL,
|
||||
};
|
||||
|
||||
/* get model id from ICX_MODEL_ID environment variable */
|
||||
static unsigned long find_model_id(void)
|
||||
{
|
||||
const char *mid = getenv("ICX_MODEL_ID");
|
||||
if(mid == NULL)
|
||||
return 0;
|
||||
char *end;
|
||||
unsigned long v = strtoul(mid, &end, 0);
|
||||
if(*end)
|
||||
return 0;
|
||||
else
|
||||
return v;
|
||||
}
|
||||
|
||||
static unsigned long read32(unsigned char *buf)
|
||||
{
|
||||
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)
|
|||
sleep(2);
|
||||
return 1;
|
||||
}
|
||||
unsigned long model_id = find_model_id();
|
||||
unsigned long model_id = nwz_get_model_id();
|
||||
if(model_id == 0)
|
||||
{
|
||||
nwz_key_close(input_fd);
|
||||
|
@ -119,37 +96,39 @@ int NWZ_TOOL_MAIN(dest_tool)(int argc, char **argv)
|
|||
sleep(2);
|
||||
return 1;
|
||||
}
|
||||
const char *model_name = nwz_get_model_name(model_id);
|
||||
const char *model_name = nwz_get_model_name();
|
||||
if(model_name == NULL)
|
||||
model_name = "Unknown";
|
||||
const char *series_name = "Unknown";
|
||||
bool ok_model = false;
|
||||
if(nwz_get_series() != -1)
|
||||
{
|
||||
series_name = nwz_series[nwz_get_series()].name;
|
||||
ok_model = true;
|
||||
}
|
||||
nwz_lcdmsgf(false, 0, 2, "Model ID: %#x", model_id);
|
||||
nwz_lcdmsgf(false, 0, 3, "Model Name: %s", model_name);
|
||||
nwz_lcdmsgf(false, 0, 3, "Model: %s", model_name);
|
||||
nwz_lcdmsgf(false, 0, 4, "Series: %s", series_name);
|
||||
nwz_lcdmsg(false, 0, 5, "BACK: quit");
|
||||
nwz_lcdmsg(false, 0, 6, "LEFT/RIGHT: change dest");
|
||||
nwz_lcdmsg(false, 0, 7, "PLAY/PAUSE: change sps");
|
||||
bool ok_model = false;
|
||||
for(int i = 0; white_list[i]; i++)
|
||||
if(strcmp(white_list[i], model_name) == 0)
|
||||
ok_model = true;
|
||||
/* display input state in a loop */
|
||||
while(1)
|
||||
{
|
||||
unsigned char nvp_buf[20];
|
||||
unsigned char nvp_buf[32];
|
||||
bool ok_nvp = false;
|
||||
if(ok_model)
|
||||
{
|
||||
int fd = open("/dev/icx_nvp/011", O_RDONLY);
|
||||
if(fd >= 0)
|
||||
/* make sure node has the right size... */
|
||||
if(nwz_nvp_read(NWZ_NVP_SHP, NULL) == sizeof(nvp_buf))
|
||||
{
|
||||
ssize_t cnt = read(fd, nvp_buf, sizeof(nvp_buf));
|
||||
if(cnt == (ssize_t)sizeof(nvp_buf))
|
||||
if(nwz_nvp_read(NWZ_NVP_SHP, nvp_buf) == sizeof(nvp_buf))
|
||||
ok_nvp = true;
|
||||
else
|
||||
nwz_lcdmsg(false, 1, 9, "Cannot read NVP.\n");
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
nwz_lcdmsg(false, 1, 9, "Cannot open NVP.\n");
|
||||
nwz_lcdmsg(false, 1, 9, "NVP node has the wrong size.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -203,16 +182,8 @@ int NWZ_TOOL_MAIN(dest_tool)(int argc, char **argv)
|
|||
/* write nvp */
|
||||
if(ok_nvp && write_nvp)
|
||||
{
|
||||
int fd = open("/dev/icx_nvp/011", O_RDWR);
|
||||
if(fd >= 0)
|
||||
{
|
||||
ssize_t cnt = write(fd, nvp_buf, sizeof(nvp_buf));
|
||||
if(cnt != (ssize_t)sizeof(nvp_buf))
|
||||
nwz_lcdmsg(false, 1, 12, "Cannot write NVP.\n");
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
nwz_lcdmsg(false, 1, 12, "Cannot open NVP.\n");
|
||||
if(nwz_nvp_write(NWZ_NVP_SHP, nvp_buf) != 0)
|
||||
nwz_lcdmsg(false, 1, 12, "Cannot write NVP.\n");
|
||||
}
|
||||
}
|
||||
/* finish nicely */
|
||||
|
|
|
@ -19,16 +19,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include "nwz_lib.h"
|
||||
|
||||
extern struct nwz_dev_info_t g_nwz_dev_list[];
|
||||
|
||||
const char *nwz_get_model_name(unsigned long model_id)
|
||||
{
|
||||
for(int i = 0; g_nwz_dev_list[i].name; i++)
|
||||
if(g_nwz_dev_list[i].model_id == model_id)
|
||||
return g_nwz_dev_list[i].name;
|
||||
return NULL;
|
||||
}
|
||||
#include "nwz_db.h"
|
||||
|
||||
int nwz_run(const char *file, const char *args[], bool wait)
|
||||
{
|
||||
|
@ -91,7 +82,7 @@ void nwz_lcdmsg(bool clear, int x, int y, const char *msg)
|
|||
const char *args[16];
|
||||
int index = 0;
|
||||
char locate[32];
|
||||
args[index++] = path_lcdmsg;
|
||||
args[index++] = "lcdmsg";
|
||||
if(clear)
|
||||
args[index++] = "-c";
|
||||
args[index++] = "-f";
|
||||
|
@ -116,6 +107,96 @@ void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...)
|
|||
nwz_lcdmsg(clear, x, y, buffer);
|
||||
}
|
||||
|
||||
#define NWZ_COLOR_RGB(col) \
|
||||
NWZ_COLOR_RED(col), NWZ_COLOR_GREEN(col), NWZ_COLOR_BLUE(col)
|
||||
|
||||
void nwz_display_clear(nwz_color_t color)
|
||||
{
|
||||
const char *path_display = "/usr/local/bin/display";
|
||||
const char *args[16];
|
||||
int index = 0;
|
||||
char col[32];
|
||||
args[index++] = "display";
|
||||
args[index++] = "lcd";
|
||||
args[index++] = "clear";
|
||||
sprintf(col, "%d,%d,%d", NWZ_COLOR_RGB(color));
|
||||
args[index++] = col;
|
||||
args[index++] = NULL;
|
||||
/* wait for lcdmsg to finish to avoid any race conditions in framebuffer
|
||||
* accesses */
|
||||
nwz_run(path_display, args, true);
|
||||
}
|
||||
|
||||
void nwz_display_text(int x, int y, bool big_font, nwz_color_t foreground_col,
|
||||
nwz_color_t background_col, int alpha, const char *text)
|
||||
{
|
||||
const char *path_display = "/usr/local/bin/display";
|
||||
const char *args[16];
|
||||
int index = 0;
|
||||
char fg[32],bg[32], pos[32], transp[16];
|
||||
args[index++] = "display";
|
||||
args[index++] = "lcd";
|
||||
args[index++] = "text";
|
||||
sprintf(pos, "%d,%d", x, y);
|
||||
args[index++] = pos;
|
||||
if(big_font)
|
||||
args[index++] = "/usr/local/bin/font_14x24.bmp";
|
||||
else
|
||||
args[index++] = "/usr/local/bin/font_08x12.bmp";
|
||||
sprintf(fg, "%d,%d,%d", NWZ_COLOR_RGB(foreground_col));
|
||||
args[index++] = fg;
|
||||
sprintf(bg, "%d,%d,%d", NWZ_COLOR_RGB(background_col));
|
||||
args[index++] = bg;
|
||||
sprintf(transp, "%d", alpha);
|
||||
args[index++] = transp;
|
||||
args[index++] = text;
|
||||
args[index++] = NULL;
|
||||
/* wait for lcdmsg to finish to avoid any race conditions in framebuffer
|
||||
* accesses */
|
||||
nwz_run(path_display, args, true);
|
||||
}
|
||||
|
||||
void nwz_display_textf(int x, int y, bool big_font, nwz_color_t foreground_col,
|
||||
nwz_color_t background_col, int alpha, const char *fmt, ...)
|
||||
{
|
||||
char buffer[1024];
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vsprintf(buffer, fmt, args);
|
||||
va_end(args);
|
||||
nwz_display_text(x, y, big_font, foreground_col, background_col, alpha, buffer);
|
||||
}
|
||||
|
||||
void nwz_display_bitmap(int x, int y, const char *file, int left, int top,
|
||||
int width, int height, nwz_color_t key_col, int bmp_alpha)
|
||||
{
|
||||
const char *path_display = "/usr/local/bin/display";
|
||||
const char *args[16];
|
||||
int index = 0;
|
||||
char pos[32], topleft[32], dim[32], key[32], transp[16];
|
||||
args[index++] = "display";
|
||||
args[index++] = "lcd";
|
||||
args[index++] = "bitmap";
|
||||
sprintf(pos, "%d,%d", x, y);
|
||||
args[index++] = pos;
|
||||
args[index++] = file;
|
||||
sprintf(topleft, "%d,%d", left, top);
|
||||
args[index++] = topleft;
|
||||
sprintf(dim, "%d,%d", width, height);
|
||||
args[index++] = dim;
|
||||
if(key_col == NWZ_COLOR_NO_KEY)
|
||||
sprintf(key, "no");
|
||||
else
|
||||
sprintf(key, "%d,%d,%d", NWZ_COLOR_RGB(key_col));
|
||||
args[index++] = key;
|
||||
sprintf(transp, "%d", bmp_alpha);
|
||||
args[index++] = transp;
|
||||
args[index++] = NULL;
|
||||
/* wait for lcdmsg to finish to avoid any race conditions in framebuffer
|
||||
* accesses */
|
||||
nwz_run(path_display, args, true);
|
||||
}
|
||||
|
||||
int nwz_input_open(const char *requested_name)
|
||||
{
|
||||
/* try all /dev/input/eventX, there can't a lot of them */
|
||||
|
@ -259,6 +340,20 @@ int nwz_fb_set_standard_mode(int fd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int nwz_fb_get_resolution(int fd, int *x, int *y, int *bpp)
|
||||
{
|
||||
struct fb_var_screeninfo vinfo;
|
||||
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
||||
return -1;
|
||||
if(x)
|
||||
*x = vinfo.xres;
|
||||
if(y)
|
||||
*y = vinfo.yres;
|
||||
if(bpp)
|
||||
*bpp = vinfo.bits_per_pixel;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nwz_adc_open(void)
|
||||
{
|
||||
return open(NWZ_ADC_DEV, O_RDONLY);
|
||||
|
@ -560,3 +655,95 @@ unsigned int nwz_pminfo_get_factor(int fd)
|
|||
else
|
||||
return val;
|
||||
}
|
||||
|
||||
static unsigned long find_model_id(void)
|
||||
{
|
||||
/* try with the environment variable */
|
||||
const char *mid = getenv("ICX_MODEL_ID");
|
||||
if(mid == NULL)
|
||||
return 0;
|
||||
char *end;
|
||||
unsigned long v = strtoul(mid, &end, 0);
|
||||
if(*end)
|
||||
return 0;
|
||||
else
|
||||
return v;
|
||||
}
|
||||
|
||||
unsigned long nwz_get_model_id(void)
|
||||
{
|
||||
static unsigned long model_id = 0xffffffff;
|
||||
if(model_id == 0xffffffff)
|
||||
model_id = find_model_id();
|
||||
return model_id;
|
||||
}
|
||||
|
||||
const char *nwz_get_model_name()
|
||||
{
|
||||
for(int i = 0; i < NWZ_MODEL_COUNT; i++)
|
||||
if(nwz_model[i].mid == nwz_get_model_id())
|
||||
return nwz_model[i].name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int find_series(void)
|
||||
{
|
||||
for(int i = 0; i < NWZ_SERIES_COUNT; i++)
|
||||
for(int j = 0; j < nwz_series[i].mid_count; j++)
|
||||
if(nwz_series[i].mid[j] == nwz_get_model_id())
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int nwz_get_series(void)
|
||||
{
|
||||
static int series = -2;
|
||||
if(series == -2)
|
||||
series = find_series();
|
||||
return series;
|
||||
}
|
||||
|
||||
static nwz_nvp_index_t *get_nvp_index(void)
|
||||
{
|
||||
static nwz_nvp_index_t *index = 0;
|
||||
if(index == 0)
|
||||
{
|
||||
int series = nwz_get_series();
|
||||
index = series < 0 ? 0 : nwz_series[series].nvp_index;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
int nwz_nvp_read(enum nwz_nvp_node_t node, void *data)
|
||||
{
|
||||
int size = nwz_nvp[node].size;
|
||||
if(data == 0)
|
||||
return size;
|
||||
nwz_nvp_index_t *index = get_nvp_index();
|
||||
if(index == 0 || (*index)[node] == NWZ_NVP_INVALID)
|
||||
return -1;
|
||||
char nvp_path[32];
|
||||
snprintf(nvp_path, sizeof(nvp_path), "/dev/icx_nvp/%03d", (*index)[node]);
|
||||
int fd = open(nvp_path, O_RDONLY);
|
||||
if(fd < 0)
|
||||
return -1;
|
||||
int cnt = read(fd, data, size);
|
||||
close(fd);
|
||||
return cnt == size ? size : -1;
|
||||
}
|
||||
|
||||
int nwz_nvp_write(enum nwz_nvp_node_t node, void *data)
|
||||
{
|
||||
int size = nwz_nvp[node].size;
|
||||
nwz_nvp_index_t *index = get_nvp_index();
|
||||
if(index == 0 || (*index)[node] == NWZ_NVP_INVALID)
|
||||
return -1;
|
||||
char nvp_path[32];
|
||||
snprintf(nvp_path, sizeof(nvp_path), "/dev/icx_nvp/%03d", (*index)[node]);
|
||||
int fd = open(nvp_path, O_WRONLY);
|
||||
if(fd < 0)
|
||||
return -1;
|
||||
int cnt = write(fd, data, size);
|
||||
close(fd);
|
||||
return cnt == size ? 0 : -1;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/fb.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -37,14 +38,16 @@
|
|||
#include "nwz_adc.h"
|
||||
#include "nwz_ts.h"
|
||||
#include "nwz_power.h"
|
||||
#include "nwz_db.h"
|
||||
|
||||
struct nwz_dev_info_t
|
||||
{
|
||||
unsigned long model_id;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
const char *nwz_get_model_name(unsigned long model_id);
|
||||
/* get model ID, either from ICX_MODEL_ID env var or using nvpflag, return 0
|
||||
* in case of error; note that the result is cached so this function is only
|
||||
* expensive the first time it is called */
|
||||
unsigned long nwz_get_model_id(void);
|
||||
/* get series (index into nwz_series, or -1 on error) */
|
||||
int nwz_get_series(void);
|
||||
/* get model name, or null on error */
|
||||
const char *nwz_get_model_name(void);
|
||||
|
||||
/* run a program and exit with nonzero status in case of error
|
||||
* argument list must be NULL terminated */
|
||||
|
@ -52,10 +55,30 @@ int nwz_run(const char *file, const char *args[], bool wait);
|
|||
/* run a program and return program output */
|
||||
char *nwz_run_pipe(const char *file, const char *args[], int *status);
|
||||
|
||||
/* invoke /usr/bin/lcdmsg to display a message using the small font, optionally
|
||||
/* invoke /usr/local/bin/lcdmsg to display a message using the small font, optionally
|
||||
* clearing the screen before */
|
||||
void nwz_lcdmsg(bool clear, int x, int y, const char *msg);
|
||||
void nwz_lcdmsgf(bool clear, int x, int y, const char *format, ...);
|
||||
/* invoke /usr/local/bin/display to do various things:
|
||||
* - clear screen
|
||||
* - display text
|
||||
* - display bitmap
|
||||
* Currently all operations are performed on the LCD only.
|
||||
* The small text font is 8x12 and the big one is 14x24 */
|
||||
typedef int nwz_color_t;
|
||||
#define NWZ_COLOR(r, g, b) /* each component between 0 and 255 */ \
|
||||
((r) << 16 | (g) << 8 | (b))
|
||||
#define NWZ_COLOR_RED(col) ((col) >> 16)
|
||||
#define NWZ_COLOR_GREEN(col) (((col) >> 8) & 0xff)
|
||||
#define NWZ_COLOR_BLUE(col) ((col) & 0xff)
|
||||
#define NWZ_COLOR_NO_KEY (1 << 24)
|
||||
void nwz_display_clear(nwz_color_t color);
|
||||
void nwz_display_text(int x, int y, bool big_font, nwz_color_t foreground_col,
|
||||
nwz_color_t background_col, int background_alpha, const char *text);
|
||||
void nwz_display_textf(int x, int y, bool big_font, nwz_color_t foreground_col,
|
||||
nwz_color_t background_col, int background_alpha, const char *fmt, ...);
|
||||
void nwz_display_bitmap(int x, int y, const char *file, int left, int top,
|
||||
int width, int height, nwz_color_t key, int bmp_alpha);
|
||||
|
||||
/* open icx_key input device and return file descriptor */
|
||||
int nwz_key_open(void);
|
||||
|
@ -81,6 +104,8 @@ const char *nwz_key_get_name(int keycode);
|
|||
int nwz_fb_open(bool lcd);
|
||||
/* close framebuffer device */
|
||||
void nwz_fb_close(int fb);
|
||||
/* get screen resolution, parameters are allowed to be NULL */
|
||||
int nwz_fb_get_resolution(int fd, int *x, int *y, int *bpp);
|
||||
/* get backlight brightness (return -1 on error, 1 on success) */
|
||||
int nwz_fb_get_brightness(int fd, struct nwz_fb_brightness *bl);
|
||||
/* set backlight brightness (return -1 on error, 1 on success) */
|
||||
|
@ -171,4 +196,12 @@ void nwz_pminfo_close(int fd);
|
|||
/* get pminfo factor (or 0 on error) */
|
||||
unsigned int nwz_pminfo_get_factor(int fd);
|
||||
|
||||
/* read a nvp node and return its size, if the data pointer is null, then simply
|
||||
* return the size, return -1 on error */
|
||||
int nwz_nvp_read(enum nwz_nvp_node_t node, void *data);
|
||||
/* write a nvp node, return 0 on success and -1 on error, the size of the buffer
|
||||
* must be the one returned by nwz_nvp_read */
|
||||
int nwz_nvp_write(enum nwz_nvp_node_t node, void *data);
|
||||
|
||||
|
||||
#endif /* _NWZLIB_H_ */
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2016 Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* NOTE: this file was automatically generated */
|
||||
#include "nwz_lib.h"
|
||||
|
||||
struct nwz_dev_info_t g_nwz_dev_list[] =
|
||||
{
|
||||
{ 0x10000, "NWZ-A815" },
|
||||
{ 0x10001, "NWZ-A816" },
|
||||
{ 0x10002, "NWZ-A818" },
|
||||
{ 0x1000000, "NW-S615F" },
|
||||
{ 0x1000001, "NW-S616F" },
|
||||
{ 0x1010000, "NW-S715F" },
|
||||
{ 0x1010001, "NW-S716F" },
|
||||
{ 0x1010002, "NW-S718F" },
|
||||
{ 0x1020000, "NWZ-S615F" },
|
||||
{ 0x1020001, "NWZ-S616F" },
|
||||
{ 0x1020002, "NWZ-S618F" },
|
||||
{ 0x1030000, "NWZ-S515" },
|
||||
{ 0x1030001, "NWZ-S516" },
|
||||
{ 0x1040000, "NWZ-S715F" },
|
||||
{ 0x1040001, "NWZ-S716F" },
|
||||
{ 0x1040002, "NWZ-S718F" },
|
||||
{ 0x2000001, "NW-A916" },
|
||||
{ 0x2000002, "NW-A918" },
|
||||
{ 0x2000004, "NW-A919" },
|
||||
{ 0x3000001, "NWZ-A826" },
|
||||
{ 0x3000002, "NWZ-A828" },
|
||||
{ 0x3000004, "NWZ-A829" },
|
||||
{ 0x3010001, "NW-A826" },
|
||||
{ 0x3010002, "NW-A828" },
|
||||
{ 0x3010004, "NW-A829" },
|
||||
{ 0x3020001, "NWZ-A726B" },
|
||||
{ 0x3020002, "NWZ-A728B" },
|
||||
{ 0x3020004, "NWZ-A729B" },
|
||||
{ 0x3030001, "NWZ-A726" },
|
||||
{ 0x3030002, "NWZ-A728" },
|
||||
{ 0x3030004, "NWZ-A729" },
|
||||
{ 0x4000001, "NW-S636F" },
|
||||
{ 0x4000002, "NW-S638F" },
|
||||
{ 0x4000004, "NW-S639F" },
|
||||
{ 0x4010001, "NW-S736F" },
|
||||
{ 0x4010002, "NW-S738F" },
|
||||
{ 0x4010004, "NW-S739F" },
|
||||
{ 0x4020001, "NWZ-S636F" },
|
||||
{ 0x4020002, "NWZ-S638F" },
|
||||
{ 0x4020004, "NWZ-S639F" },
|
||||
{ 0x4030001, "NWZ-S736F" },
|
||||
{ 0x4030002, "NWZ-S738F" },
|
||||
{ 0x4030004, "NWZ-S739F" },
|
||||
{ 0x5000002, "NW-X1040" },
|
||||
{ 0x5000004, "NW-X1050" },
|
||||
{ 0x5000005, "NW-X1060" },
|
||||
{ 0x5010002, "NWZ-NONAME" },
|
||||
{ 0x5010004, "NWZ-NONAME" },
|
||||
{ 0x5010005, "NWZ-NONAME" },
|
||||
{ 0x5020002, "NWZ-X1040" },
|
||||
{ 0x5020004, "NWZ-X1050" },
|
||||
{ 0x5020005, "NWZ-X1060" },
|
||||
{ 0x5040002, "NWZ-X1041" },
|
||||
{ 0x5040004, "NWZ-X1051" },
|
||||
{ 0x5040005, "NWZ-X1061" },
|
||||
{ 0x6010002, "NW-S644" },
|
||||
{ 0x6010004, "NW-S645" },
|
||||
{ 0x6010005, "NW-S646" },
|
||||
{ 0x6020002, "NWZ-S744" },
|
||||
{ 0x6020004, "NWZ-S745" },
|
||||
{ 0x6020005, "NWZ-S746" },
|
||||
{ 0x6030002, "NW-S744" },
|
||||
{ 0x6030004, "NW-S745" },
|
||||
{ 0x6030005, "NW-S746" },
|
||||
{ 0x7000004, "NWZ-A845" },
|
||||
{ 0x7000005, "NWZ-A846" },
|
||||
{ 0x7000006, "NWZ-A847" },
|
||||
{ 0x7010004, "NW-A845" },
|
||||
{ 0x7010005, "NW-A846" },
|
||||
{ 0x7010006, "NW-A847" },
|
||||
{ 0x9000002, "NW-S754" },
|
||||
{ 0x9000004, "NW-S755" },
|
||||
{ 0x9000005, "NW-S756" },
|
||||
{ 0x8000000, "NW-E052" },
|
||||
{ 0x8000001, "NW-E053" },
|
||||
{ 0x8000002, "NW-E054" },
|
||||
{ 0xb000001, "NWZ-E453" },
|
||||
{ 0xb000002, "NWZ-E454" },
|
||||
{ 0xb000004, "NWZ-E455" },
|
||||
{ 0xc000001, "NWZ-E353" },
|
||||
{ 0xc000002, "NWZ-E354" },
|
||||
{ 0xc000004, "NWZ-E355" },
|
||||
{ 0xd000001, "NWZ-E553" },
|
||||
{ 0xd000002, "NWZ-E554" },
|
||||
{ 0xd000004, "NWZ-E555" },
|
||||
{ 0xd000005, "NWZ-E556" },
|
||||
{ 0xe000004, "NWZ-A855" },
|
||||
{ 0xe000005, "NWZ-A856" },
|
||||
{ 0xe000006, "NWZ-A857" },
|
||||
{ 0xf000002, "NWZ-S754" },
|
||||
{ 0xf000004, "NWZ-S755" },
|
||||
{ 0x10000000, "NWZ-E052" },
|
||||
{ 0x10000001, "NWZ-E053" },
|
||||
{ 0x11000001, "NW-A863" },
|
||||
{ 0x11000002, "NW-A864" },
|
||||
{ 0x11000004, "NW-A865" },
|
||||
{ 0x11000005, "NW-A866" },
|
||||
{ 0x11000006, "NW-A867" },
|
||||
{ 0x11010001, "NWZ-A863" },
|
||||
{ 0x11010002, "NWZ-A864" },
|
||||
{ 0x11010004, "NWZ-A865" },
|
||||
{ 0x11010005, "NWZ-A866" },
|
||||
{ 0x11010006, "NWZ-A867" },
|
||||
{ 0x11020001, "NWZ-A863" },
|
||||
{ 0x11020002, "NWZ-A864" },
|
||||
{ 0x11020004, "NWZ-A865" },
|
||||
{ 0x11020005, "NWZ-A866" },
|
||||
{ 0x11020006, "NWZ-A867" },
|
||||
{ 0x12000001, "NW-S763" },
|
||||
{ 0x12000002, "NW-S764" },
|
||||
{ 0x12000004, "NW-S765" },
|
||||
{ 0x12000005, "NW-S766" },
|
||||
{ 0x12000006, "NW-S767" },
|
||||
{ 0x12010001, "NWZ-S763" },
|
||||
{ 0x12010002, "NWZ-S764" },
|
||||
{ 0x12010004, "NWZ-S765" },
|
||||
{ 0x12010005, "NWZ-S766" },
|
||||
{ 0x12010006, "NWZ-S767" },
|
||||
{ 0x13000001, "NWZ-E463" },
|
||||
{ 0x13000002, "NWZ-E464" },
|
||||
{ 0x13000004, "NWZ-E465" },
|
||||
{ 0x14000000, "NW-E062" },
|
||||
{ 0x14000001, "NW-E063" },
|
||||
{ 0x14000002, "NW-E064" },
|
||||
{ 0x14000004, "NW-E065" },
|
||||
{ 0x14000005, "NW-E066" },
|
||||
{ 0x15000001, "NWZ-E473" },
|
||||
{ 0x15000002, "NWZ-E474" },
|
||||
{ 0x15000004, "NWZ-E475" },
|
||||
{ 0x15000005, "NWZ-E476" },
|
||||
{ 0x15010001, "NWZ-E573" },
|
||||
{ 0x15010002, "NWZ-E574" },
|
||||
{ 0x15010004, "NWZ-E575" },
|
||||
{ 0x15010005, "NWZ-E576" },
|
||||
{ 0x16000001, "NW-S773" },
|
||||
{ 0x16000002, "NW-S774" },
|
||||
{ 0x16000004, "NW-S775" },
|
||||
{ 0x16000005, "NW-S776" },
|
||||
{ 0x16010001, "NWZ-S773" },
|
||||
{ 0x16010002, "NWZ-S774" },
|
||||
{ 0x16010004, "NWZ-S775" },
|
||||
{ 0x16010005, "NWZ-S776" },
|
||||
{ 0x19000001, "NW-S783" },
|
||||
{ 0x19000002, "NW-S784" },
|
||||
{ 0x19000004, "NW-S785" },
|
||||
{ 0x19000005, "NW-S786" },
|
||||
{ 0x19010001, "NW-E083" },
|
||||
{ 0x19010002, "NW-E084" },
|
||||
{ 0x19010004, "NW-E085" },
|
||||
{ 0x19010005, "NW-E086" },
|
||||
{ 0x19020001, "NWZ-E583" },
|
||||
{ 0x19020002, "NWZ-E584" },
|
||||
{ 0x19020004, "NWZ-E585" },
|
||||
{ 0x19020005, "NWZ-E586" },
|
||||
{ 0x1a000001, "NW-A13" },
|
||||
{ 0x1a000002, "NW-A14" },
|
||||
{ 0x1a000004, "NW-A15" },
|
||||
{ 0x1a000005, "NW-A16" },
|
||||
{ 0x1a000006, "NW-A17" },
|
||||
{ 0x1a010001, "NWZ-A13" },
|
||||
{ 0x1a010002, "NWZ-A14" },
|
||||
{ 0x1a010004, "NWZ-A15" },
|
||||
{ 0x1a010005, "NWZ-A16" },
|
||||
{ 0x1a010006, "NWZ-A17" },
|
||||
{ 0, NULL },
|
||||
};
|
|
@ -24,8 +24,24 @@
|
|||
int NWZ_TOOL_MAIN(test_display)(int argc, char **argv)
|
||||
{
|
||||
/* clear screen and display welcome message */
|
||||
nwz_lcdmsg(true, 0, 0, "test_display");
|
||||
nwz_lcdmsg(false, 0, 1, "BACK: quit");
|
||||
nwz_display_clear(NWZ_COLOR(128, 128, 0));
|
||||
nwz_display_text(0, 0, true, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 0,
|
||||
"Hello");
|
||||
nwz_display_text(0, 30, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 128,
|
||||
"BACK: quit");
|
||||
nwz_display_text(0, 50, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 255), 255,
|
||||
"BACK: quit");
|
||||
/* display /contents/display.bmp if any */
|
||||
const char *bmp_fname = "/contents/display.bmp";
|
||||
if(access(bmp_fname, R_OK) != -1)
|
||||
{
|
||||
nwz_display_bitmap(10, 70, bmp_fname, 0, 0, 200, 200, NWZ_COLOR_NO_KEY, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
nwz_display_text(0, 70, false, NWZ_COLOR(255, 0, 0), NWZ_COLOR(0, 0, 0), 0,
|
||||
"Cannot find display.bmp");
|
||||
}
|
||||
/* wait for key */
|
||||
int input_fd = nwz_key_open();
|
||||
if(input_fd < 0)
|
||||
|
|
Loading…
Reference in a new issue