xref: /third_party/mesa3d/.gitlab-ci/bare-metal/eth008-power-relay.py
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/mesa3d/.gitlab-ci/bare-metal/
1bf215546Sopenharmony_ci#!/usr/bin/python3
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ciimport sys
4bf215546Sopenharmony_ciimport socket
5bf215546Sopenharmony_ci
6bf215546Sopenharmony_cihost = sys.argv[1]
7bf215546Sopenharmony_ciport = sys.argv[2]
8bf215546Sopenharmony_cimode = sys.argv[3]
9bf215546Sopenharmony_cirelay = sys.argv[4]
10bf215546Sopenharmony_cimsg = None
11bf215546Sopenharmony_ci
12bf215546Sopenharmony_ciif mode == "on":
13bf215546Sopenharmony_ci    msg = b'\x20'
14bf215546Sopenharmony_cielse:
15bf215546Sopenharmony_ci    msg = b'\x21'
16bf215546Sopenharmony_ci
17bf215546Sopenharmony_cimsg += int(relay).to_bytes(1, 'big')
18bf215546Sopenharmony_cimsg += b'\x00'
19bf215546Sopenharmony_ci
20bf215546Sopenharmony_cic = socket.create_connection((host, int(port)))
21bf215546Sopenharmony_cic.sendall(msg)
22bf215546Sopenharmony_ci
23bf215546Sopenharmony_cidata = c.recv(1)
24bf215546Sopenharmony_cic.close()
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ciif data[0] == b'\x01':
27bf215546Sopenharmony_ci    print('Command failed')
28bf215546Sopenharmony_ci    sys.exit(1)
29

Indexes created Thu Nov 07 10:32:03 CST 2024