1- import { useCallback , useState } from 'react'
1+ import { useCallback } from 'react'
22
33import { Step , Error , useQdl } from '../utils/flash'
4- import { isLinux } from '../utils/platform'
54
65import bolt from '../assets/bolt.svg'
76import cable from '../assets/cable.svg'
@@ -116,8 +115,6 @@ const errors = {
116115 } ,
117116}
118117
119- 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" ;
120-
121118function LinearProgress ( { value, barColor } ) {
122119 if ( value === - 1 || value > 100 ) value = 100
123120 return (
@@ -226,14 +223,6 @@ export default function Flash() {
226223 window . removeEventListener ( "beforeunload" , beforeUnloadListener , { capture : true } )
227224 }
228225
229- const [ copied , setCopied ] = useState ( false ) ;
230- const handleCopy = ( ) => {
231- setCopied ( true ) ;
232- setTimeout ( ( ) => {
233- setCopied ( false ) ;
234- } , 1000 ) ;
235- } ;
236-
237226 return (
238227 < div id = "flash" className = "relative flex flex-col gap-8 justify-center items-center h-full" >
239228 < div
@@ -254,34 +243,6 @@ export default function Flash() {
254243 </ div >
255244 < span className = "text-3xl dark:text-white font-mono font-light" > { title } </ span >
256245 < span className = "text-xl dark:text-white px-8 max-w-xl" > { description } </ span >
257- { ( title === "Ready" || title === "Lost connection" ) && isLinux && (
258- < >
259- < span className = "text-l dark:text-white px-2 max-w-xl" >
260- 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.
261- Run the script below in your terminal after plugging in your device.
262- </ span >
263- < div className = "relative mt-2 max-w-3xl" >
264- < div className = "bg-gray-200 dark:bg-gray-800 rounded-md overflow-x-auto" >
265- < div className = "relative" >
266- < pre className = "font-mono text-sm text-gray-800 dark:text-gray-200 bg-gray-300 dark:bg-gray-700 rounded-md p-6 flex-grow max-w-m text-wrap" >
267- { DETACH_SCRIPT }
268- </ pre >
269- < div className = "absolute top-2 right-2" >
270- < button
271- onClick = { ( ) => {
272- void navigator . clipboard . writeText ( DETACH_SCRIPT ) ;
273- handleCopy ( ) ;
274- } }
275- className = { `bg-${ copied ? 'green' : 'blue' } -500 text-white px-1 py-1 rounded-md ml-2 text-sm` }
276- >
277- Copy
278- </ button >
279- </ div >
280- </ div >
281- </ div >
282- </ div >
283- </ >
284- ) }
285246 { error && (
286247 < button
287248 className = "px-4 py-2 rounded-md bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-800 dark:text-gray-200 transition-colors"
0 commit comments