Serial port program to write file/read to file from tty?
Clash Royale CLAN TAG#URR8PPP
i'm looking for some commandline program which I can use to send and receive data to/from serial port. I would like to automate my testing process - start test script which will send file to ttyPC
, receive output
to file and then compare results.
First I tried with cat
with two processes :
# output
echo "Output"
cat /dev/ttyPC > ./out/out$fileNumber.txt &
outputPID=$!
#input
echo "Input"
cat ./in/in$fileNumber.txt > /dev/ttyPC
But this is not stable. Sometimes it's sending data constantly or have problem "file previously opened" or second tty opening closes first cat
.
Then I tried with minicom (script.txt is sending data) minicom -D /dev/ttyPC -b 115200 -8 -C log1.txt -S script.txt
but i cannot set parity from commandline.
Is there something better?
tty serial-port minicom
add a comment |
i'm looking for some commandline program which I can use to send and receive data to/from serial port. I would like to automate my testing process - start test script which will send file to ttyPC
, receive output
to file and then compare results.
First I tried with cat
with two processes :
# output
echo "Output"
cat /dev/ttyPC > ./out/out$fileNumber.txt &
outputPID=$!
#input
echo "Input"
cat ./in/in$fileNumber.txt > /dev/ttyPC
But this is not stable. Sometimes it's sending data constantly or have problem "file previously opened" or second tty opening closes first cat
.
Then I tried with minicom (script.txt is sending data) minicom -D /dev/ttyPC -b 115200 -8 -C log1.txt -S script.txt
but i cannot set parity from commandline.
Is there something better?
tty serial-port minicom
You could usecu
– wurtel
Feb 13 at 10:57
add a comment |
i'm looking for some commandline program which I can use to send and receive data to/from serial port. I would like to automate my testing process - start test script which will send file to ttyPC
, receive output
to file and then compare results.
First I tried with cat
with two processes :
# output
echo "Output"
cat /dev/ttyPC > ./out/out$fileNumber.txt &
outputPID=$!
#input
echo "Input"
cat ./in/in$fileNumber.txt > /dev/ttyPC
But this is not stable. Sometimes it's sending data constantly or have problem "file previously opened" or second tty opening closes first cat
.
Then I tried with minicom (script.txt is sending data) minicom -D /dev/ttyPC -b 115200 -8 -C log1.txt -S script.txt
but i cannot set parity from commandline.
Is there something better?
tty serial-port minicom
i'm looking for some commandline program which I can use to send and receive data to/from serial port. I would like to automate my testing process - start test script which will send file to ttyPC
, receive output
to file and then compare results.
First I tried with cat
with two processes :
# output
echo "Output"
cat /dev/ttyPC > ./out/out$fileNumber.txt &
outputPID=$!
#input
echo "Input"
cat ./in/in$fileNumber.txt > /dev/ttyPC
But this is not stable. Sometimes it's sending data constantly or have problem "file previously opened" or second tty opening closes first cat
.
Then I tried with minicom (script.txt is sending data) minicom -D /dev/ttyPC -b 115200 -8 -C log1.txt -S script.txt
but i cannot set parity from commandline.
Is there something better?
tty serial-port minicom
tty serial-port minicom
edited Feb 13 at 8:28
s.paszko
asked Feb 13 at 8:22
s.paszkos.paszko
10010
10010
You could usecu
– wurtel
Feb 13 at 10:57
add a comment |
You could usecu
– wurtel
Feb 13 at 10:57
You could use
cu
– wurtel
Feb 13 at 10:57
You could use
cu
– wurtel
Feb 13 at 10:57
add a comment |
2 Answers
2
active
oldest
votes
minicom
takes its settings primarily from a configuration file. The defaults are in /etc/minicom/minirc.dfl
, but you can have other configurations saved as /etc/minicom/minirc.<configuration name>
, or in your home directory as ~/.minirc.<configuration name>
.
You can set up one or more prepared configuration files with /dev/ttyPC
as the default port and with the speed and parity settings according to your needs. For example, run minicom -s ttyPC
as root, go to Serial port setup
menu, adjust things (including parity) to suit your needs, then select Save setup as ttyPC
and then exit Minicom. Now you should have a /etc/minicom/minirc.ttyPC
file. You can use its settings, even as a non-root user, by starting Minicom like minicom ttyPC
. If you need multiple sets of configuration settings, repeat as necessary using a different configuration name.
Any command-line options can be used to override settings in the configuration file. So you could simply have multiple configuration files with all the possible parity settings, and override the rest using command line options.
The minicom
configuration file is just text: if you need to fully automate the set-up of your test environment, your script could include the contents of the configuration file and write the configuration file before starting to use minicom
.
I tried your solution. Created configuration file and then run commandminicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer fromttyPC
.
– s.paszko
Feb 13 at 9:39
add a comment |
I've written python script to solve my problem. This script takes serial port device, input file and output file as an arguments and then sent input file content to serial port and reads simultanously (Amount of bytes equal to input file size) to output file. If everything is readen or 5s of no data happend then script closes port and exits.
https://github.com/folkien/pyIoCat
usage: serialCat [-h] -i INPUTFILE -o OUTPUTFILE -d DEVICE [-B BAUDRATE]
[-P PARITY]
optional arguments:
-h, --help show this help message and exit
-i INPUTFILE, --inputFile INPUTFILE
input file
-o OUTPUTFILE, --outputFile OUTPUTFILE
output file
-d DEVICE, --device DEVICE
tty Device
-B BAUDRATE, --baudrate BAUDRATE
-P PARITY, --parity PARITY
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500342%2fserial-port-program-to-write-file-read-to-file-from-tty%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
minicom
takes its settings primarily from a configuration file. The defaults are in /etc/minicom/minirc.dfl
, but you can have other configurations saved as /etc/minicom/minirc.<configuration name>
, or in your home directory as ~/.minirc.<configuration name>
.
You can set up one or more prepared configuration files with /dev/ttyPC
as the default port and with the speed and parity settings according to your needs. For example, run minicom -s ttyPC
as root, go to Serial port setup
menu, adjust things (including parity) to suit your needs, then select Save setup as ttyPC
and then exit Minicom. Now you should have a /etc/minicom/minirc.ttyPC
file. You can use its settings, even as a non-root user, by starting Minicom like minicom ttyPC
. If you need multiple sets of configuration settings, repeat as necessary using a different configuration name.
Any command-line options can be used to override settings in the configuration file. So you could simply have multiple configuration files with all the possible parity settings, and override the rest using command line options.
The minicom
configuration file is just text: if you need to fully automate the set-up of your test environment, your script could include the contents of the configuration file and write the configuration file before starting to use minicom
.
I tried your solution. Created configuration file and then run commandminicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer fromttyPC
.
– s.paszko
Feb 13 at 9:39
add a comment |
minicom
takes its settings primarily from a configuration file. The defaults are in /etc/minicom/minirc.dfl
, but you can have other configurations saved as /etc/minicom/minirc.<configuration name>
, or in your home directory as ~/.minirc.<configuration name>
.
You can set up one or more prepared configuration files with /dev/ttyPC
as the default port and with the speed and parity settings according to your needs. For example, run minicom -s ttyPC
as root, go to Serial port setup
menu, adjust things (including parity) to suit your needs, then select Save setup as ttyPC
and then exit Minicom. Now you should have a /etc/minicom/minirc.ttyPC
file. You can use its settings, even as a non-root user, by starting Minicom like minicom ttyPC
. If you need multiple sets of configuration settings, repeat as necessary using a different configuration name.
Any command-line options can be used to override settings in the configuration file. So you could simply have multiple configuration files with all the possible parity settings, and override the rest using command line options.
The minicom
configuration file is just text: if you need to fully automate the set-up of your test environment, your script could include the contents of the configuration file and write the configuration file before starting to use minicom
.
I tried your solution. Created configuration file and then run commandminicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer fromttyPC
.
– s.paszko
Feb 13 at 9:39
add a comment |
minicom
takes its settings primarily from a configuration file. The defaults are in /etc/minicom/minirc.dfl
, but you can have other configurations saved as /etc/minicom/minirc.<configuration name>
, or in your home directory as ~/.minirc.<configuration name>
.
You can set up one or more prepared configuration files with /dev/ttyPC
as the default port and with the speed and parity settings according to your needs. For example, run minicom -s ttyPC
as root, go to Serial port setup
menu, adjust things (including parity) to suit your needs, then select Save setup as ttyPC
and then exit Minicom. Now you should have a /etc/minicom/minirc.ttyPC
file. You can use its settings, even as a non-root user, by starting Minicom like minicom ttyPC
. If you need multiple sets of configuration settings, repeat as necessary using a different configuration name.
Any command-line options can be used to override settings in the configuration file. So you could simply have multiple configuration files with all the possible parity settings, and override the rest using command line options.
The minicom
configuration file is just text: if you need to fully automate the set-up of your test environment, your script could include the contents of the configuration file and write the configuration file before starting to use minicom
.
minicom
takes its settings primarily from a configuration file. The defaults are in /etc/minicom/minirc.dfl
, but you can have other configurations saved as /etc/minicom/minirc.<configuration name>
, or in your home directory as ~/.minirc.<configuration name>
.
You can set up one or more prepared configuration files with /dev/ttyPC
as the default port and with the speed and parity settings according to your needs. For example, run minicom -s ttyPC
as root, go to Serial port setup
menu, adjust things (including parity) to suit your needs, then select Save setup as ttyPC
and then exit Minicom. Now you should have a /etc/minicom/minirc.ttyPC
file. You can use its settings, even as a non-root user, by starting Minicom like minicom ttyPC
. If you need multiple sets of configuration settings, repeat as necessary using a different configuration name.
Any command-line options can be used to override settings in the configuration file. So you could simply have multiple configuration files with all the possible parity settings, and override the rest using command line options.
The minicom
configuration file is just text: if you need to fully automate the set-up of your test environment, your script could include the contents of the configuration file and write the configuration file before starting to use minicom
.
answered Feb 13 at 9:12
telcoMtelcoM
18.8k12347
18.8k12347
I tried your solution. Created configuration file and then run commandminicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer fromttyPC
.
– s.paszko
Feb 13 at 9:39
add a comment |
I tried your solution. Created configuration file and then run commandminicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer fromttyPC
.
– s.paszko
Feb 13 at 9:39
I tried your solution. Created configuration file and then run command
minicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer from ttyPC
.– s.paszko
Feb 13 at 9:39
I tried your solution. Created configuration file and then run command
minicom -D /dev/ttyPC -C log1.txt < in/in1.txt
. Looks OK, but minicom closes when STDIN stream ends. It's a problem for me because i want to wait on complet transfer from ttyPC
.– s.paszko
Feb 13 at 9:39
add a comment |
I've written python script to solve my problem. This script takes serial port device, input file and output file as an arguments and then sent input file content to serial port and reads simultanously (Amount of bytes equal to input file size) to output file. If everything is readen or 5s of no data happend then script closes port and exits.
https://github.com/folkien/pyIoCat
usage: serialCat [-h] -i INPUTFILE -o OUTPUTFILE -d DEVICE [-B BAUDRATE]
[-P PARITY]
optional arguments:
-h, --help show this help message and exit
-i INPUTFILE, --inputFile INPUTFILE
input file
-o OUTPUTFILE, --outputFile OUTPUTFILE
output file
-d DEVICE, --device DEVICE
tty Device
-B BAUDRATE, --baudrate BAUDRATE
-P PARITY, --parity PARITY
add a comment |
I've written python script to solve my problem. This script takes serial port device, input file and output file as an arguments and then sent input file content to serial port and reads simultanously (Amount of bytes equal to input file size) to output file. If everything is readen or 5s of no data happend then script closes port and exits.
https://github.com/folkien/pyIoCat
usage: serialCat [-h] -i INPUTFILE -o OUTPUTFILE -d DEVICE [-B BAUDRATE]
[-P PARITY]
optional arguments:
-h, --help show this help message and exit
-i INPUTFILE, --inputFile INPUTFILE
input file
-o OUTPUTFILE, --outputFile OUTPUTFILE
output file
-d DEVICE, --device DEVICE
tty Device
-B BAUDRATE, --baudrate BAUDRATE
-P PARITY, --parity PARITY
add a comment |
I've written python script to solve my problem. This script takes serial port device, input file and output file as an arguments and then sent input file content to serial port and reads simultanously (Amount of bytes equal to input file size) to output file. If everything is readen or 5s of no data happend then script closes port and exits.
https://github.com/folkien/pyIoCat
usage: serialCat [-h] -i INPUTFILE -o OUTPUTFILE -d DEVICE [-B BAUDRATE]
[-P PARITY]
optional arguments:
-h, --help show this help message and exit
-i INPUTFILE, --inputFile INPUTFILE
input file
-o OUTPUTFILE, --outputFile OUTPUTFILE
output file
-d DEVICE, --device DEVICE
tty Device
-B BAUDRATE, --baudrate BAUDRATE
-P PARITY, --parity PARITY
I've written python script to solve my problem. This script takes serial port device, input file and output file as an arguments and then sent input file content to serial port and reads simultanously (Amount of bytes equal to input file size) to output file. If everything is readen or 5s of no data happend then script closes port and exits.
https://github.com/folkien/pyIoCat
usage: serialCat [-h] -i INPUTFILE -o OUTPUTFILE -d DEVICE [-B BAUDRATE]
[-P PARITY]
optional arguments:
-h, --help show this help message and exit
-i INPUTFILE, --inputFile INPUTFILE
input file
-o OUTPUTFILE, --outputFile OUTPUTFILE
output file
-d DEVICE, --device DEVICE
tty Device
-B BAUDRATE, --baudrate BAUDRATE
-P PARITY, --parity PARITY
answered Feb 13 at 13:55
s.paszkos.paszko
10010
10010
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500342%2fserial-port-program-to-write-file-read-to-file-from-tty%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You could use
cu
– wurtel
Feb 13 at 10:57