diff --git a/switch_mode.py b/switch_mode.py new file mode 100644 index 0000000..fdb16c2 --- /dev/null +++ b/switch_mode.py @@ -0,0 +1,44 @@ +import serial +import time +import glob +import binascii + +# Gridseed Befehle (Hex Strings) +# Scrypt Reset: 55AA1F2816000000 + 55AA1F2817000000 +# SHA256 Reset (Vermutung/Standard): 55AA1F2800000000 +# Init: 55AAC000C0C0C0C00500000001000000 + +CMD_SHA_RESET = "55AA1F2800000000" + +def send_command(port, hex_cmd): + try: + ser = serial.Serial(port, 115200, timeout=1) + cmd_bytes = binascii.unhexlify(hex_cmd) + print(f"Sending to {port}: {hex_cmd}") + ser.write(cmd_bytes) + time.sleep(0.1) + ser.close() + return True + except Exception as e: + print(f"Error on {port}: {e}") + return False + +def main(): + print("=== Gridseed Mode Switcher (SHA256) ===") + + # Suche Gridseeds (meist ttyACM*) + ports = glob.glob('/dev/ttyACM*') + if not ports: + print("Keine Gridseeds gefunden (/dev/ttyACM*)") + return + + print(f"Gefundene Geräte: {ports}") + + for port in ports: + # Sende SHA Reset + send_command(port, CMD_SHA_RESET) + + print("Fertig. Starte Miner neu und prüfe Hashrate.") + +if __name__ == "__main__": + main()