09-08-2021 01:36 AM
Hi,
I'm using Cisco 5915 (C5915-ENTBASE-M, v.15.6) over serial port with a linux machine. I am in trouble in terminal while answering router questions with an application which uses serial port.
When I want to pass into EXEC mode over serial terminal via SSH:
router>enable (press enter) Password: 1234 (press enter) router# |
This is OK.
But when I wanted to do this with an application using serial port in canonical mode:
read()=> "router>" write("enable\r"); ***Here it is waiting about 30 sec*** read()=> "Password:" read()=> "% Password: timeout expired" |
So, I can not catch "Password:" prompt in time. I think, when router wants to ask a question, it does not send a carriage return. That means read block does not include a carriage return and I can not read serial port because of usage of serial port in canonical mode. Also, I configured serial port for '\r' character beside of '\n'.
Do you have any idea about this issue ?
09-14-2021 09:36 AM
Hello embeddedman. Can you provide more information on the configuration on the serial connection?
09-14-2021 10:26 PM
Hi CEE95,
Basic configuration is
c_lflag = ICANON;
c_oflag = OPOST;
c_iflag = ICRNL;
memset(c_cc, 0, NCSS);
c_cc[VEOL] = '\r';
But I think, problem is CISCO does not send any EOL character. So, I can not catch anything while it prompting a question. I guess, I need to use serial port in incanonical mode ?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide