Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
# Python wrapper of realtime script
# Copyright 2026 Hannes Diethelm <hannes.diethelm@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import subprocess
REALTIME="@REALTIME@"
def verify_info() -> tuple[bool, str]:
#Checks if system is realtime compatible
cmd = [REALTIME, "verify"]
ret = subprocess.run(cmd, stdin=subprocess.DEVNULL, capture_output=True, text=True)
if ret.returncode != 0 and ret.returncode != 1:
raise RuntimeError("cmd \"" + " ".join(cmd) + "\" failed with status " + str(ret.returncode))
return ret.returncode==0, ret.stdout.rstrip();
def verify() -> bool:
ret, _ = verify_info();
return ret;
def status() -> bool:
#Status: realtime core running (rtapi_app running or kernel modules active)
#Note: rtapi_app running does not mean realtime compatibility!
cmd = [REALTIME, "status"]
ret = subprocess.run(cmd, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL)
if ret.returncode != 0 and ret.returncode != 1:
raise RuntimeError("cmd \"" + " ".join(cmd) + "\" failed with status " + str(ret.returncode))
return ret.returncode==0;