- LinuxCNC
- General LinuxCNC Questions
- How to read "Machine configuration directory" in HAL userspace component
How to read "Machine configuration directory" in HAL userspace component
- dgarrett
- Offline
- Platinum Member
Less
More
- Posts: 567
- Thank you received: 323
23 Nov 2022 12:17 #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
23 Nov 2022 13:23 #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.
- dgarrett
- Offline
- Platinum Member
Less
More
- Posts: 567
- Thank you received: 323
23 Nov 2022 14:14 #257474
by dgarrett
Replied by dgarrett on topic How to read "Machine configuration directory" in HAL userspace component
> there is no "INI_FILE_NAME" or "CONFIG_DIR" in the env; Sorry.
INI_FILE_NAME is exported by the main linuxcnc script and will be in
the environment of any process started by that script (such as the
program specified by the ini setting [DISPLAY]DISPLAY)
Ref:
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L257
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L804
> About that stat() ?
The stat variable ini_filename (2.9 & master branches):
github.com/LinuxCNC/linuxcnc/blob/master...ntf/emc_nml.hh#L1505
Ref:
github.com/LinuxCNC/linuxcnc/commit/f16a...80ce213b8aed88cae9c7
INI_FILE_NAME is exported by the main linuxcnc script and will be in
the environment of any process started by that script (such as the
program specified by the ini setting [DISPLAY]DISPLAY)
Ref:
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L257
github.com/LinuxCNC/linuxcnc/blob/master...pts/linuxcnc.in#L804
> About that stat() ?
The stat variable ini_filename (2.9 & master branches):
github.com/LinuxCNC/linuxcnc/blob/master...ntf/emc_nml.hh#L1505
Ref:
github.com/LinuxCNC/linuxcnc/commit/f16a...80ce213b8aed88cae9c7
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
23 Nov 2022 23:23 #257527
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@dgarrett
Hi,
thanks for your effort; but the thing is that there are no "NON" of the env vars visible in respect to linuxcnc;
Hi,
thanks for your effort; but the thing is that there are no "NON" of the env vars visible in respect to linuxcnc;
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
24 Nov 2022 08:52 #257545
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@dgarrett
Hi,
what I understand:
setting var in one shell e.g. "xfce4-terminal" or "lxterminal"
udos@cnc-next:~$ MY_VAR=my_var
udos@cnc-next:~$ export MY_VAR
udos@cnc-next:~$ echo $MY_VAR
BUT: that MY_VAR is only available in the same shell/process or child-shell/process;
If I run a new app/process, then those vars are not set/there; not available;
So to have them available, the new app/process would need to be a child of linuxcnc-env;
Best Regards
Hi,
what I understand:
setting var in one shell e.g. "xfce4-terminal" or "lxterminal"
udos@cnc-next:~$ MY_VAR=my_var
udos@cnc-next:~$ export MY_VAR
udos@cnc-next:~$ echo $MY_VAR
BUT: that MY_VAR is only available in the same shell/process or child-shell/process;
If I run a new app/process, then those vars are not set/there; not available;
So to have them available, the new app/process would need to be a child of linuxcnc-env;
Best Regards
Please Log in or Create an account to join the conversation.
- rodw
- Away
- Platinum Member
Less
More
- Posts: 10786
- Thank you received: 3552
24 Nov 2022 09:04 #257546
by rodw
Replied by rodw on topic How to read "Machine configuration directory" in HAL userspace component
In your home folder there should be a hidden file called .profile
I think (but could be wrong) if you add your commands in that file and reboot or even just logout, they should be persistent.
I think (but could be wrong) if you add your commands in that file and reboot or even just logout, they should be persistent.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
24 Nov 2022 09:45 #257550
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@rodw
Thanks, but the problem here is:
the $HOME/linuxcnc/config/anyConfig/anyName.ini
can always be different;
I start my app and have to check if or if not LinuxCNC is running;
If not then start it;
then I read from the .ini some values;
a.s.o. ......
Thanks, but the problem here is:
the $HOME/linuxcnc/config/anyConfig/anyName.ini
can always be different;
I start my app and have to check if or if not LinuxCNC is running;
If not then start it;
then I read from the .ini some values;
a.s.o. ......
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
13 Dec 2022 18:09 - 13 Dec 2022 18:10 #259338
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
@all
another question related to this is:
how can you shut down Linuxcnc in a controlled way with an external command;
Just like clicking the x in upper right corner;
and then also avoid that "are you shure...... " thing;
best regards
another question related to this is:
how can you shut down Linuxcnc in a controlled way with an external command;
Just like clicking the x in upper right corner;
and then also avoid that "are you shure...... " thing;
best regards
Last edit: 13 Dec 2022 18:10 by udoS.
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23162
- Thank you received: 4860
14 Dec 2022 02:27 #259401
by andypugh
External command from where?
pkill -3 axis
will work, but seems to always pop-up the error report dialog box in my testing.
Replied by andypugh on topic How to read "Machine configuration directory" in HAL userspace component
how can you shut down Linuxcnc in a controlled way with an external command;
External command from where?
pkill -3 axis
will work, but seems to always pop-up the error report dialog box in my testing.
Please Log in or Create an account to join the conversation.
- udoS
- Offline
- Elite Member
Less
More
- Posts: 216
- Thank you received: 25
14 Dec 2022 08:04 - 14 Dec 2022 19:05 #259429
by udoS
Replied by udoS on topic How to read "Machine configuration directory" in HAL userspace component
[justify]
@andypugh
Hi andypugh,
"pkill -3 axis" works OK and I don't get that popup window;
But only if you use axis; running in the backyard so to speek;
It looks like everything is cleaned out;
I can send it with QProcess;
I thought there would be an internal Lcnc function
or a NML command to shut it down in a controlled way;
or else I will stick to the kill;
I'm starting LinuxCNC out of my Qt c++ app because I need access to the HAL / PINS;
Thanks
Best Regards
p.s. is there a privat channal to talk; I have a realy basic question regarding LinuxCNC;
or else a mail uschlicher at t-online dot de
[/justify] It looks like everything is cleaned out;
I can send it with QProcess;
I thought there would be an internal Lcnc function
or a NML command to shut it down in a controlled way;
or else I will stick to the kill;
I'm starting LinuxCNC out of my Qt c++ app because I need access to the HAL / PINS;
Thanks
Best Regards
p.s. is there a privat channal to talk; I have a realy basic question regarding LinuxCNC;
or else a mail uschlicher at t-online dot de
Last edit: 14 Dec 2022 19:05 by udoS.
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- How to read "Machine configuration directory" in HAL userspace component
Time to create page: 0.123 seconds