-
Notifications
You must be signed in to change notification settings - Fork 4
Windows updates to get vbcable working in latest windows runners #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sethvincent
wants to merge
1
commit into
LABSN:main
Choose a base branch
from
sethvincent:windows-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,73 @@ | ||
| # Someday if this breaks we can use: | ||
| # https://github.com/duncanthrax/scream/tree/master/Install | ||
| # But it signs using a SHA that is buggy with Windows 7 so don't use for now | ||
| # https://support.microsoft.com/en-us/help/2921916/the-untrusted-publisher-dialog-box-appears-when-you-install-a-driver-i | ||
| function DownloadVirtualSoundcard () { | ||
| $webclient = New-Object System.Net.WebClient | ||
| $url = "https://download.vb-audio.com/Download_CABLE/VBCABLE_Driver_Pack43.zip" | ||
| $filepath = $pwd.Path + "\vbcable.zip" | ||
| Write-Host "Downloading" $url | ||
| $retry_attempts = 2 | ||
| for($i=0; $i -lt $retry_attempts; $i++){ | ||
| try { | ||
| $webclient.DownloadFile($url, $filepath) | ||
| break | ||
| } | ||
| Catch [Exception]{ | ||
| Start-Sleep 1 | ||
| } | ||
| param ( | ||
| [string]$Url = 'https://download.vb-audio.com/Download_CABLE/VBCABLE_Driver_Pack45.zip', | ||
| [string]$ZipName = 'vbcable.zip', | ||
| [string]$ExtractDir = 'vbcable' | ||
| ) | ||
|
|
||
| function Download-Zip { | ||
| param($Url, $Out) | ||
| Write-Host "Downloading $Url → $Out" | ||
| $wc = New-Object System.Net.WebClient | ||
| 0..2 | ForEach-Object { | ||
| try { $wc.DownloadFile($Url, $Out); return } catch { Start-Sleep 1 } | ||
| } | ||
| $wc.DownloadFile($Url, $Out) | ||
| } | ||
|
|
||
| function Expand-Zip { | ||
| param($Zip, $Dest) | ||
| Write-Host "Extracting $Zip → $Dest" | ||
| Expand-Archive -LiteralPath $Zip -DestinationPath $Dest -Force | ||
| } | ||
|
|
||
| function Trust-Cert { | ||
| param($Cer) | ||
| Write-Host "Adding certificate to TrustedPublisher: $Cer" | ||
| certutil -addstore -f TrustedPublisher $Cer | ||
| } | ||
|
|
||
| function Install-Driver { | ||
| param($InfDir) | ||
| Write-Host "Installing driver(s) from $InfDir" | ||
| Get-ChildItem -Path $InfDir -Filter 'vbMmeCable64_win*.inf' -Recurse | | ||
| ForEach-Object { | ||
| $inf = $_.FullName | ||
| Write-Host " devcon.exe install `"$inf`" VBAudioVACWDM" | ||
| & "$PSScriptRoot\devcon.exe" install "$inf" VBAudioVACWDM | ||
| } | ||
| if (Test-Path $filepath) { | ||
| Write-Host "File saved at" $filepath | ||
| } else { | ||
| # Retry once to get the error message if any at the last try | ||
| $webclient.DownloadFile($url, $filepath) | ||
| } | ||
|
|
||
| function Restart-AudioServices { | ||
| Write-Host "Restarting Audio services to pick up new device" | ||
| foreach ($svc in 'AudioSrv','AudioEndpointBuilder') { | ||
| if (Get-Service $svc -ErrorAction SilentlyContinue) { | ||
| Restart-Service -Name $svc -Force | ||
| } | ||
| } | ||
| } | ||
|
|
||
| function main () { | ||
| Push-Location $PSScriptRoot | ||
| DownloadVirtualSoundcard | ||
| Expand-Archive -LiteralPath vbcable.zip -DestinationPath vbcable | ||
| certutil -addstore "TrustedPublisher" vbcable.cer | ||
| # PnPutil.exe -i -a vbcable/vbMmeCable64_win7.inf | ||
| .\devcon.exe install vbcable\vbMmeCable64_win7.inf VBAudioVACWDM | ||
| Pop-location | ||
| function Dump-Devices { | ||
| Write-Host "Current sound devices:" | ||
| Get-CimInstance Win32_SoundDevice | | ||
| Select-Object Name,Status | | ||
| Format-Table -AutoSize | ||
| } | ||
|
|
||
| main | ||
| Push-Location $PSScriptRoot | ||
|
|
||
| Download-Zip -Url $Url -Out (Join-Path $PSScriptRoot $ZipName) | ||
| Expand-Zip -Zip (Join-Path $PSScriptRoot $ZipName) -Dest (Join-Path $PSScriptRoot $ExtractDir) | ||
|
|
||
| $cer = Join-Path $PSScriptRoot 'vbcable.cer' | ||
| if (Test-Path $cer) { | ||
| Write-Host "Adding certificate to TrustedPublisher: $cer" | ||
| certutil.exe -addstore -f TrustedPublisher $cer | ||
| } else { | ||
| Write-Error "Certificate not found at $cer; cannot trust the driver." | ||
| } | ||
| Install-Driver -InfDir (Join-Path $PSScriptRoot $ExtractDir) | ||
|
|
||
| Restart-AudioServices | ||
| Dump-Devices | ||
|
|
||
| Pop-Location |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the
sleepin there? There must have been a reason we put it in theresleepat some point (I don't remember what it is offhand) so probably better to keep it and do the check twice.Also the existing test made sure that there were actually output channels available, the test no longer does that. Looks like the output on Windows is:
so it should have still passed. So it's probably worth reverting these changes, or otherwise refactoring them to make sure they still check things as completely as they did before.