Created
October 20, 2023 16:09
-
-
Save surt91/63fca6e0fa4db120f181d31d884c622e to your computer and use it in GitHub Desktop.
scan_dids
This file contains 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
import time | |
import udsoncan | |
from udsoncan.connections import IsoTPSocketConnection | |
from udsoncan.client import Client | |
from udsoncan.services import ReadDataByIdentifier | |
interface = "can0" | |
txid = 0x6C5 | |
rxid = txid + 0x10 | |
start = 256 | |
end = 3500 | |
conn = IsoTPSocketConnection(interface, rxid=rxid, txid=txid) | |
with Client(conn) as client: | |
for did in range(start, end): | |
try: | |
response = client.send_request( | |
udsoncan.Request( | |
service=ReadDataByIdentifier, | |
data=(did).to_bytes(2, byteorder='big') | |
) | |
) | |
if response.positive: | |
print(f"{did}:{len(response)}") | |
else: | |
print(f"{did}:0") | |
except Exception as e: | |
pass | |
# print(f"# DID {did}: Fehler: {e}") | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment