Skip to content

Commit

Permalink
Toshiba: now Kioxia
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Oct 31, 2019
1 parent 90edd07 commit c194ae4
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions FlashDetector/resources/lang/chs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"intel": "英特尔",
"micron": "美光",
"samsung": "三星",
"sandisk": "闪迪",
"westerndigital": "西数",
"skhynix": "SK海力士",
"spectek": "美光白片",
"toshiba": "东芝",
"kioxia": "铠侠",
"nand": "NAND",
"inand": "iNAND",
"issd": "iSSD",
Expand Down
4 changes: 2 additions & 2 deletions FlashDetector/resources/lang/eng.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"intel": "Intel",
"micron": "Micron",
"samsung": "Samsung",
"sandisk": "SanDisk",
"westerndigital": "Western Digital",
"skhynix": "SKHynix",
"spectek": "SpecTek",
"toshiba": "Toshiba",
"kioxia": "Kioxia",
"nand": "NAND",
"inand": "iNAND",
"issd": "iSSD",
Expand Down
2 changes: 1 addition & 1 deletion FlashDetector/sf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FlashDetector",
"version": "0",
"version": "1",
"api": 6,
"description": "Universal NAND Flash Part Number Decoder",
"author": "iTX Technologies",
Expand Down
4 changes: 3 additions & 1 deletion FlashDetector/src/iTXTech/FlashDetector/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ interface Constants{
public const VENDOR_INTEL = "intel";
public const VENDOR_MICRON = "micron";
public const VENDOR_SAMSUNG = "samsung";
public const VENDOR_SANDISK = "sandisk";
public const VENDOR_WESTERN_DIGITAL = "westerndigital";
public const VENDOR_SKHYNIX = "skhynix";
public const VENDOR_SPECTEK = "spectek";
public const VENDOR_KIOXIA = "kioxia";
public const VENDOR_TOSHIBA = "toshiba";
public const VENDOR_SANDISK = "sandisk";

public const NAND_TYPE_NAND = "nand";
public const NAND_TYPE_INAND = "inand";
Expand Down
1 change: 1 addition & 0 deletions FlashDetector/src/iTXTech/FlashDetector/Decoder/Intel.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public static function decode(string $partNumber) : FlashInfo{
"M" => [2, 2, 2, true],
"N" => [4, 4, 4, true],
"O" => [8, 8, 4, true],
"P" => [8, 8, 8, true],//L74
"W" => [16, 8, 4, true]
], [-1, -1, -1, false]);
$flashInfo->setClassification(new Classification(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
namespace iTXTech\FlashDetector\Decoder;

use iTXTech\FlashDetector\Constants;
use iTXTech\FlashDetector\Fdb\PartNumber;
use iTXTech\FlashDetector\FlashDetector;
use iTXTech\FlashDetector\FlashInfo;
use iTXTech\FlashDetector\Property\Classification;
use iTXTech\FlashDetector\Property\FlashInterface;
use iTXTech\SimpleFramework\Util\StringUtil;

//TODO: rename to Kioxia
class Toshiba extends Decoder{
class Kioxia extends Decoder{
public static function getName() : string{
return Constants::VENDOR_TOSHIBA;
return Constants::VENDOR_KIOXIA;
}

public static function check(string $partNumber) : bool{
Expand Down Expand Up @@ -226,4 +227,9 @@ public static function decode(string $partNumber) : FlashInfo{

return $flashInfo;
}

public static function getFlashInfoFromFdb(FlashInfo $info) : ?PartNumber{
return FlashDetector::getFdb()->getPartNumber($info->getVendor(), $info->getPartNumber()) ??
FlashDetector::getFdb()->getPartNumber(Constants::VENDOR_TOSHIBA, $info->getPartNumber());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
use iTXTech\FlashDetector\Property\Classification;
use iTXTech\SimpleFramework\Util\StringUtil;

//TODO: rename to Western Digital
class SanDisk extends Decoder{
class WesternDigital extends Decoder{
public const CELL_LEVEL = [
"C" => 3,
"F" => 2,
Expand Down Expand Up @@ -57,7 +56,7 @@ class SanDisk extends Decoder{
];

public static function getName() : string{
return Constants::VENDOR_SANDISK;
return Constants::VENDOR_WESTERN_DIGITAL;
}

public static function check(string $partNumber) : bool{
Expand Down Expand Up @@ -138,7 +137,8 @@ public static function decode(string $partNumber) : FlashInfo{
}

public static function getFlashInfoFromFdb(FlashInfo $info) : ?PartNumber{
$data = FlashDetector::getFdb()->getPartNumber(self::getName(), $info->getPartNumber());
$data = FlashDetector::getFdb()->getPartNumber(self::getName(), $info->getPartNumber()) ??
FlashDetector::getFdb()->getPartNumber(Constants::VENDOR_SANDISK, $info->getPartNumber());
if($data != null){
$comment = "";
$parts = explode("/", $data->getComment() ?? "");
Expand All @@ -149,7 +149,7 @@ public static function getFlashInfoFromFdb(FlashInfo $info) : ?PartNumber{
}elseif($part == "CODE"){
$extraInfo[Constants::SANDISK_CODE] = true;
}elseif($part{0} == "T"){
$extraInfo[Constants::VENDOR_TOSHIBA] = substr($part, 1);
$extraInfo[Constants::VENDOR_KIOXIA] = substr($part, 1);
}else{
$comment .= $part . "/";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
use iTXTech\FlashDetector\Constants;
use iTXTech\FlashDetector\FlashInfo;

class SanDiskShortCode extends SanDisk{

class WesternDigitalShortCode extends WesternDigital{
public static function check(string $partNumber) : bool{
//example: 05055-032G
if(strlen($partNumber) == 10){
Expand All @@ -36,14 +35,10 @@ public static function check(string $partNumber) : bool{
return false;
}

public static function getName() : string{
return Constants::VENDOR_SANDISK;
}

public static function decode(string $partNumber) : FlashInfo{
$flashInfo = (new FlashInfo($partNumber))->setVendor(self::getName())
->setDensity(self::matchFromStart(explode("-", $partNumber, 2)[1],
SanDisk::DENSITY, 0));
WesternDigital::DENSITY, 0));
return $flashInfo;
}
}
12 changes: 6 additions & 6 deletions FlashDetector/src/iTXTech/FlashDetector/FlashDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
use iTXTech\FlashDetector\Decoder\Micron;
use iTXTech\FlashDetector\Decoder\MicronFbgaCode;
use iTXTech\FlashDetector\Decoder\Samsung;
use iTXTech\FlashDetector\Decoder\SanDisk;
use iTXTech\FlashDetector\Decoder\SanDiskShortCode;
use iTXTech\FlashDetector\Decoder\WesternDigital;
use iTXTech\FlashDetector\Decoder\WesternDigitalShortCode;
use iTXTech\FlashDetector\Decoder\SKHynix;
use iTXTech\FlashDetector\Decoder\SKHynix3D;
use iTXTech\FlashDetector\Decoder\SKHynixLegacy;
use iTXTech\FlashDetector\Decoder\SpecTek;
use iTXTech\FlashDetector\Decoder\Toshiba;
use iTXTech\FlashDetector\Decoder\Kioxia;
use iTXTech\FlashDetector\Fdb\Fdb;
use iTXTech\FlashDetector\Property\Classification;
use iTXTech\SimpleFramework\Util\StringUtil;
Expand Down Expand Up @@ -101,13 +101,13 @@ public static function init(string $lang = "eng", string $fallbackLang = "eng"){
self::registerDecoder(SKHynix3D::class);
self::registerDecoder(SKHynix::class);
self::registerDecoder(SKHynixLegacy::class);
self::registerDecoder(Toshiba::class);
self::registerDecoder(Kioxia::class);
self::registerDecoder(Samsung::class);
self::registerDecoder(Intel::class);
self::registerDecoder(MicronFbgaCode::class);
self::registerDecoder(SpecTek::class);
self::registerDecoder(SanDisk::class);
self::registerDecoder(SanDiskShortCode::class);
self::registerDecoder(WesternDigital::class);
self::registerDecoder(WesternDigitalShortCode::class);
if(Loader::getInstance() !== null){
self::$lang = json_decode(Loader::getInstance()->getResourceAsText("lang/$lang.json"), true);
self::$fallbackLang = json_decode(Loader::getInstance()
Expand Down
3 changes: 0 additions & 3 deletions FlashDetector/src/iTXTech/FlashDetector/FlashInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ public function toArray(bool $raw = true) : array{
$info["interface"] = $interface;//hack!
}
$info["rawVendor"] = $this->vendor;
//backward compatibility
$info["manufacturer"] = $info["vendor"];
$info["rawManufacturer"] = $info["rawVendor"];
return $info;
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ composer install

1. `Intel`/`Micron (SpecTek)`
1. `Samsung`
1. `Western Digital (SanDisk)`/`Toshiba`
1. `Western Digital (SanDisk)`/`Kioxia (Toshiba)`
1. `SKHynix`

### Controllers
Expand Down

0 comments on commit c194ae4

Please sign in to comment.