I try your solution but it gives a result string of 278 characters only, not include the serial number.
Is there any solution to call from codesys runtime a shell command and take the result?
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you can call every shell command but you do not get the result/output of them back to the iec world.
that's the point, so you need in this case to use the char device example.
Regards
Edwin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please explain us how we can take return result in Plc application of system commands like:
"cat /proc/cpuinfo "?
Regards
Hi,
use this project from this link, and feel free to modify it to your needs:
l viewtopic.php?f=21&t=5923#p11084 l
change szFilename: STRING := '/proc/cpuinfo';
and somehow you need to get your information from the buffer which contains then /proc/cpuinfo ... see screenshot
BR
Edwin
RaspberryPI_CharDeviceSnippet3.project [143.53 KiB]
I try your solution but it gives a result string of 278 characters only, not include the serial number.
Is there any solution to call from codesys runtime a shell command and take the result?
Regards.
Hi,
you need to specify your startpos to read see screenshot.
BR
Edwin
Is there any other way to run OS command and take back the result?
Because if I use your solution I can't run commands like in shell mode.
Regards
Hi,
you can call every shell command but you do not get the result/output of them back to the iec world.
that's the point, so you need in this case to use the char device example.
Regards
Edwin
How can I use the command "grep -i serial /proc/cpuinfo | cut -d" " -f2" with chardevice and take the result?
Regards
that's what I already said:
It is not possible to get the result to the iec world...but you have a workaround!
BR
Edwin