mirror of https://gerrit.osmocom.org/simtrace2
simtrace2-remsim: Instruct SAM3S to simulate card removal on SIGINT
When stopping the program, we inform the card simulator to indicate a card removal to the GSM phone/modem.
This commit is contained in:
parent
cf1c19abe0
commit
1871c25b6d
|
@ -22,6 +22,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
#define _GNU_SOURCE
|
||||
#include <getopt.h>
|
||||
|
@ -384,6 +385,18 @@ static void run_mainloop(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void signal_handler(int signal)
|
||||
{
|
||||
switch (signal) {
|
||||
case SIGINT:
|
||||
request_card_insert(false);
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *gsmtap_host = "127.0.0.1";
|
||||
|
@ -473,6 +486,8 @@ int main(int argc, char **argv)
|
|||
goto close_exit;
|
||||
}
|
||||
|
||||
signal(SIGINT, &signal_handler);
|
||||
|
||||
do {
|
||||
if (g_udp_fd < 0) {
|
||||
g_devh = libusb_open_device_with_vid_pid(NULL, SIMTRACE_USB_VENDOR, SIMTRACE_USB_PRODUCT);
|
||||
|
|
Loading…
Reference in New Issue