Skip to content

Conversation

@dewabe
Copy link
Contributor

@dewabe dewabe commented Dec 12, 2025

To support Beckhoff RT-Linux, we need to use a FreeBSD-based solution, even though the operating system itself is Linux-based.

My solution is to check whether TwinCAT is installed on Beckhoff RT-Linux (sudo apt install tc31-xar-um). If TwinCAT is installed - os.path.exists("/usr/bin/TcSystemServiceUm") - the system then uses a FreeBSD-based approach.

@chrisbeardy
Copy link
Collaborator

Thanks for this, is this for when you are running pyads on the RT Linux IPC itself? I wonder why it doesnt pick up the sys.platform.startswith("linux") properly, I wonder why that doesnt work on the RT linux.

@dewabe
Copy link
Contributor Author

dewabe commented Dec 12, 2025

Yes, the issue appears when using Beckhoff RT-Linux, and that's the reason why I created additional function for that.

I assume Beckhoff RT-Linux shares some (most) of the features with TwinCAT/BSD, which leads that is_platform_linux() function doesn't fully work on this case - even though the system is Linux. One of the issues it that without the update, pyads cannot create connection to the system (and so, cannot read any variables).

The very same library (libTcAdsDll.so) is found in RT-Linux, like in FreeBSD (or TwinCAT/BSD) system.

@chrisbeardy
Copy link
Collaborator

may fix #433

@chrisbeardy
Copy link
Collaborator

I don't have access to a Beckhoff Linux IPC unfortunately. Out of interest, do you know what the command sys.platform returns? I'm wondering if we use that instead if it returns anything useful to keep it in line with the other code.

@dewabe
Copy link
Contributor Author

dewabe commented Dec 12, 2025

It does return 'linux', and that's the reason of the issue actually. Kind of conflict as it is Linux, but in pyads point of view, it works like freebsd.

"My solution" is tested on both, Virtual Machine as well as on actual IPC with Beckhoff RT-Linux. Waiting for another feedback, but I see no reason why it shouldn't work on that case also.
Screenshot 2025-12-12 141329

I have an access to actual IPC as well, in case you need more details.

@chrisbeardy
Copy link
Collaborator

that makes sense and I suspect very much related to #433. The implementation of pyads never thought that Beckhoff may one day release a linux IPC so defo did not consider this in our implementation. It may also be fixed if we updated our ads dll we package too as that is quite old but that is a task for another day! I think this workaround will do for now. Can we just add a comment to the fucntion platform_is_linux_rt to say this is a workaround for when pyads is running on rt linux and say see PR #479. Just to make it clear as otherwsie I can see further down the line someone getting confused. Thanks.

@coveralls
Copy link

coveralls commented Dec 12, 2025

Pull Request Test Coverage Report for Build 20267218058

Details

  • 4 of 5 (80.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 93.836%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/pyads/utils.py 4 5 80.0%
Totals Coverage Status
Change from base Build 15934304603: 0.01%
Covered Lines: 1781
Relevant Lines: 1898

💛 - Coveralls

@chrisbeardy
Copy link
Collaborator

hi @dewabe i think you are accidentally committing the README changes to this PR too, I was just about to merge this and push a new release

@dewabe
Copy link
Contributor Author

dewabe commented Dec 16, 2025

Hi @chrisbeardy
yes. And now I screwed my fork. And fixed it again. Commented it to be a workaround

@dewabe dewabe reopened this Dec 16, 2025
@chrisbeardy chrisbeardy merged commit 54c6c3b into stlehmann:master Dec 16, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants