Skip to content

Commit

Permalink
Merge pull request #23 from byuccl/usb-power-cli
Browse files Browse the repository at this point in the history
USB Power CLI
  • Loading branch information
jgoeders authored Nov 15, 2024
2 parents 11064ea + 7aea287 commit 49da628
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
setup(
name="yinstruments",
packages=find_packages(),
version="1.5.0",
version="1.6.0",
description="Experiment device control scripts for BYU's Configurable Computing Lab (https://ccl.byu.edu/)",
author="Jeff Goeders",
author_email="jeff.goeders@gmail.com",
url="https://github.com/byuccl/yinstruments",
install_requires=["pyudev", "pyserial", "pysnmp", "python-vxi11", "pyhubctl"],
entry_points={"console_scripts": ["pdu = yinstruments.pdu.cli:main"]},
entry_points={
"console_scripts": [
"pdu = yinstruments.pdu.cli:main",
"usb_power = yinstruments.usb_power:cli",
]
},
)
16 changes: 16 additions & 0 deletions yinstruments/usb_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ def power_on(usb_phys_port, print_output=False):
return True


def cli():
parser = argparse.ArgumentParser()
parser.add_argument(
"usb_physical_port", help="The physical port of the USB (1-1.1 for example)"
)
parser.add_argument("action", choices=["on", "off"])

args = parser.parse_args()

p = USBPortPower(args.usb_physical_port)
if args.action == "on":
p.on()
else:
p.off()


def main():
# Power cycle UART USB port
print("Power cycling UART")
Expand Down

0 comments on commit 49da628

Please sign in to comment.