![]() ![]() ![]() # * "isig intr ^Q" will make Ctrl+Q send SIGINT to this script # * "quit undef susp undef" will disable Ctrl+\ and Ctrl+Z handling Stty -F "$port" raw -echo Set current terminal to pass through everything except Ctrl+Q # Set up serial port, append all remaining parameters from command line # Remove serial port from parameter list, so only stty settings remain Trap 'set +e kill "$bgPid" stty "$original_settings"' EXIT # Kill background process and restore terminal when this shell exits ![]() # Save settings of current terminal to restore later Just put the following code into a file /usr/local/bin/femtocom (or any other place in $PATH) and do chmod +x /usr/local/bin/femtocom.įrom there on you can connect to any serial port like this for example: femtocom /dev/ttyUSB0 57600 This enables you to use Ctrl+C or Ctrl+Z on the remote host, and to use interactive "GUI" programs like aptitude or alsamixer. This script is based on another answer, but sends everything over the serial port (except Ctrl+Q), not just single commands followed by Enter. You can also use a tool like setserial to set up the port and then interact with it directly from the shell. The most basic program that I know that does this is picocom. Minimal serial communicationīasically, two things are needed to have two-way communication through a serial port: 1) configuring the serial port, and 2) opening the pseudo-tty read-write. Run stty again after using minicom, and you'll notice the settings are set to what the program was using. In this situation, sending the commands cat or echo to the port will either produce garbage or not work at all. These are probably different than what you will need to make your connection. ![]() If you have done it right after booting the computer and before running any other program like minicom, the communication settings will be at their default settings. You can query the communication settings using the stty program like this: stty < /dev/ttyS0 Notice that once you run a program like minicom, the port is left with the settings that minicom used. If it weren't set up appropriately, the cat and echo commands would not do for you what you might have expected. To exit Minicom when in terminal mode press ‘Ctrl-A’ to get a message bar at the bottom of the terminal window and then press ‘X’.The main reason why you need any program like minicom to communicate over a serial port is that the port needs to be set up prior to initiating a connection. Connect to you Switch console ~]# minicomĪMSSW1002 login: 6. Minicom: WARNING: configuration file not found, using defaultsĥ. dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3 4. dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4 Set serial ports ~]# setserial -g /dev/ttyS Check your Serial connection details ~]# dmesg | grep tty This system is receiving updates from RHN Classic or RHN Satellite. Loaded plugins: product-id, rhnplugin, search-disabled-repos, security, subscription. Install minicom ~]# yum install minicom -y Here I am explaining how to configure minicom in linux for a console connection to Cisco Nexus 5K switch. Usually we use any console connection utilities like putty, minicom, RealTerm or cu. Those who work with infrastructure/server deployment knows how difficult it is to get a console for those devices having no display like switches, routers and a blade chassis/enclosure. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |