Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send Ctrl+Z to serial port via command line

I am trying to send the following to the COM1 serial port via command line using ECHO or similar (I've also tried downloading a small program called serialsend, but I am stuck with how to send the equivalent of CTRL+Z. This is to send a SMS message via a Siemens TC35 GAM module. I am able to do it via Hyperterminal as a test and it works fine, but I cannot figure out how to send the CTRL+Z at the end to confirm the ned of the message.

This is what I have:

AT

AT+CMGF=1

AT+CMSG="+xxxxxxxxxxx"

HELLO

Now, after Hello, which is the message I want to send, I have to send CTRL+Z. But cannot figure out how to do it, I have tried this:

AT

AT+CMGF=1

AT+CMSG="+xxxxxxxxxxx"

HELLO

\x1A

As I read somehwere that this would be the equivalent of doing it, but it hasnt worked.

Can anyone help me with this? I have found solutions, but they are not command line, which is what I need.

I have also tried using this format:

ECHO AT > COM1:

But as I don't know how to send CTRL+Z I don't know if it is working.

like image 410
omega1 Avatar asked Jul 19 '12 14:07

omega1


1 Answers

I wrote the free command line program SerialSend that you mentioned. Since this question was originally posted, I've added an extra feature that allows arbitrary byte values to be included (in hex format) in the text you're sending via the serial port. For example, to send Ctrl-Z (26 decimal, 0x1A hex), just use the following command:

SerialSend /hex "\x1a"

Port name/number, baudrate, etc can be configured with additional command line arguments. For example,

SerialSend /baudrate 9600 /devnum 2 /hex "\x1a"

For more details, see the SerialSend home page.

Hope that helps!

Ted

like image 100
user2317447 Avatar answered Oct 02 '22 23:10

user2317447