diff --git a/README.md b/README.md index 9059008f..b2b463af 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ► [flash.comma.ai](https://flash.comma.ai) -This tool allows you to flash AGNOS onto your comma device. Uses a fork of [fastboot.js](https://github.com/kdrag0n/fastboot.js). +This tool allows you to flash AGNOS onto your comma device. ## Development diff --git a/bun.lockb b/bun.lockb index f6df6cac..4792ed3e 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 9c54987e..edbd78d1 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,11 @@ "node": ">=20.11.0" }, "dependencies": { + "@commaai/qdl": "git+https://github.com/commaai/qdl.js.git", "@fontsource-variable/inter": "^5.0.18", "@fontsource-variable/jetbrains-mono": "^5.0.21", - "android-fastboot": "github:commaai/fastboot.js#c3ec6fe3c96a48dab46e23d0c8c861af15b2144a", "comlink": "^4.4.1", + "crc-32": "^1.2.2", "jssha": "^3.3.1", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/src/QDL/programmer.bin b/src/QDL/sdm845_fhprg.bin similarity index 65% rename from src/QDL/programmer.bin rename to src/QDL/sdm845_fhprg.bin index d10d768a..c5b73bb8 100644 Binary files a/src/QDL/programmer.bin and b/src/QDL/sdm845_fhprg.bin differ diff --git a/src/app/Flash.jsx b/src/app/Flash.jsx index d81f823e..dd69470d 100644 --- a/src/app/Flash.jsx +++ b/src/app/Flash.jsx @@ -1,6 +1,6 @@ -import { useCallback } from 'react' +import { useCallback, useState } from 'react' -import { Step, Error, useFastboot } from '../utils/fastboot' +import { Step, Error, useQdl } from '../utils/flash' import bolt from '../assets/bolt.svg' import cable from '../assets/cable.svg' @@ -57,8 +57,9 @@ const steps = { }, [Step.DONE]: { status: 'Done', - description: 'Your device has been updated successfully. You can now unplug the USB cable from your computer. To ' + - 'complete the system reset, follow the instructions on your device.', + description: 'Your device has been updated successfully. You can now unplug the all cables from your device, ' + +'and wait for the light to stop blinking then plug the power cord in again. ' + +' To complete the system reset, follow the instructions on your device.', bgColor: 'bg-green-500', icon: done, }, @@ -67,7 +68,8 @@ const steps = { const errors = { [Error.UNKNOWN]: { status: 'Unknown error', - description: 'An unknown error has occurred. Restart your browser and try again.', + description: 'An unknown error has occurred. Unplug your device and wait for 20s. ' + + 'Restart your browser and try again.', bgColor: 'bg-red-500', icon: exclamation, }, @@ -79,12 +81,14 @@ const errors = { }, [Error.LOST_CONNECTION]: { status: 'Lost connection', - description: 'The connection to your device was lost. Check that your cables are connected properly and try again.', + description: 'The connection to your device was lost. Check that your cables are connected properly and try again. ' + + 'Unplug your device and wait for around 20s.', icon: cable, }, [Error.DOWNLOAD_FAILED]: { status: 'Download failed', - description: 'The system image could not be downloaded. Check your internet connection and try again.', + description:'The system image could not be downloaded. Unplug your device and wait for 20s. ' + + 'Check your internet connection and try again.', icon: cloudError, }, [Error.CHECKSUM_MISMATCH]: { @@ -111,6 +115,11 @@ const errors = { }, } +const detachScript = [ + "for d in /sys/bus/usb/drivers/qcserial/*-*; do [ -e \"$d\" ] && echo -n \"$(basename $d)\" | sudo tee /sys/bus/usb/drivers/qcserial/unbind > /dev/null; done" +]; + +const isLinux = navigator.userAgent.toLowerCase().includes('linux'); function LinearProgress({ value, barColor }) { if (value === -1 || value > 100) value = 100 @@ -187,7 +196,7 @@ export default function Flash() { connected, serial, - } = useFastboot() + } = useQdl() const handleContinue = useCallback(() => { onContinue?.() @@ -220,6 +229,15 @@ export default function Flash() { window.removeEventListener("beforeunload", beforeUnloadListener, { capture: true }) } + const [copied, setCopied] = useState(false); + const handleCopy = () => { + setCopied(true); + setTimeout(() => { + setCopied(false); + }, 1000); + }; + + return (
{title} {description} + {(title === "Lost connection" || title === "Ready") && isLinux && ( + <> + + It seems that you're on Linux, make sure to run the script below in your terminal after plugging in your device. + +
+
+
+
+                  {detachScript.map((line, index) => (
+                    
+                      {line}
+                    
+                  ))}
+                
+
+ +
+
+
+
+ + )} {error && (