20 lines
634 B
Python
20 lines
634 B
Python
|
|
import ctypes
|
|||
|
|
import os
|
|||
|
|
|
|||
|
|
dll_path = os.path.abspath("ControlCANFD.dll")
|
|||
|
|
canfd = ctypes.windll.LoadLibrary(dll_path)
|
|||
|
|
|
|||
|
|
ZCAN_OpenDevice = canfd.ZCAN_OpenDevice
|
|||
|
|
ZCAN_OpenDevice.argtypes = [ctypes.c_uint, ctypes.c_uint, ctypes.c_uint]
|
|||
|
|
ZCAN_OpenDevice.restype = ctypes.c_void_p
|
|||
|
|
|
|||
|
|
print("Testando valores possíveis de DEVICE_TYPE (0–2000)...")
|
|||
|
|
|
|||
|
|
for device_type in range(0, 2000):
|
|||
|
|
handle = ZCAN_OpenDevice(device_type, 0, 0)
|
|||
|
|
if handle:
|
|||
|
|
print(f"✅ Sucesso com DEVICE_TYPE = {device_type} — Handle: {handle}")
|
|||
|
|
break
|
|||
|
|
else:
|
|||
|
|
print("❌ Nenhum DEVICE_TYPE funcionou! Verifique o driver ou compatibilidade da DLL.")
|