- Posts: 216
- Thank you received: 25
How to read "Machine configuration directory" in HAL userspace component
- udoS
- Offline
- Elite Member
-
Less
More
3 years 11 months ago #257319
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@freisei
some pree condition:
Linuxcnc must be running;
If you start Linuxcnc then you can querry:
$ ps aux | grep "linuxcnc"
LinuxCNC starts with "/bin/bash /usr/bin/linuxcnc"
Now if you start LinuxCNC, LinuxCNC starts/calls for "halui -ini" and "io -ini"
If you querry now for
$ ps aux | grep "halui -ini" or
$ ps aux | grep "io -ini"
then you get as return the process info along with the path;
io -ini /home/udos/linuxcnc/configs/sim.axis.gantry/gantry_mm.ini
Here the code I have used in Qt 5.15.2:
some pree condition:
Linuxcnc must be running;
If you start Linuxcnc then you can querry:
$ ps aux | grep "linuxcnc"
LinuxCNC starts with "/bin/bash /usr/bin/linuxcnc"
Now if you start LinuxCNC, LinuxCNC starts/calls for "halui -ini" and "io -ini"
If you querry now for
$ ps aux | grep "halui -ini" or
$ ps aux | grep "io -ini"
then you get as return the process info along with the path;
io -ini /home/udos/linuxcnc/configs/sim.axis.gantry/gantry_mm.ini
Here the code I have used in Qt 5.15.2:
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
-
Less
More
- Posts: 19899
- Thank you received: 4655
3 years 11 months ago #257405
by andypugh
Replied by andypugh on topic How to read "Machine configuration directory" in HAL userspace component
Maybe you can run the linuxcnc_info script?
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
-
Less
More
- Posts: 492
- Thank you received: 297
3 years 11 months ago - 3 years 11 months ago #257412
by dgarrett
Replied by dgarrett on topic How to read "Machine configuration directory" in HAL userspace component
Processes started by linuxcnc (like [DISPLAY]DISPLAY)
inherit the environmental variables 'INI_FILE_NAME'
Python example within a [DISPLAY]DISPLAY program:
import os
print(os.environ.get("INI_FILE_NAME"))
The ini setting is also available in stat() and
may be obtained from programs not started by linuxcnc
(if Run-In-PLace, source rip_environment first):
$ python -c "import linuxcnc;s=linuxcnc.stat();s.poll();print(s.ini_filename)"
Note the item namings are different (INI_FILE_NAME and ini_filename)
inherit the environmental variables 'INI_FILE_NAME'
Python example within a [DISPLAY]DISPLAY program:
import os
print(os.environ.get("INI_FILE_NAME"))
The ini setting is also available in stat() and
may be obtained from programs not started by linuxcnc
(if Run-In-PLace, source rip_environment first):
$ python -c "import linuxcnc;s=linuxcnc.stat();s.poll();print(s.ini_filename)"
Note the item namings are different (INI_FILE_NAME and ini_filename)
Last edit: 3 years 11 months ago by dgarrett.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
-
Less
More
- Posts: 216
- Thank you received: 25
3 years 11 months ago #257429
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
Thanks for the info;
@andypugh
How does that get me the path to a running linuxcnc ?
@dgarrett
I'm all in Qt and/or c++; No No No Python; what so ever;
with "The ini setting is also available in stat()" .. are you referring to NML ?
then what is the call for it ? could be used in the Lcnc_QtCpp_HMI;
What I have here is an interface into LinuxCNC/HAL in an attempt to build a Linuxcnc-IDE;
Qt 5.15.2, with Creator 8.0.1, c++17; any help Wellcome !
Best Regards
@andypugh
How does that get me the path to a running linuxcnc ?
@dgarrett
I'm all in Qt and/or c++; No No No Python; what so ever;
with "The ini setting is also available in stat()" .. are you referring to NML ?
then what is the call for it ? could be used in the Lcnc_QtCpp_HMI;
What I have here is an interface into LinuxCNC/HAL in an attempt to build a Linuxcnc-IDE;
Qt 5.15.2, with Creator 8.0.1, c++17; any help Wellcome !
Best Regards
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
-
Less
More
- Posts: 492
- Thank you received: 297
3 years 11 months ago #257457
by dgarrett
Replied by dgarrett on topic How to read "Machine configuration directory" in HAL userspace component
> I'm all in Qt and/or c++; No No No Python; what so ever;
for environmental variables like INI_FILE_NAME:
$ man -s3 getenv
for environmental variables like INI_FILE_NAME:
$ man -s3 getenv
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
-
Less
More
- Posts: 216
- Thank you received: 25
3 years 11 months ago #257468
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@dgarrett
there is no "INI_FILE_NAME" or "CONFIG_DIR" in the env; Sorry.
About that stat() ?
there is no "INI_FILE_NAME" or "CONFIG_DIR" in the env; Sorry.
About that stat() ?
Please Log in or Create an account to join the conversation.
Time to create page: 0.156 seconds