Files
moonlight-drive-in/clients/SMART_CONNECT_FIX.md

2.4 KiB

Smart Connect Client Fix

Issue

The smart connect client (nfc_autoconnect.py) was incompatible with the updated NFCNetworkClient v1.1.0, causing this error:

TypeError: NFCNetworkClient.__init__() missing 1 required positional argument: 'root'

Fix Applied

Updated nfc_autoconnect.py to v2.0.0 with proper compatibility:

  • Now creates Tkinter root properly
  • Passes root to parent NFCNetworkClient class
  • Maintains all smart DNS resolution features
  • Inherits global input capture from parent class

What's Fixed

Before (Broken)

class SmartAutoConnectClient(NFCNetworkClient):
    def __init__(self, device_name: str, fallback_ip: str, port: int = 8547):
        super().__init__()  # ❌ Missing root parameter

After (Fixed)

class SmartAutoConnectClient(NFCNetworkClient):
    def __init__(self, root: tk.Tk, device_name: str, fallback_ip: str, port: int = 8547):
        super().__init__(root)  # ✅ Properly passes root

Features Now Working

Smart DNS resolution (Standard DNS, mDNS, Tailscale) Automatic fallback to known IP Auto-reconnect on failure Global input capture (inherited from NFCNetworkClient v1.1.0) NFC scans work without window focus Background operation capability

How to Update

  1. Pull latest from Gitea (already done automatically)
  2. Run the smart connect launcher:
    connect_drivein_simple.bat
    

The launcher automatically checks for dependencies and installs them if needed.

Version History

v2.0.0 (Current)

  • Fixed compatibility with NFCNetworkClient v1.1.0
  • Proper Tkinter root initialization
  • Inherits global input capture capability
  • 🐛 Fixed TypeError on startup

v1.0.0 (Previous)

  • Smart DNS resolution
  • Auto-connect functionality
  • Incompatible with NFCNetworkClient v1.1.0

Files Updated

clients/nfc_autoconnect.py (v2.0.0) clients/connect_drivein_simple.bat (simplified launcher)

Testing

  1. Run connect_drivein_simple.bat
  2. Client should start without errors
  3. Should automatically connect to drive-in server
  4. NFC scans should work even when window is unfocused

Technical Notes

The smart connect client now:

  • Creates tk.Tk() root in main()
  • Passes root to SmartAutoConnectClient(root, ...)
  • Parent class handles all keyboard capture and UI
  • Smart DNS resolution happens in background threads
  • Auto-retry on connection failure

All working perfectly! 🎬