Serial port is slow
I've a cash drawer attached to my system via RJ11 cable in /dev/ttyS4. I'm trying to send an echo command to trigger the cash drawer using:
echo -e "x07" > /dev/ttyS4
I observed that the terminal hangs for around ~ 10-15 seconds and eventually the echo command comes out.
I remember seeing this command worked earlier on the same system.
The following is the serial port settings from dmesg
:
[ 1.424083] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 1.445149] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[ 1.466208] 00:05: ttyS2 at I/O 0x3e8 (irq = 5, base_baud = 115200) is a 16550A
[ 1.487268] 00:06: ttyS3 at I/O 0x2e8 (irq = 10, base_baud = 115200) is a 16550A
[ 1.508361] 00:07: ttyS4 at I/O 0x2f0 (irq = 5, base_baud = 115200) is a 16550A
[ 1.529427] 00:08: ttyS5 at I/O 0x2e0 (irq = 10, base_baud = 115200) is a 16550A
$ sudo stty -F /dev/ttyS4 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 5;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
Has any one faced similar issue ?
Since it worked earlier, could it be due to any changes in the serial port configuration ?
As another test, I wrote a simple serial port C program to send a command to /dev/ttyS4, but even in that case, I found that similar hang happens even in this case.
Could someone please help me to understand what could be the issue behind this ?
command-line serial-port echo
add a comment |
I've a cash drawer attached to my system via RJ11 cable in /dev/ttyS4. I'm trying to send an echo command to trigger the cash drawer using:
echo -e "x07" > /dev/ttyS4
I observed that the terminal hangs for around ~ 10-15 seconds and eventually the echo command comes out.
I remember seeing this command worked earlier on the same system.
The following is the serial port settings from dmesg
:
[ 1.424083] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 1.445149] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[ 1.466208] 00:05: ttyS2 at I/O 0x3e8 (irq = 5, base_baud = 115200) is a 16550A
[ 1.487268] 00:06: ttyS3 at I/O 0x2e8 (irq = 10, base_baud = 115200) is a 16550A
[ 1.508361] 00:07: ttyS4 at I/O 0x2f0 (irq = 5, base_baud = 115200) is a 16550A
[ 1.529427] 00:08: ttyS5 at I/O 0x2e0 (irq = 10, base_baud = 115200) is a 16550A
$ sudo stty -F /dev/ttyS4 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 5;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
Has any one faced similar issue ?
Since it worked earlier, could it be due to any changes in the serial port configuration ?
As another test, I wrote a simple serial port C program to send a command to /dev/ttyS4, but even in that case, I found that similar hang happens even in this case.
Could someone please help me to understand what could be the issue behind this ?
command-line serial-port echo
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago
add a comment |
I've a cash drawer attached to my system via RJ11 cable in /dev/ttyS4. I'm trying to send an echo command to trigger the cash drawer using:
echo -e "x07" > /dev/ttyS4
I observed that the terminal hangs for around ~ 10-15 seconds and eventually the echo command comes out.
I remember seeing this command worked earlier on the same system.
The following is the serial port settings from dmesg
:
[ 1.424083] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 1.445149] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[ 1.466208] 00:05: ttyS2 at I/O 0x3e8 (irq = 5, base_baud = 115200) is a 16550A
[ 1.487268] 00:06: ttyS3 at I/O 0x2e8 (irq = 10, base_baud = 115200) is a 16550A
[ 1.508361] 00:07: ttyS4 at I/O 0x2f0 (irq = 5, base_baud = 115200) is a 16550A
[ 1.529427] 00:08: ttyS5 at I/O 0x2e0 (irq = 10, base_baud = 115200) is a 16550A
$ sudo stty -F /dev/ttyS4 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 5;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
Has any one faced similar issue ?
Since it worked earlier, could it be due to any changes in the serial port configuration ?
As another test, I wrote a simple serial port C program to send a command to /dev/ttyS4, but even in that case, I found that similar hang happens even in this case.
Could someone please help me to understand what could be the issue behind this ?
command-line serial-port echo
I've a cash drawer attached to my system via RJ11 cable in /dev/ttyS4. I'm trying to send an echo command to trigger the cash drawer using:
echo -e "x07" > /dev/ttyS4
I observed that the terminal hangs for around ~ 10-15 seconds and eventually the echo command comes out.
I remember seeing this command worked earlier on the same system.
The following is the serial port settings from dmesg
:
[ 1.424083] 00:03: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[ 1.445149] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
[ 1.466208] 00:05: ttyS2 at I/O 0x3e8 (irq = 5, base_baud = 115200) is a 16550A
[ 1.487268] 00:06: ttyS3 at I/O 0x2e8 (irq = 10, base_baud = 115200) is a 16550A
[ 1.508361] 00:07: ttyS4 at I/O 0x2f0 (irq = 5, base_baud = 115200) is a 16550A
[ 1.529427] 00:08: ttyS5 at I/O 0x2e0 (irq = 10, base_baud = 115200) is a 16550A
$ sudo stty -F /dev/ttyS4 -a
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 5;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts
ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke -flusho -extproc
Has any one faced similar issue ?
Since it worked earlier, could it be due to any changes in the serial port configuration ?
As another test, I wrote a simple serial port C program to send a command to /dev/ttyS4, but even in that case, I found that similar hang happens even in this case.
Could someone please help me to understand what could be the issue behind this ?
command-line serial-port echo
command-line serial-port echo
edited yesterday
wjandrea
8,79042260
8,79042260
asked yesterday
Narayanan krishnamurthyNarayanan krishnamurthy
1
1
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago
add a comment |
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1115824%2fserial-port-is-slow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1115824%2fserial-port-is-slow%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
Can you find out on which call the C program takes so much time? open, write, something else?
– Eelke
yesterday
When I ran strace on the c program, it was getting delayed on close(). So, when I commented close(), the delay was noticed on exit_group(0) of strace during program exit.
– Narayanan krishnamurthy
yesterday
Does it actually take long for the drawer to open or does it open directly? If it opens quickly it might be a problem with the cashdrawer controller not detecting the drawer opened.
– Eelke
23 hours ago
As a surprise, the echo command works when the cash drawer cable connected to the port is tightly held. Could this be an issue with the cable ? But, I would like to understand if the issue is due to the cable, then why should the echo command hang for sometime ?
– Narayanan krishnamurthy
1 hour ago