-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add handling of SIGUSR1 / SIGUSR2 to open / close port
SIGUSR1 = open port SIGUSR2 = close port
- Loading branch information
Showing
7 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <gtk/gtk.h> | ||
#include "interface.h" | ||
|
||
static gboolean handle_usr1(gpointer user_data) | ||
{ | ||
interface_open_port(); | ||
return G_SOURCE_CONTINUE; | ||
} | ||
|
||
static gboolean handle_usr2(gpointer user_data) | ||
{ | ||
interface_close_port(); | ||
return G_SOURCE_CONTINUE; | ||
} | ||
|
||
void user_signals_catch(void) | ||
{ | ||
g_unix_signal_add(SIGUSR1, (GSourceFunc) handle_usr1, NULL); | ||
g_unix_signal_add(SIGUSR2, (GSourceFunc) handle_usr2, NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/***********************************************************************/ | ||
/* device_mintor.h */ | ||
/* --------- */ | ||
/* GTKTerm Software */ | ||
/* (c) Julien Schmitt */ | ||
/* */ | ||
/* ------------------------------------------------------------------- */ | ||
/* */ | ||
/* Purpose */ | ||
/* React to SIGUSR signals (for scriptability) */ | ||
/* */ | ||
/***********************************************************************/ | ||
|
||
#ifndef _USER_SIGNALS | ||
#define _USER_SIGNALS | ||
|
||
void user_signals_catch(void); | ||
|
||
#endif |