IridiumSBD: Do not allow stopping the driver when the device is used to prevent hardfault

This commit is contained in:
acfloria
2018-04-11 15:15:28 +02:00
committed by Beat Küng
parent d4f703bde8
commit 0e89a6b8bd
2 changed files with 47 additions and 0 deletions
@@ -91,6 +91,11 @@ int IridiumSBD::stop()
return PX4_ERROR;
}
if (IridiumSBD::instance->cdev_used) {
PX4_WARN("device is used. Stop all users (MavLink)");
return PX4_ERROR;
}
PX4_WARN("stopping...");
IridiumSBD::instance->task_should_exit = true;
@@ -922,6 +927,20 @@ void IridiumSBD::publish_telemetry_status()
}
}
int IridiumSBD::open_first(struct file *filep)
{
cdev_used = true;
return CDev::open_first(filep);
}
int IridiumSBD::close_last(struct file *filep)
{
cdev_used = false;
return CDev::close_last(filep);
}
int iridiumsbd_main(int argc, char *argv[])
{
if (!strcmp(argv[1], "start")) {