Coder Social home page Coder Social logo

phantompacket / rpi-serial-console Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lurch/rpi-serial-console

0.0 1.0 0.0 142 KB

Simple script to easily enable & disable the Raspberry Pi's serial console

License: MIT License

Shell 100.00%

rpi-serial-console's Introduction

rpi-serial-console

Simple script to easily enable & disable the Raspberry Pi's serial console. Disabling the serial console is required if you want to use the Raspberry Pi's serial port (UART) to talk to other devices e.g. microcontrollers (see http://elinux.org/RPi_Serial_Connection for more information).

Note that this script is now partially redundant, as the latest versions of raspi-config feature something quite similar already built in.

Installation

To install rpi-serial-console, simply run:

sudo wget https://raw.githubusercontent.com/lurch/rpi-serial-console/master/rpi-serial-console -O /usr/bin/rpi-serial-console && sudo chmod +x /usr/bin/rpi-serial-console

Usage

To display whether the serial console is currently enabled or not, simply run:

rpi-serial-console status

To enable the serial console, simply run:

sudo rpi-serial-console enable

To disable the serial console, simply run:

sudo rpi-serial-console disable

What could be easier than that?! ;-) After enabling or disabling the serial console you'll need to reboot Linux for it to take effect.

Behind the scenes it automatically edits both /boot/cmdline.txt and /etc/inittab, adding or removing the ttyAMA0 options as necessary. The very first time you run rpi-serial-console it automatically creates backup copies of these files with a .bak extension.

Troubleshooting

If rpi-serial-console detects that the serial console is enabled in /boot/cmdline.txt but disabled in /etc/inittab (or vice-versa) then it'll tell you and refuse to do anything. After manually correcting the problem, then rpi-serial-console should run fine again.

This script has only been tested on Raspbian, so please file an issue if it doesn't work on your distro of choice.

Advanced Usage

When enabling the serial console, rpi-serial-console will set it by default to a baud rate of 115200. But if for some reason you want to change the baud rate the serial console uses, you can supply this as a second argument. For example to set the serial console to a baudrate of 57600, you'd use:

sudo rpi-serial-console enable 57600

and then reboot. If the serial console is already enabled, and you want to change the baud rate, then simply use rpi-serial-console to disable it, enable it at the new baud rate, and then reboot.

rpi-serial-console's People

Contributors

lurch avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.