6

I have installed minicom through the following command:

sudo apt-get minicom

I am connected with the HP 5130 switch through a USB to Serial Console Cable. The name of my serial port is /dev/ttyUSB0 according to following command:

dmesg | grep tty
[    0.000000] console [tty0] enabled
[49689.082419] usb 3-2: pl2303 converter now attached to ttyUSB0

Extra check:

ls -l /dev/ttyUSB0 

If I unplug the USB cable, I get following error:

ls: cannot access /dev/ttyUSB0: No such file or directory

So I assume its correct that ttyUSB0 is the right port

I edited the settings of minicom as following:

+-----------------------------------------------------------------------+   
| A -    Serial Device      : /dev/ttyUSB0                              |   
| B - Lockfile Location     : /var/lock                                 |   
| C -   Callin Program      :                                           |   
| D -  Callout Program      :                                           |   
| E -    Bps/Par/Bits       : 9600 8N1                                  |   
| F - Hardware Flow Control : Yes                                       |   
| G - Software Flow Control : No                                        |   
|                                                                       |   
|    Change which setting?                                              |   
+-----------------------------------------------------------------------+   

and started minicom

However, I don't get any output except this:

Welcome to minicom 2.7

OPTIONS: I18n 
Compiled on Jan  1 2014, 17:13:22.
Port /dev/ttyUSB0, 15:02:26

Press CTRL-A Z for help on special keys

CTRL-A Z for help | 9600 8N1 | NOR | Minicom 2.7 | VT102 | Offline | ttyUSB0            

I think the problem lies in the offline status?

Noosrep
  • 2,184

3 Answers3

3

See this part ...

F - Hardware Flow Control : Yes

Change it to "No" (or off ... whatever) and restart minicom.

0

When you unplug and re-plug USB in the device is changed to /dev/ttyUSB1 or /dev/ttyUSB2 depends on how many time you re-plug the USB. Try connect with another device.

From error ls: cannot access /dev/ttyUSB0: No such file or directory I believe that the terminal controller is changed to /dev/ttyUSBX when you re-plug the USB.

eetsurt
  • 158
0

Just ls /dev/ttyUSB* and then sudo minicom -D /dev/ttyUSBx

You can also use my shell script that openw all of your minicom in new terminals:

#!/bin/bash  

open_minicom(){
PORT_IP=2
PORT_IP=$((PORT_IP+$1))
gnome-terminal -t "Minicom port $1 - 192.168.1.$PORT_IP" -x ./tmp_script"$1".sh
#./minicom_PORT.sh "$PORT_NUM"
}

generate_script(){
echo "$1"
PORT_NUM="$1"
PORT_IP=2
PORT_IP=$((PORT_IP+$1))
#gconftool-2 --set /apps/gnome-terminal/profiles/Default/title --type=string "Minicom port $PORT_NUM"
#############################generat script
touch tmp_script"$1".sh
chmod 777 tmp_script"$1".sh
cat <<EOT >> tmp_script"$1".sh
#!/usr/bin/expect -f
spawn sudo minicom -D /dev/ttyUSB$PORT_NUM -S set_ip"$PORT_IP".sh
expect {
-re ".*sword.*" {
    exp_send "$pass\r"
}
}
interact
EOT
###############################
#open terminal
}

generate_eth(){
PORT_IP=2
PORT_IP=$((PORT_IP+$1))
touch set_ip"$PORT_IP".sh
chmod 777 set_ip"$PORT_IP".sh
cat <<EOT >> set_ip"$PORT_IP".sh
#!/bin/bash
ifconfig eth0 192.168.1.$PORT_IP down up
EOT
}

MY_distractor(){
rm tmp_script*.sh set_ip*.sh
}


#printf "\n$NUM_OF_PORTS\n"
##############################
#             MAIN           #
##############################
NUM_OF_PORTS="$(ls /dev/ttyUSB* | grep -v ^l | wc -l)"
if [ $# -eq 0 ]
  then
    printf "No password arguments supplied\n Plase run ./your_script password \n Exiting......\n" && exit 1;
else
    pass="$1"
fi
if [ "$NUM_OF_PORTS" == "0" ]; then
    printf "Not found any minicom ports\n Exiting......\n" && exit 1;
fi
for (( i=0; i < $NUM_OF_PORTS ; i++ ))
do
    generate_script "$i"
done
echo "$(ls tmp_script*.sh)"
for (( i=0; i < $NUM_OF_PORTS ; i++ ))
do
    generate_eth "$i"
done

for (( i=0; i < $NUM_OF_PORTS ; i++ ))
do
    open_minicom "$i"
done
sleep 1

MY_distractor
karel
  • 122,292
  • 133
  • 301
  • 332