Jan 10 2021
11:16 AM JT-Cave: does LinuxCNC set an environment variable when it running that you could check from a python program?
11:36 AM rs[m]: JT-Cave: what do want do achieve?
11:37 AM JT-Cave: I just need to know if LinuxCNC is running so I can issue a halcmd
11:37 AM JT-Cave: otherwise the halcmd runs fine but does not return any pin names
11:37 AM Tom_L: can you test a motion pin for that? if it's not there it's doubtful linuxcnc is running
11:37 AM rs[m]: environment is not global, only child processes of linuxcnc would see new env variables
11:38 AM rs[m]: you could check for linux shared memory segment with ipcs
11:38 AM JT-Cave: ok, I just remember that from one of the simple g code generators
11:38 AM JT-Cave: Tom_L, can't load linuxcnc in python3
11:38 AM JT-Cave: well you can but there is nothing there
11:39 AM rs[m]: if ipcs shows a memory segment with id 0x48414c32 HAL is running
11:39 AM JT-Cave: is ipcs a terminal command?
11:39 AM rs[m]: yes
11:40 AM Tom_L: https://man7.org/linux/man-pages/man1/ipcs.1.html
11:40 AM JT-Cave: ok let me try with subprocess
11:41 AM JT-Cave: hmm I see three locked status after starting linuxcnc
11:41 AM JT-Cave: 0x48484c34 537428026 john 600 16 6 locked
11:41 AM JT-Cave: 0x48414c32 537460795 john 600 348160 6 locked
11:41 AM JT-Cave: 0x00000064 537493564 john 600 2512904 2 locked
11:41 AM -!- #linuxcnc-devel mode set to +v by ChanServ
11:42 AM rs[m]: sorry, 0x48414c32 is the "key", not the "id" of the segment
11:42 AM rs[m]: 0x48414c32 is the string "HAL2"
11:42 AM JT-Cave: I assume 0x48484c34 is linuxcnc as well
11:43 AM rs[m]: the other one spells "HHL4", don't know who creates that, but that also belongs to linuxcnc somehow
11:46 AM JT-Cave: ok got it working thanks a bunch
11:47 AM JT-Cave: really nap time now :)
11:47 AM Tom_L: :)
11:48 AM rs[m]: :)