Well during this time I found some ways to solve more or less all problems for now, tho some solutions are just nasty workarounds, so maybe on them you can offer some other possible solutions.
Over all there was two issues, signals firing while other signal is being handled, that messed up with "private" variables (using privates in handle_RX_header() and handle_RX_payload() was one of stupidest things I have done) also because of that some data was mixed of overwritten in buffer. And other issue was that Unix was converting '0x0D' to '0x0A' so on some CRC's I have failed to detect message header.
1st problem solved by:
2nd problem solved by:
Now for 1st issue would be nice to know how can I stop signal generation when I need and continue it again, don't really like stopping signals with mutexes. Way better solution would be stop their generation during handling.
For second - maybe I missed something and with current setup serial still be making changes to received data. Or maybe there is other way to open or set up serial port that UNIX WOULD NOT CHANGE ANY INCOMING OR OUTGOING DATA.
to migurus:
sorry seems I can't reply yet - not enough post writen, so will reply here:
"***" in code means code parts specific to data analyse, basically data checking, FSM and other code parts which just analyses data stream prints log and passes info to main program.
For ACK part my protocol specification is that no ACK to garbage, so if I miss some data I miss message and consider it as garbage.
In rd_serial the /dev/ttyO2 is hardcoded just temporary, since at the given moment I'm using only this port.
AIX 4.3.3
I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals:
#! /bin/ksh
SIGTERM=15
SIGINT=2... (2 Replies)
hi
i am using solaris 9 on sparc .
i was wondering if there was a command to control my serial interface , as to send a signal periodically every interval of time to the input of a 555 timer .
thanks for your help .... (0 Replies)
Hi,
I have an c++ application which uses the function fork and execvp().
The parent does not wait until the child ends. The parents just creates children and let them do their stuff.
You can see the parent program as a batch-manager.
I have added a SIGCHLD handler to the program:
void... (3 Replies)
Hey guys,
I am trying to write a little shell, and was writing a signal handler to handle SIGINT (I am using 'stty intr ^C' and using ctrl-C to give SIGINT).
I wrote this signal handler: void handle_sigint()
{
write(2,"handling sigint\n",16);
write(1,"\nshell% ",8);
}
... (4 Replies)
I have written a program to demonstrate a problem I have encountered when using BSD style asynchronous input using the O_ASYNC flag in conjunction with a real time interval timer sending regular SIGALRM signals to the program. The SIGIO handler obeys all safe practices, using only an atomic update... (8 Replies)
I have a problem with signal handlers not working.
I have a long 1000 line code and somehow this code for signal handling is not working:
$SIG{INT} = \&interrupt;
sub interrupt {
print STDERR "Caught a control c!\n";
exit; # or just about anything else you'd want to do
}
Any... (2 Replies)
Hello,
I have develop a driver for my hardware and now, I need to handle a IRQ but I does not work.
As I can understand, to handle a irq, it is necessary to make a request_irq(). If the return value is zero, ok, no problem to handle irq.
Here is a easy example of my driver:
#include... (8 Replies)
Hi,
I have a problem with signal handler algorithm in linux. My code is hanging ( It is continuously looping inside the signal handler) . I am pasting my code here...
Please provide me some help regarding this. I googled many places and wrote this code.. but doesnt seem to be working without... (6 Replies)
I was working on some Perl code that does signal handling and I came across this one liner and wasn't sure what it was doing.
local $SIG{__DIE__} = sub {$! = 2; die $_;};
I think the first part of the anonymous subroutine is setting $! to 2, but I am not sure what the second part is doing. ... (1 Reply)