projects
/
mesa.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
aco: ensure readfirstlane subdword operands are always dword aligned
[mesa.git]
/
.gitlab-ci
/
bare-metal
/
google-power-relay.py
1
#!/usr/bin/python3
2
3
import
sys
4
import
serial
5
6
mode
=
sys
.
argv
[
1
]
7
relay
=
sys
.
argv
[
2
]
8
9
# our relays are "off" means "board is powered".
10
mode_swap
= {
11
"on"
:
"off"
,
12
"off"
:
"on"
,
13
}
14
mode
=
mode_swap
[
mode
]
15
16
ser
=
serial
.
Serial
(
'/dev/ttyACM0'
,
115200
,
timeout
=
2
)
17
command
=
"relay {} {}
\n\r
"
.
format
(
mode
,
relay
)
18
ser
.
write
(
command
.
encode
())
19
ser
.
close
()