From 3097239ce65c2eca659671c23dbacbefc398b9e7 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Fri, 28 Oct 2016 23:27:29 +0200 Subject: nwztools/plattools: add device list This list can map from model id to device name. It was automatically extracted from Sony's tools. In the future, we will probably generate it from a clean database containing more useful information. Change-Id: Ibe580edf25b60bf0bf4aef4a06f40dddd19c5404 --- utils/nwztools/plattools/Makefile | 2 +- utils/nwztools/plattools/nwz_lib.c | 10 ++ utils/nwztools/plattools/nwz_lib.h | 8 ++ utils/nwztools/plattools/nwz_lib_devlist.c | 192 +++++++++++++++++++++++++++++ 4 files changed, 211 insertions(+), 1 deletion(-) create mode 100644 utils/nwztools/plattools/nwz_lib_devlist.c (limited to 'utils/nwztools/plattools') diff --git a/utils/nwztools/plattools/Makefile b/utils/nwztools/plattools/Makefile index d3efdb74a3..31633294ee 100644 --- a/utils/nwztools/plattools/Makefile +++ b/utils/nwztools/plattools/Makefile @@ -4,7 +4,7 @@ LD=$(PREFIX)gcc CFLAGS=-std=gnu99 -Wall -O2 INCLUDES=-I. -LIB_FILES=nwz_lib.c +LIB_FILES=nwz_lib.c nwz_lib_devlist.c ALL_BUT_LIB=$(patsubst %.c,%.elf,$(filter-out $(LIB_FILES),$(wildcard *.c))) all: $(ALL_BUT_LIB) diff --git a/utils/nwztools/plattools/nwz_lib.c b/utils/nwztools/plattools/nwz_lib.c index 4ea1edee19..ebfe488a7d 100644 --- a/utils/nwztools/plattools/nwz_lib.c +++ b/utils/nwztools/plattools/nwz_lib.c @@ -20,6 +20,16 @@ ****************************************************************************/ #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; +} + void nwz_run(const char *file, const char *args[], bool wait) { pid_t child_pid = fork(); diff --git a/utils/nwztools/plattools/nwz_lib.h b/utils/nwztools/plattools/nwz_lib.h index 1dd7b4c85b..5e1640a70e 100644 --- a/utils/nwztools/plattools/nwz_lib.h +++ b/utils/nwztools/plattools/nwz_lib.h @@ -37,6 +37,14 @@ #include "nwz_ts.h" #include "nwz_power.h" +struct nwz_dev_info_t +{ + unsigned long model_id; + const char *name; +}; + +const char *nwz_get_model_name(unsigned long model_id); + /* run a program and exit with nonzero status in case of error * argument list must be NULL terminated */ void nwz_run(const char *file, const char *args[], bool wait); diff --git a/utils/nwztools/plattools/nwz_lib_devlist.c b/utils/nwztools/plattools/nwz_lib_devlist.c new file mode 100644 index 0000000000..1631a0cbc5 --- /dev/null +++ b/utils/nwztools/plattools/nwz_lib_devlist.c @@ -0,0 +1,192 @@ +/*************************************************************************** + * __________ __ ___. + * 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 }, +}; -- cgit v1.2.3