Back to index

lshw  02.16
jedec.cc
Go to the documentation of this file.
00001 #include "jedec.h"
00002 #include "hw.h"
00003 #include "osutils.h"
00004 #include <regex.h>
00005 #include <string>
00006 #include <iostream>
00007 
00008 using namespace std;
00009 
00010 static const char * jedec_id[] = {
00011        "01",  "AMD",
00012        "8001",       "AMD",
00013        "02",  "AMI",
00014        "8002",       "AMI",
00015        "04",  "Fujitsu",
00016        "8004",       "Fujitsu",
00017        "0500",       "Elpida",
00018        "07",  "Hitachi",
00019        "8007",       "Hitachi",
00020        "08",  "Inmos",
00021        "8008",       "Inmos",
00022        "0B",  "Intersil",
00023        "800B",       "Intersil",
00024        "0D",  "Mostek",
00025        "800D",       "Mostek",
00026        "0E",  "Freescale (Motorola)",
00027        "800E",       "Freescale (Motorola)",
00028        "10",  "NEC",
00029        "8010",       "NEC",
00030        "13",  "Conexant (Rockwell)",
00031        "8013",       "Conexant (Rockwell)",
00032        "15",  "NXP (Philips Semi, Signetics)",
00033        "8015",       "NXP (Philips Semi, Signetics)",
00034        "16",  "Synertek",
00035        "8016",       "Synertek",
00036        "19",  "Xicor",
00037        "8019",       "Xicor",
00038        "1A",  "Zilog",
00039        "801A",       "Zilog",
00040        "1C",  "Mitsubishi",
00041        "801C",       "Mitsubishi",
00042        "2C",  "Micron Technology",
00043        "802C",       "Micron Technology",
00044        "40",  "ProMOS/Mosel Vitelic",
00045        "8040",       "ProMOS/Mosel Vitelic",
00046        "6A",  "Goldenram",
00047        "806A",       "Goldenram",
00048        "7F7F7F0B",   "Nanya Technology",
00049        "830B",       "Nanya Technology",
00050        "83",  "Fairchild",
00051        "8083",       "Fairchild",
00052        "89",  "Numonyx (Intel)",
00053        "8089",       "Numonyx (Intel)",
00054        "91",  "DATARAM",
00055        "8091",       "DATARAM",
00056        "98",  "Toshiba",
00057        "8098",       "Toshiba",
00058        "A4",  "IBM",
00059        "80A4",       "IBM",
00060        "AD",  "Hynix Semiconductor (Hyundai Electronics)",
00061        "80AD",       "Hynix Semiconductor (Hyundai Electronics)",
00062        "C1",  "Infineon (Siemens)",
00063        "80C1",       "Infineon (Siemens)",
00064        "7F7F7F7F7F51",      "Infineon (Siemens)",
00065        "CE",  "Samsung",
00066        "80CE",       "Samsung",
00067        "DE",  "Winbond Electronics",
00068        "80DE",       "Winbond Electronics",
00069        "E0",  "LG Semiconductor (Goldstar)",
00070        "80E0",       "LG Semiconductor (Goldstar)",
00071        "7F45",       "Micron CMS",
00072        "7F98",       "Kingston",
00073        "7F7F7F7F43", "Ramaxel Technology",
00074        NULL,  NULL
00075 };
00076 
00077 string jedec_resolve(const string & s)
00078 {
00079   string result = hw::strip(s);
00080 
00081   if(matches(result, "^0x"))
00082     result.erase(0, 2);
00083   if(!matches(result, "^[0-9a-fA-F]+$")) return s;
00084 
00085   for(int i=0; jedec_id[i]; i+=2) {
00086     if(matches(result, "^" + string(jedec_id[i]), REG_ICASE)) return string(jedec_id[i+1]);
00087   }
00088 
00089   return s;
00090 }