mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
fixed cleanup script
This commit is contained in:
@@ -15,15 +15,17 @@ def main() -> None:
|
|||||||
|
|
||||||
logger.info("Cleaning up ...")
|
logger.info("Cleaning up ...")
|
||||||
with gpio.bcm():
|
with gpio.bcm():
|
||||||
for (key, pin) in [
|
for (name, pin) in [
|
||||||
*config["atx"]["switches"]["pinout"].items(),
|
("atx_power_switch", config["atx"]["pinout"]["power_switch"]),
|
||||||
*config["video"]["pinout"].items(),
|
("atx_reset_switch", config["atx"]["pinout"]["reset_switch"]),
|
||||||
|
("streamer_cap", config["streamer"]["pinout"]["cap"]),
|
||||||
|
("streamer_conv", config["streamer"]["pinout"]["conv"]),
|
||||||
]:
|
]:
|
||||||
if pin > 0:
|
if pin > 0:
|
||||||
logger.info("Writing value=0 to pin=%d (%s)", pin, key)
|
logger.info("Writing value=0 to pin=%d (%s)", pin, name)
|
||||||
gpio.set_output(pin, initial=False)
|
gpio.set_output(pin, initial=False)
|
||||||
|
|
||||||
streamer = os.path.basename(config["video"]["cmd"][0])
|
streamer = os.path.basename(config["streamer"]["cmd"][0])
|
||||||
logger.info("Trying to find and kill %r ...", streamer)
|
logger.info("Trying to find and kill %r ...", streamer)
|
||||||
try:
|
try:
|
||||||
subprocess.check_output(["killall", streamer], stderr=subprocess.STDOUT)
|
subprocess.check_output(["killall", streamer], stderr=subprocess.STDOUT)
|
||||||
|
|||||||
Reference in New Issue
Block a user