LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 01-15-2009, 04:34 AM   #1
golden_boy615
Member
 
Registered: Dec 2008
Distribution: Ubuntu Fedora
Posts: 445

Rep: Reputation: 18
sending control-Z to serial port


hello every body
I wrote a program for my serial port for acting like minicom (but very simple) and I wanted to communicate to a gprs modem that I connected it to my serial port. every thing is good and I can send any command and receive its answer and action except control-Z and that is neccesery for me to sending sms via gprs modem, first of all I ignored SIGTSTP in my program for preventing it to stop but it does not work then I wrote function to send 26 (I think code of control+Z)to serial port that it does not work again.
what can I do
please help me.

this is the signal handler and my fuction in my program:
signal(SIGTSTP,ctrlz);

void ctrlz()
{
char ch[2]="26";
SerialOpen( port);
SerialSetSpeed( port, speed);
SerialWrite( port, &ch, 2);
}
 
Old 01-21-2009, 04:42 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
It should rather be
Quote:
Originally Posted by golden_boy615 View Post
void ctrlz()
{
char ch;
ch = 26;
SerialOpen( port);
SerialSetSpeed( port, speed);
SerialWrite( port, &ch, 1);
}
It's decimal 26 instead of two characters '2' and '6'.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem installing rxtx for serial port control rastavideo Linux - Software 1 01-17-2008 09:29 PM
Sending files over serial port. Fadoksi Linux - General 2 08-01-2007 08:36 AM
Sending and receiving data to through Serial Port kalyan.penujeevi Programming 1 08-07-2006 07:55 AM
serial port (ttyS1) - Sending commands via terminal... HELP!!! Nalorin Linux - Networking 2 08-21-2005 10:22 PM
shell script: sending data through the serial port funkymunky Programming 2 06-09-2004 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration