mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
AP_HAL_Linux: RPI: set signal handler iff nobody has already done it before
This commit is contained in:
parent
5e8edcb1db
commit
8d2b587f71
@ -378,10 +378,14 @@ void RCInput_RPI::set_sigaction()
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < NSIG; i++) {
|
for (int i = 0; i < NSIG; i++) {
|
||||||
//catch all signals (like ctrl+c, ctrl+z, ...) to ensure DMA is disabled
|
//catch all signals (like ctrl+c, ctrl+z, ...) to ensure DMA is disabled
|
||||||
struct sigaction sa;
|
struct sigaction sa, sa_old;
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sa_handler = RCInput_RPI::termination_handler;
|
sigaction(i, nullptr, &sa_old);
|
||||||
sigaction(i, &sa, NULL);
|
|
||||||
|
if (sa_old.sa_handler == nullptr) {
|
||||||
|
sa.sa_handler = RCInput_RPI::termination_handler;
|
||||||
|
sigaction(i, &sa, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user