Skip to content

Commit

Permalink
fixed: eventghost installation. include the latest firmware
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Jun 30, 2020
1 parent 9237487 commit b8bf25b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 53 deletions.
28 changes: 0 additions & 28 deletions project/nsis/functions.nsh
Expand Up @@ -12,31 +12,3 @@
!undef _TEMPFILE
!macroend
!define !defineifexist "!insertmacro !defineifexist"

; Function used to get the parent directory of the installer
Function GetParentDirectory

Exch $R0
Push $R1
Push $R2
Push $R3

StrCpy $R1 0
StrLen $R2 $R0

loop:
IntOp $R1 $R1 + 1
IntCmp $R1 $R2 get 0 get
StrCpy $R3 $R0 1 -$R1
StrCmp $R3 "\" get
Goto loop

get:
StrCpy $R0 $R0 -$R1

Pop $R3
Pop $R2
Pop $R1
Exch $R0

FunctionEnd
24 changes: 16 additions & 8 deletions project/nsis/sections.nsh
Expand Up @@ -234,18 +234,26 @@ Section "" SecEvGhostCec
SetShellVarContext current
SectionIn 1

SetOutPath "$INSTDIR\EventGhost"
File "..\build\EventGhost\pulse_eight.egplugin"

${If} $EventGhostLocation != ""
; We get the directory of the installer then pass it to GetParentDirectory
; which we then append the path to the plugin file to the returned value
; This is done because EventGhost needs to see the full path to the plugin
; file.
Push $EXEDIR
Call GetParentDirectory
Pop $R0
ExecWait '"$EventGhostLocation\eventghost.exe" $R0\src\EventGhost\pulse_eight.egplugin'
ExecWait '"$EventGhostLocation\eventghost.exe" "$INSTDIR\EventGhost\pulse_eight.egplugin"'
${EndIf}
SectionEnd

Section "Adapter Firmware v12" SecFwUpgrade
SetShellVarContext current
SectionIn 1

SetOutPath "$INSTDIR"
NSISdl::download https://github.com/Pulse-Eight/libcec/releases/download/libcec-5.0.0/cec-firmware-v12.exe cec-firmware-latest.exe

CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Firmware Upgrade.lnk" "$INSTDIR\cec-firmware-latest.exe" \
"" "$INSTDIR\cec-firmware-latest.exe" 0 SW_SHOWNORMAL \
"" "Upgrade the firmware of the CEC adapter to the latest version."
SectionEnd

!ifdef NSISINCLUDEPDB
!include "nsis\libcec-pdb.nsh"
!endif
Expand Down
26 changes: 9 additions & 17 deletions windows/create-installer.cmd
Expand Up @@ -48,23 +48,6 @@ IF %errorlevel% neq 0 (
GOTO EXIT
)

:CREATEEGPLUGIN
ECHO. * creating EventGhost plugin
SET EGSOURCES=%MYDIR%..\src\eventghost\egplugin_sources\
COPY "%MYDIR%..\build\x86\python\cec\__init__.py" "%EGSOURCES%PulseEight\cec" >nul
COPY "%MYDIR%..\build\x86\python\cec\_cec.pyd" "%EGSOURCES%PulseEight" >nul
COPY "%MYDIR%..\build\x86\cec.dll" "%EGSOURCES%PulseEight" >nul
DEL /q /f "%EGSOURCES%..\pulse_eight.egplugin" >nul 2>&1
PowerShell -ExecutionPolicy ByPass -Command "Add-Type -Assembly System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::CreateFromDirectory('%EGSOURCES%', '%EGSOURCES%..\pulse_eight.egplugin', [System.IO.Compression.CompressionLevel]::Optimal, $false)"
DEL /q /f "%EGSOURCES%PulseEight\cec\__init__.py" >nul 2>&1
DEL /q /f "%EGSOURCES%PulseEight\_cec.pyd" >nul 2>&1
DEL /q /f "%EGSOURCES%PulseEight\cec.dll" >nul 2>&1
IF NOT EXIST "%EGSOURCES%..\pulse_eight.egplugin" (
ECHO. *** failed to create EventGhost plugin ***
SET EXITCODE=1
GOTO EXIT
)

:SIGNBINARIES
rem Check for sign-binary.cmd, only present on the Pulse-Eight production build system
rem Calls signtool.exe and signs the DLLs with Pulse-Eight's code signing key
Expand All @@ -89,6 +72,15 @@ CALL ..\support\private\sign-binary.cmd "%MYDIR%..\build\amd64\netcore\CecSharpC
CALL ..\support\private\sign-binary.cmd "%MYDIR%..\build\amd64\cec-client.exe" >nul
CALL ..\support\private\sign-binary.cmd "%MYDIR%..\build\amd64\cecc-client.exe" >nul

:CREATEEGPLUGIN
call "%MYDIR%eventghost.cmd"

IF %errorlevel% neq 0 (
ECHO. *** failed to create EventGhost plugin ***
SET EXITCODE=1
GOTO EXIT
)

:CREATEINSTALLER
rem Copy prebuilt driver
COPY "%MYDIR%..\support\windows\p8-usbcec-driver-installer.exe" "%MYDIR%..\build\." >nul
Expand Down
30 changes: 30 additions & 0 deletions windows/eventghost.cmd
@@ -0,0 +1,30 @@
@ECHO OFF

SETLOCAL

SET MYDIR=%~dp0
SET EXITCODE=0

ECHO. * creating EventGhost plugin
SET EGSOURCES=%MYDIR%..\build\EventGhost\egplugin_sources
RMDIR /s /q "%MYDIR%..\build\EventGhost" >nul 2>&1
MKDIR "%MYDIR%..\build\EventGhost"

XCOPY /E /I "%MYDIR%..\src\eventghost\egplugin_sources" "%EGSOURCES%" >nul

COPY "%MYDIR%..\build\x86\python\cec\_cec.pyd" "%EGSOURCES%\PulseEight" >nul
COPY "%MYDIR%..\build\x86\cec.dll" "%EGSOURCES%\PulseEight" >nul

COPY "%MYDIR%..\build\x86\python\cec\__init__.py" "%EGSOURCES%\PulseEight\cec" >nul

PowerShell -ExecutionPolicy ByPass -Command "Add-Type -Assembly System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::CreateFromDirectory('%EGSOURCES%\', '%EGSOURCES%\..\pulse_eight.egplugin', [System.IO.Compression.CompressionLevel]::Optimal, $false)"

DEL /q /f "%EGSOURCES%" >nul 2>&1

IF NOT EXIST "%EGSOURCES%\..\pulse_eight.egplugin" (
ECHO. *** failed to create EventGhost plugin ***
SET EXITCODE=1
GOTO EXIT
)

exit /b %EXITCODE%

0 comments on commit b8bf25b

Please sign in to comment.