Viewing (monitoring) line status of a serial port












5















Is there a utility software (or an easy method to do it from shell script) to display a serial port's status — i. e. blinking “RXD”, “TXD”, “DCD”, “DTR”, “DSR”, “RTS”, “CTS”? Particularly, I need to monitor whether “DCD” line is set most of the time and momentarily cleared on some interval. The port doesn't need to be sniffed, it's okay to open it exclusively.



In DOS and Windows world, it's usual for terminal emulator and other modem-related software to display pin status, either in GUI or in console applications. However, I couldn't find an alternative even for Linux (although some say it may be possible to examine /proc/tty/driver/serial by hand, if it exists), not to mention FreeBSD, which is my actual target. Common tools like cu and minicom only display port settings at most, not the status.










share|improve this question























  • Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

    – goldilocks
    Dec 7 '14 at 14:33








  • 1





    @goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

    – Anton Samsonov
    Dec 7 '14 at 15:29
















5















Is there a utility software (or an easy method to do it from shell script) to display a serial port's status — i. e. blinking “RXD”, “TXD”, “DCD”, “DTR”, “DSR”, “RTS”, “CTS”? Particularly, I need to monitor whether “DCD” line is set most of the time and momentarily cleared on some interval. The port doesn't need to be sniffed, it's okay to open it exclusively.



In DOS and Windows world, it's usual for terminal emulator and other modem-related software to display pin status, either in GUI or in console applications. However, I couldn't find an alternative even for Linux (although some say it may be possible to examine /proc/tty/driver/serial by hand, if it exists), not to mention FreeBSD, which is my actual target. Common tools like cu and minicom only display port settings at most, not the status.










share|improve this question























  • Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

    – goldilocks
    Dec 7 '14 at 14:33








  • 1





    @goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

    – Anton Samsonov
    Dec 7 '14 at 15:29














5












5








5








Is there a utility software (or an easy method to do it from shell script) to display a serial port's status — i. e. blinking “RXD”, “TXD”, “DCD”, “DTR”, “DSR”, “RTS”, “CTS”? Particularly, I need to monitor whether “DCD” line is set most of the time and momentarily cleared on some interval. The port doesn't need to be sniffed, it's okay to open it exclusively.



In DOS and Windows world, it's usual for terminal emulator and other modem-related software to display pin status, either in GUI or in console applications. However, I couldn't find an alternative even for Linux (although some say it may be possible to examine /proc/tty/driver/serial by hand, if it exists), not to mention FreeBSD, which is my actual target. Common tools like cu and minicom only display port settings at most, not the status.










share|improve this question














Is there a utility software (or an easy method to do it from shell script) to display a serial port's status — i. e. blinking “RXD”, “TXD”, “DCD”, “DTR”, “DSR”, “RTS”, “CTS”? Particularly, I need to monitor whether “DCD” line is set most of the time and momentarily cleared on some interval. The port doesn't need to be sniffed, it's okay to open it exclusively.



In DOS and Windows world, it's usual for terminal emulator and other modem-related software to display pin status, either in GUI or in console applications. However, I couldn't find an alternative even for Linux (although some say it may be possible to examine /proc/tty/driver/serial by hand, if it exists), not to mention FreeBSD, which is my actual target. Common tools like cu and minicom only display port settings at most, not the status.







freebsd serial-port






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 7 '14 at 13:35









Anton SamsonovAnton Samsonov

1978




1978













  • Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

    – goldilocks
    Dec 7 '14 at 14:33








  • 1





    @goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

    – Anton Samsonov
    Dec 7 '14 at 15:29



















  • Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

    – goldilocks
    Dec 7 '14 at 14:33








  • 1





    @goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

    – Anton Samsonov
    Dec 7 '14 at 15:29

















Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

– goldilocks
Dec 7 '14 at 14:33







Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.

– goldilocks
Dec 7 '14 at 14:33






1




1





@goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

– Anton Samsonov
Dec 7 '14 at 15:29





@goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question.

– Anton Samsonov
Dec 7 '14 at 15:29










1 Answer
1






active

oldest

votes


















0














AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.






share|improve this answer


























  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

    – Anton Samsonov
    Jan 4 '15 at 15:50











  • @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

    – plonk
    Jan 5 '15 at 18:03











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f171951%2fviewing-monitoring-line-status-of-a-serial-port%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.






share|improve this answer


























  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

    – Anton Samsonov
    Jan 4 '15 at 15:50











  • @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

    – plonk
    Jan 5 '15 at 18:03
















0














AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.






share|improve this answer


























  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

    – Anton Samsonov
    Jan 4 '15 at 15:50











  • @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

    – plonk
    Jan 5 '15 at 18:03














0












0








0







AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.






share|improve this answer















AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 3 '15 at 1:07

























answered Jan 3 '15 at 0:56









plonkplonk

684




684













  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

    – Anton Samsonov
    Jan 4 '15 at 15:50











  • @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

    – plonk
    Jan 5 '15 at 18:03



















  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

    – Anton Samsonov
    Jan 4 '15 at 15:50











  • @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

    – plonk
    Jan 5 '15 at 18:03

















The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

– Anton Samsonov
Jan 4 '15 at 15:50





The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel).

– Anton Samsonov
Jan 4 '15 at 15:50













@AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

– plonk
Jan 5 '15 at 18:03





@AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.

– plonk
Jan 5 '15 at 18:03


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f171951%2fviewing-monitoring-line-status-of-a-serial-port%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

is 'sed' thread safe

How to make a Squid Proxy server?