Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python examples rework #27

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
python: navio: Common: util: add new function
Add function get_navio_version, which return Navio version
  • Loading branch information
Igor Anokhin committed Jan 10, 2018
commit 6c0c9236f050d4db558cf25753aa2cb39b7b2bd0
5 changes: 5 additions & 0 deletions Python/navio/Common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ def check_apm():
ret = sub.call(["ps -AT | grep -c ap-timer > /dev/null"], shell = True)
if ret <= 0:
sys.exit("APM is running. Can't launch the example")

def get_navio_version():
file = open("/sys/firmware/devicetree/base/hat/product_id")
version = "NAVIO" if file.readline(6) == "0x0001" else "NAVIO2"
return version