From b98b9c5435a9ce15276788f4d748001fbad2cf1c Mon Sep 17 00:00:00 2001 From: AmbiguousX <126121852+AmbiguousX@users.noreply.github.com> Date: Mon, 5 May 2025 16:55:26 -0700 Subject: [PATCH 1/3] Replace React implementation with iframe solution --- src/app/App.test.jsx | 6 +- src/app/index.jsx | 175 +++---------------------------------------- 2 files changed, 15 insertions(+), 166 deletions(-) diff --git a/src/app/App.test.jsx b/src/app/App.test.jsx index 206de720..de16c7d8 100644 --- a/src/app/App.test.jsx +++ b/src/app/App.test.jsx @@ -1,10 +1,10 @@ -import { Suspense } from 'react' import { expect, test } from 'vitest' import { render, screen } from '@testing-library/react' import App from '.' test('renders without crashing', () => { - render() - expect(screen.getByText('flash.comma.ai')).toBeInTheDocument() + render() + // Check for the iframe with the correct source + expect(screen.getByTitle('flash.comma.ai')).toHaveAttribute('src', 'https://flash-4fy.pages.dev/') }) diff --git a/src/app/index.jsx b/src/app/index.jsx index 9be48f10..db7cfd26 100644 --- a/src/app/index.jsx +++ b/src/app/index.jsx @@ -1,172 +1,21 @@ -import { Suspense, lazy } from 'react' - -import comma from '../assets/comma.svg' -import qdlPorts from '../assets/qdl-ports.svg' -import zadigCreateNewDevice from '../assets/zadig_create_new_device.png' -import zadigForm from '../assets/zadig_form.png' - -import { isLinux, isWindows } from '../utils/platform' - -const Flash = lazy(() => import('./Flash')) - -const VENDOR_ID = '05C6' -const PRODUCT_ID = '9008' -const DETACH_SCRIPT = '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'; - -function CopyText({ children: text }) { - return
-
{text}
- -
; -} +import React from 'react' export default function App() { const version = import.meta.env.VITE_PUBLIC_GIT_SHA || 'dev' console.info(`flash.comma.ai version: ${version}`) - return ( -
-
-
- comma -

flash.comma.ai

-

- This tool allows you to flash AGNOS onto your comma device. AGNOS is the Ubuntu-based operating system for - your comma 3/3X. -

-
-
-
-

Requirements

-
    -
  • - A web browser which supports WebUSB - {" "}(such as Google Chrome, Microsoft Edge, Opera), running on Windows, macOS, Linux, or Android. -
  • -
  • - A good quality USB-C cable to connect the device to your computer. USB 3 - {" "}is recommended for faster flashing speed. -
  • -
  • - Another USB-C cable and a charger, to power the device outside your car. -
  • -
- {isWindows && (<> -

USB Driver

-

You need additional driver software for Windows before you connect your device.

-
    -
  1. - Download and run Zadig. -
  2. -
  3. - Under Device in the menu bar, select Create New Device. - Zadig Create New Device -
  4. -
  5. - Fill in three fields. The first field is just a description and you can fill in anything. The next two - fields are very important. Fill them in with {VENDOR_ID} and {PRODUCT_ID} - respectively. Press "Install Driver" and give it a few minutes to install. - Zadig Form -
  6. -
-

No additional software is required for macOS, Linux or Android.

- )} -
-
- -
-

Flashing

-

Follow these steps to put your device into QDL mode:

-
    -
  1. Unplug the device and wait for the LED to switch off.
  2. -
  3. First, connect the device to your computer using the lower USB-C port (port 1).
  4. -
  5. Second, connect power to the upper OBD-C port (port 2).
  6. -
- image showing comma three and two ports. the lower port is labeled 1. the upper port is labeled 2. -

Your device's screen will remain blank for the entire flashing process. This is normal.

- {isLinux && (<> - Note for Linux users -

- On Linux systems, devices in QDL mode are automatically bound to the kernel's qcserial driver, and - need to be unbound before we can access the device. Copy the script below into your terminal and run it - after plugging in your device. -

- {DETACH_SCRIPT} - )} -

- Next, click the button to start flashing. From the prompt select the device which starts with - “QUSB_BULK”. -

-

- The process can take 30+ minutes depending on your internet connection and system performance. Do not - unplug the device until all steps are complete. -

-
-
- -
-

Troubleshooting

-

Lost connection

-

- Try using high quality USB 3 cables. You should also try different USB ports on the front or back of your - computer. If you're using a USB hub, try connecting directly to your computer instead. -

-

My device's screen is blank

-

- This is normal in QDL mode. You can verify that the “QUSB_BULK” device shows up when you press - the Flash button to know that it is working correctly. -

-

My device says “fastboot mode”

-

- You may have followed outdated instructions for flashing. Please read the instructions above for putting - your device into QDL mode. -

-

General Tips

-
    -
  • Try another computer or OS
  • -
  • Try different USB ports on your computer
  • -
  • Try different USB-C cables; low quality cables are often the source of problems. Note that the included OBD-C cable will not work.
  • -
-

Other questions

-

- If you need help, join our Discord server and go to - the #hw-three-3x channel. -

-
- -
-
- flash.comma.ai version: {version} -
-
- -
- Loading...

}> - -
+ return ( +
+
+