aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gsr-global-hotkeys/README.md6
-rw-r--r--tools/gsr-global-hotkeys/keyboard_event.c25
-rw-r--r--tools/gsr-ui-cli/main.c6
3 files changed, 28 insertions, 9 deletions
diff --git a/tools/gsr-global-hotkeys/README.md b/tools/gsr-global-hotkeys/README.md
index 8744107..38585c1 100644
--- a/tools/gsr-global-hotkeys/README.md
+++ b/tools/gsr-global-hotkeys/README.md
@@ -18,4 +18,10 @@ To unbind all keys send `unbind_all<newline>` to the programs stdin, for example
```
unbind_all
+```
+## Exit
+To close gsr-global-hotkeys send `exit<newline>` to the programs stdin, for example:
+```
+exit
+
``` \ No newline at end of file
diff --git a/tools/gsr-global-hotkeys/keyboard_event.c b/tools/gsr-global-hotkeys/keyboard_event.c
index e5221dc..c7a54c3 100644
--- a/tools/gsr-global-hotkeys/keyboard_event.c
+++ b/tools/gsr-global-hotkeys/keyboard_event.c
@@ -404,8 +404,10 @@ static void keyboard_event_remove_event(keyboard_event *self, int index) {
if(index < 0 || index >= self->num_event_polls)
return;
- ioctl(self->event_polls[index].fd, EVIOCGRAB, 0);
- close(self->event_polls[index].fd);
+ if(self->event_polls[index].fd > 0) {
+ ioctl(self->event_polls[index].fd, EVIOCGRAB, 0);
+ close(self->event_polls[index].fd);
+ }
free(self->event_extra_data[index].key_states);
free(self->event_extra_data[index].key_presses_grabbed);
@@ -435,7 +437,7 @@ static int setup_virtual_keyboard_input(const char *name) {
success &= (ioctl(fd, UI_SET_EVBIT, EV_KEY) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_REP) != -1);
success &= (ioctl(fd, UI_SET_EVBIT, EV_REL) != -1);
- success &= (ioctl(fd, UI_SET_EVBIT, EV_LED) != -1);
+ //success &= (ioctl(fd, UI_SET_EVBIT, EV_LED) != -1);
success &= (ioctl(fd, UI_SET_MSCBIT, MSC_SCAN) != -1);
for(int i = 1; i < KEY_MAX; ++i) {
@@ -445,9 +447,9 @@ static int setup_virtual_keyboard_input(const char *name) {
for(int i = 0; i < REL_MAX; ++i) {
success &= (ioctl(fd, UI_SET_RELBIT, i) != -1);
}
- for(int i = 0; i < LED_MAX; ++i) {
- success &= (ioctl(fd, UI_SET_LEDBIT, i) != -1);
- }
+ // for(int i = 0; i < LED_MAX; ++i) {
+ // success &= (ioctl(fd, UI_SET_LEDBIT, i) != -1);
+ // }
// success &= (ioctl(fd, UI_SET_EVBIT, EV_ABS) != -1);
// success &= (ioctl(fd, UI_SET_ABSBIT, ABS_X) != -1);
@@ -566,8 +568,10 @@ void keyboard_event_deinit(keyboard_event *self) {
}
for(int i = 0; i < self->num_event_polls; ++i) {
- ioctl(self->event_polls[i].fd, EVIOCGRAB, 0);
- close(self->event_polls[i].fd);
+ if(self->event_polls[i].fd > 0) {
+ ioctl(self->event_polls[i].fd, EVIOCGRAB, 0);
+ close(self->event_polls[i].fd);
+ }
free(self->event_extra_data[i].key_states);
free(self->event_extra_data[i].key_presses_grabbed);
}
@@ -707,8 +711,11 @@ static void keyboard_event_parse_stdin_command(keyboard_event *self, const char
}
self->num_global_hotkeys = 0;
fprintf(stderr, "Info: unbinded all hotkeys\n");
+ } else if(strncmp(command, "exit", 4) == 0) {
+ self->stdin_failed = true;
+ fprintf(stderr, "Info: received exit command\n");
} else {
- fprintf(stderr, "Warning: got invalid command: \"%s\", expected command to start with either \"bind\" or \"unbind_all\"\n", command);
+ fprintf(stderr, "Warning: got invalid command: \"%s\", expected command to start with either \"bind\", \"unbind_all\" or \"exit\"\n", command);
}
}
diff --git a/tools/gsr-ui-cli/main.c b/tools/gsr-ui-cli/main.c
index c34888c..feb5247 100644
--- a/tools/gsr-ui-cli/main.c
+++ b/tools/gsr-ui-cli/main.c
@@ -56,6 +56,10 @@ static void usage(void) {
printf(" Start/stop replay.\n");
printf(" replay-save\n");
printf(" Save replay.\n");
+ printf(" replay-save-1-min\n");
+ printf(" Save 1 minute replay.\n");
+ printf(" replay-save-10-min\n");
+ printf(" Save 10 minute replay.\n");
printf(" take-screenshot\n");
printf(" Take a screenshot.\n");
printf(" take-screenshot-region\n");
@@ -75,6 +79,8 @@ static bool is_valid_command(const char *command) {
"toggle-stream",
"toggle-replay",
"replay-save",
+ "replay-save-1-min",
+ "replay-save-10-min",
"take-screenshot",
"take-screenshot-region",
NULL