AeThex-OS/restore_adb_driver.ps1
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

65 lines
2.7 KiB
PowerShell

# Restore ADB driver for VID_0E8D - must run as admin
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Start-Process PowerShell -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Wait
exit
}
Write-Host "=== Restore ADB Driver ===" -ForegroundColor Cyan
# Step 1: Remove the current Zadig WinUSB driver for VID_0E8D:PID_201C device
Write-Host "Removing broken device node..." -ForegroundColor Yellow
$devs = Get-PnpDevice | Where-Object { $_.InstanceId -like '*VID_0E8D*PID_201C*' }
foreach ($dev in $devs) {
Write-Host " Removing: $($dev.FriendlyName) [$($dev.InstanceId)] (Status: $($dev.Status))"
pnputil /remove-device "$($dev.InstanceId)" 2>&1
}
# Also remove PID_201D devices that might be cached wrong
$devs2 = Get-PnpDevice | Where-Object { $_.InstanceId -like '*VID_0E8D*PID_201D*' }
foreach ($dev in $devs2) {
Write-Host " Removing: $($dev.FriendlyName) [$($dev.InstanceId)]"
pnputil /remove-device "$($dev.InstanceId)" 2>&1
}
# Step 2: Remove all Zadig (libwdi) OEM drivers for MediaTek
Write-Host ""
Write-Host "Removing Zadig OEM drivers..." -ForegroundColor Yellow
$output = pnputil /enum-drivers 2>&1 | Out-String
$blocks = $output -split "(?=Published Name:)"
foreach ($block in $blocks) {
if ($block -match "libwdi" -and ($block -match "0E8D" -or $block -match "android\.inf" -or $block -match "mt65xx")) {
if ($block -match "Published Name:\s+(oem\d+\.inf)") {
$drvName = $Matches[1]
Write-Host " Deleting: $drvName"
pnputil /delete-driver $drvName /force 2>&1
}
}
}
# Step 3: Make sure the Google/proper ADB driver is available
Write-Host ""
Write-Host "Ensuring ADB driver is available..." -ForegroundColor Yellow
$googleInf = "$env:LOCALAPPDATA\Android\Sdk\extras\google\usb_driver\android_winusb.inf"
if (Test-Path $googleInf) {
Write-Host " Re-adding Google USB driver..."
pnputil /add-driver $googleInf /install 2>&1
}
# Step 4: Rescan hardware
Write-Host ""
Write-Host "Scanning for hardware changes..." -ForegroundColor Yellow
pnputil /scan-devices 2>&1
Write-Host ""
Write-Host "DONE. Now UNPLUG and REPLUG the USB cable." -ForegroundColor Green
Write-Host "Windows should re-detect the device with the correct ADB driver." -ForegroundColor Green
Write-Host ""
Start-Sleep -Seconds 3
# Check what we have now
Write-Host "Current USB devices:" -ForegroundColor Yellow
Get-PnpDevice -Status "OK" | Where-Object { $_.InstanceId -like '*0E8D*' -or $_.InstanceId -like '*18D1*' } | Select-Object Status, Class, InstanceId, FriendlyName | Format-Table -AutoSize
Read-Host "Press Enter to close"