How to read "Machine configuration directory" in HAL userspace component

More
23 Nov 2022 12:17 #257457 by dgarrett
> 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

Please Log in or Create an account to join the conversation.

More
23 Nov 2022 13:23 #257468 by udoS
@dgarrett
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.

More
23 Nov 2022 14:14 #257474 by dgarrett
> 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

 

Please Log in or Create an account to join the conversation.

More
23 Nov 2022 23:23 #257527 by udoS
@dgarrett
Hi,
thanks for your effort; but the thing is that there are no "NON" of the env vars visible in respect to linuxcnc;

 
Attachments:

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 08:52 #257545 by udoS
@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
 

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 09:04 #257546 by rodw
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.

Please Log in or Create an account to join the conversation.

More
24 Nov 2022 09:45 #257550 by udoS
@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. ......

Please Log in or Create an account to join the conversation.

More
13 Dec 2022 18:09 - 13 Dec 2022 18:10 #259338 by udoS
@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
Last edit: 13 Dec 2022 18:10 by udoS.

Please Log in or Create an account to join the conversation.

More
14 Dec 2022 02:27 #259401 by andypugh

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.

More
14 Dec 2022 08:04 - 14 Dec 2022 19:05 #259429 by udoS
[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]
Last edit: 14 Dec 2022 19:05 by udoS.

Please Log in or Create an account to join the conversation.

Time to create page: 0.118 seconds
Powered by Kunena Forum