posix-like ports: unify sigint handler

This commit is contained in:
Matthias Ringwald 2017-01-17 10:30:40 +01:00
parent c08bd42b42
commit b96c8f447a
5 changed files with 28 additions and 17 deletions

View File

@ -75,13 +75,14 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
static void sigint_handler(int param){
UNUSED(param);
#ifndef _WIN32
printf("CTRL-C - SIGINT received, shutting down..\n");
log_info("sigint_handler: shutting down");
// reset anyway
btstack_stdin_reset();
#endif
log_info(" <= SIGINT received, shutting down..\n");
// power down
hci_power_control(HCI_POWER_OFF);
hci_close();
log_info("Good bye, see you.\n");

View File

@ -108,13 +108,15 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
}
static void sigint_handler(int param){
UNUSED(param);
printf("CTRL-C - SIGINT received, shutting down..\n");
log_info("sigint_handler: shutting down");
#ifndef _WIN32
// reset anyway
btstack_stdin_reset();
#endif
log_info(" <= SIGINT received, shutting down..\n");
// power down
hci_power_control(HCI_POWER_OFF);
hci_close();
log_info("Good bye, see you.\n");

View File

@ -79,13 +79,15 @@ static hci_transport_config_uart_t config = {
static btstack_packet_callback_registration_t hci_event_callback_registration;
static void sigint_handler(int param){
UNUSED(param);
printf("CTRL-C - SIGINT received, shutting down..\n");
log_info("sigint_handler: shutting down");
#ifndef _WIN32
// reset anyway
btstack_stdin_reset();
#endif
log_info(" <= SIGINT received, shutting down..\n");
// power down
hci_power_control(HCI_POWER_OFF);
hci_close();
log_info("Good bye, see you.\n");

View File

@ -46,13 +46,17 @@ void hal_led_toggle(void){
}
static void sigint_handler(int param){
UNUSED(param);
// reset even if not setup before
printf("CTRL-C = SIGINT received, shutting down..\n");
log_info("sigint_handler: shutting down");
// reset anyway
btstack_stdin_reset();
log_info(" <= SIGINT received, shutting down..\n");
// hci_power_control(HCI_POWER_OFF);
// hci_close();
// power down
hci_power_control(HCI_POWER_OFF);
hci_close();
log_info("Good bye, see you.\n");
exit(0);
}

View File

@ -72,13 +72,15 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
}
static void sigint_handler(int param){
UNUSED(param);
printf("CTRL-C - SIGINT received, shutting down..\n");
log_info("sigint_handler: shutting down");
#ifndef _WIN32
// reset anyway
btstack_stdin_reset();
#endif
log_info(" <= SIGINT received, shutting down..\n");
// power down
hci_power_control(HCI_POWER_OFF);
hci_close();
log_info("Good bye, see you.\n");