Commit b434b400 authored by Nate Weibley's avatar Nate Weibley

Read currently installed USB serial drivers and skip reinstallation

parent 9ff40d6a
......@@ -18,7 +18,35 @@ Section
WriteUninstaller $INSTDIR\QGroundControl_uninstall.exe
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QGroundControl" "DisplayName" "QGroundControl"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QGroundControl" "UninstallString" "$\"$INSTDIR\QGroundControl_uninstall.exe$\""
; Only attempt to install the PX4 driver if the version isn't present
!define ROOTKEY "SYSTEM\CurrentControlSet\Control\Class\{4D36E978-E325-11CE-BFC1-08002BE10318}"
StrCpy $0 0
loop:
EnumRegKey $1 HKLM ${ROOTKEY} $0
StrCmp $1 "" notfound cont1
cont1:
StrCpy $2 "${ROOTKEY}\$1"
ReadRegStr $3 HKLM $2 "ProviderName"
StrCmp $3 "3D Robotics" found_provider
mismatch:
IntOp $0 $0 + 1
goto loop
found_provider:
ReadRegStr $3 HKLM $2 "DriverVersion"
StrCmp $3 "2.0.0.4" skip_driver
goto mismatch
notfound:
DetailPrint "USB Driver not found... installing"
ExecWait '"msiexec" /i "px4driver.msi"'
goto done
skip_driver:
DetailPrint "USB Driver found... skipping install"
done:
SectionEnd
Section "Uninstall"
......@@ -43,4 +71,4 @@ Function .onInit
"QGroundControl is already installed. $\n$\nYou must uninstall the previous version before installing a new one."
Abort
done:
FunctionEnd
\ No newline at end of file
FunctionEnd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment