39 lines
1019 B
Python
39 lines
1019 B
Python
"""Quick test: check ADB device connection and take a screenshot."""
|
|
|
|
import sys
|
|
import os
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from src.capture import ADBCapture
|
|
|
|
|
|
def main():
|
|
cap = ADBCapture()
|
|
|
|
print("Checking device...")
|
|
info = cap.check_device()
|
|
|
|
if not info["connected"]:
|
|
print(f"[FAIL] {info['error']}")
|
|
print()
|
|
print("Troubleshooting:")
|
|
print(" 1. USB debugging enabled on phone?")
|
|
print(" 2. Run: adb devices")
|
|
print(" 3. Accept USB debugging prompt on phone")
|
|
sys.exit(1)
|
|
|
|
print(f"[OK] Device: {info['model']}")
|
|
print(f" Serial: {info['serial']}")
|
|
print(f" Resolution: {info['resolution']}")
|
|
print(f" All devices: {info['all_devices']}")
|
|
|
|
print("\nTaking screenshot...")
|
|
img = cap.screenshot(save=True)
|
|
print(f"[OK] Screenshot: {img.size[0]}x{img.size[1]}")
|
|
print(f" Saved to: {cap.screenshot_dir}/")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|