From b434b400e89f38475cfecb2cbffb4bf7f2b8ebfb Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Thu, 28 Jan 2016 18:22:47 -0500 Subject: [PATCH] Read currently installed USB serial drivers and skip reinstallation --- deploy/qgroundcontrol_installer.nsi | 30 ++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index 7bc1fee83..3ddfbe9c3 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -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 -- 2.22.0