I am working on establishing user communication (one may say a basic UI) from the user's PC to my Raspberry Pi, where the RPI would accept pre-defined commands from the user via uART and then process them in a python script with pySerial and then return results to the user via uART again. I would also like the user to not be able to access the shell of the RPI itself. Kernel notifications are also fine, but if there is a way for those to not be shown would also be better, as it would make the whole thing much cleaner.

Is there a way to modify what is shown to the user in the uART in such a way?

Of course, I am connecting to the RPI with a dongle connected to the GPIO Tx and Rx pins. I am running Raspbian 9 (stretch) on the RPi and Ubuntu 16.04.3 LTS on my PC.

Another question somewhat related to this is, is there a way to know with pySerial whether there is a device on the other end of the uART connection? I can't seem to find much in the docs and isOpen() doesn't help much.

  • I VTC this question because the OP was not happy with the provided answer but didn't provide any clarifications as to what is the exact problem. Nov 25 '21 at 10:51

If you disable the use of the UART as a console you can use it in any way you please. There is an option in raspi-config for this purpose (sudo raspi-config).

Since you now control the UART it is up to you to handle all bytes sent and received. You can also implement a "ping" command to check if the other side is "up".

  • When I disable the use of the UART I don't get anything coming out on the PC end, it's like it's not connected anymore and the connection is entirely closed. This is not what I need. I need the connection to stay open but to filter what comes out on the PC side. What would I be "pinging" in this context exactly? I tried writing and then reading with pyserial but that didn't do much obviously as for some reason the serial.Serial() is still made even though there is no device on the other end...
    – sigmasrb
    Feb 15 '18 at 13:56
  • Maybe a better question would be: How to accept user input via uART even though the console is disabled? To correct the previous one, the ser.write() from RPI to PC still shows in the uART.
    – sigmasrb
    Feb 15 '18 at 14:05
  • 2
    If you have not asked the question you intended to ask YOU need to edit your question and clarify what you are asking. People don't like wasting time answering the wrong question.
    – joan
    Feb 15 '18 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.