mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-13 04:04:14 +08:00
739ef184cc
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Acked-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12852>
29 lines
407 B
Python
Executable File
29 lines
407 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import sys
|
|
import socket
|
|
|
|
host = sys.argv[1]
|
|
port = sys.argv[2]
|
|
mode = sys.argv[3]
|
|
relay = sys.argv[4]
|
|
msg = None
|
|
|
|
if mode == "on":
|
|
msg = b'\x20'
|
|
else:
|
|
msg = b'\x21'
|
|
|
|
msg += int(relay).to_bytes(1, 'big')
|
|
msg += b'\x00'
|
|
|
|
c = socket.create_connection((host, int(port)))
|
|
c.sendall(msg)
|
|
|
|
data = c.recv(1)
|
|
c.close()
|
|
|
|
if data[0] == b'\x01':
|
|
print('Command failed')
|
|
sys.exit(1)
|