Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PySerial: How to send Ctrl-C command on the serial line

I'm automating a configuration process for an embedded board. To enter the setup screen I need to send "Ctrl-C" command.

This is NOT to interrupt a process I'm running locally, KeyboardInterrupt will not work. I need to send a value that will be interpreted by the bootloader as Ctrl-C.

What is the value I need to send?

Thank you

like image 814
Misha M Avatar asked Aug 10 '11 21:08

Misha M


Video Answer


2 Answers

IIRC, Ctrl-C is etx. Thus send \x03.

like image 79
J.J. Avatar answered Oct 01 '22 01:10

J.J.


You should send a character with the ASCII code 3:

serial.write('\x03')
like image 33
Remy Blank Avatar answered Oct 01 '22 03:10

Remy Blank