diff --git a/.gitignore b/.gitignore index 08c27c0..9e04545 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,7 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +/edl/ +/qdl.js/ +/provisioning/ diff --git a/bun.lock b/bun.lock index d76cbb6..55714d5 100644 --- a/bun.lock +++ b/bun.lock @@ -5,7 +5,7 @@ "": { "name": "@commaai/flash", "dependencies": { - "@commaai/qdl": "git+https://github.com/commaai/qdl.js.git#21d7be79fa5178f253d32a0879bd8bdd4fa37e30", + "@commaai/qdl": "git+https://github.com/commaai/qdl.js.git#7177fde779bc6764727130969af1841d71a4c43c", "@fontsource-variable/inter": "^5.2.5", "@fontsource-variable/jetbrains-mono": "^5.2.5", "react": "^18.3.1", @@ -81,7 +81,7 @@ "@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], - "@commaai/qdl": ["@commaai/qdl@github:commaai/qdl.js#21d7be7", { "dependencies": { "@incognitojam/tiny-struct": "npm:@jsr/incognitojam__tiny-struct@^0.1.2", "arg": "^5.0.2", "crc-32": "^1.2.2", "fast-xml-parser": "^5.0.8", "usb": "^2.15.0" }, "peerDependencies": { "typescript": "^5.7.3" }, "bin": { "simg2img.js": "dist/bin/simg2img.js", "qdl.js": "dist/bin/qdl.js" } }, "commaai-qdl.js-21d7be7"], + "@commaai/qdl": ["@commaai/qdl@github:commaai/qdl.js#7177fde", { "dependencies": { "@incognitojam/tiny-struct": "npm:@jsr/incognitojam__tiny-struct@^0.1.2", "arg": "^5.0.2", "crc-32": "^1.2.2", "fast-xml-parser": "^5.0.8", "usb": "^2.15.0" }, "peerDependencies": { "typescript": "^5.7.3" }, "bin": { "simg2img.js": "dist/bin/simg2img.js", "qdl.js": "dist/bin/qdl.js" } }, "commaai-qdl.js-7177fde"], "@csstools/color-helpers": ["@csstools/color-helpers@5.1.0", "", {}, "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA=="], diff --git a/deploy-preview.sh b/deploy-preview.sh index fc035f6..9716b66 100755 --- a/deploy-preview.sh +++ b/deploy-preview.sh @@ -3,6 +3,7 @@ set -e BRANCH="${1:-$(git branch --show-current)}" +bun install bun run build bunx wrangler pages deploy dist --project-name=connect --branch="$BRANCH" diff --git a/package.json b/package.json index 73aed3a..adaa696 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "node": ">=20.11.0" }, "dependencies": { - "@commaai/qdl": "git+https://github.com/commaai/qdl.js.git#21d7be79fa5178f253d32a0879bd8bdd4fa37e30", + "@commaai/qdl": "git+https://github.com/commaai/qdl.js.git#7177fde779bc6764727130969af1841d71a4c43c", "@fontsource-variable/inter": "^5.2.5", "@fontsource-variable/jetbrains-mono": "^5.2.5", "react": "^18.3.1", diff --git a/src/app/Flash.jsx b/src/app/Flash.jsx index 0732474..fa836b1 100644 --- a/src/app/Flash.jsx +++ b/src/app/Flash.jsx @@ -1,6 +1,6 @@ import { useEffect, useRef, useState } from 'react' -import { FlashManager, StepCode, ErrorCode, DeviceType } from '../utils/manager' +import { FlashManager, StepCode, ErrorCode, DeviceType, DUMP_GPT_MODE } from '../utils/manager' import { useImageManager } from '../utils/image' import { isLinux, isWindows } from '../utils/platform' import config from '../config' @@ -517,6 +517,91 @@ function LinuxUnbind({ onNext }) { ) } +// GPT Dump diagnostic mode +function GptDumpMode({ qdlManager, imageManager }) { + const [gptDump, setGptDump] = useState(null) + const [loading, setLoading] = useState(false) + const [copied, setCopied] = useState(false) + const [ready, setReady] = useState(false) + + useEffect(() => { + if (!imageManager.current) return + fetch(config.loader.url) + .then((res) => res.arrayBuffer()) + .then((programmer) => { + qdlManager.current = new FlashManager(programmer, {}) + qdlManager.current.initialize(imageManager.current).then(() => setReady(true)) + }) + }, [imageManager.current]) + + const handleDump = async () => { + setLoading(true) + const result = await qdlManager.current.dumpGpt() + setGptDump(result) + setLoading(false) + } + + const handleCopy = () => { + navigator.clipboard.writeText(gptDump) + setCopied(true) + setTimeout(() => setCopied(false), 2000) + } + + return ( +
+
+

GPT Diagnostic Mode

+

+ Connect your device to dump partition table info +

+
+ + {!gptDump ? ( + + ) : ( + <> +