aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/gsr-global-hotkeys/hotplug.c3
-rw-r--r--tools/gsr-ui-cli/main.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/tools/gsr-global-hotkeys/hotplug.c b/tools/gsr-global-hotkeys/hotplug.c
index 5ea2978..2e8ca9f 100644
--- a/tools/gsr-global-hotkeys/hotplug.c
+++ b/tools/gsr-global-hotkeys/hotplug.c
@@ -65,9 +65,10 @@ static void hotplug_event_parse_netlink_data(hotplug_event *self, const char *li
/* Netlink uevent structure is documented here: https://web.archive.org/web/20160127215232/https://www.kernel.org/doc/pending/hotplug.txt */
void hotplug_event_process_event_data(hotplug_event *self, int fd, hotplug_device_added_callback callback, void *userdata) {
- const int bytes_read = read(fd, self->event_data, sizeof(self->event_data));
+ const int bytes_read = read(fd, self->event_data, sizeof(self->event_data) - 1);
if(bytes_read <= 0)
return;
+ self->event_data[bytes_read] = '\0';
/* Hotplug data ends with a newline and a null terminator */
int data_index = 0;
diff --git a/tools/gsr-ui-cli/main.c b/tools/gsr-ui-cli/main.c
index bcb5c81..9f1eb03 100644
--- a/tools/gsr-ui-cli/main.c
+++ b/tools/gsr-ui-cli/main.c
@@ -50,6 +50,7 @@ static void usage(void) {
printf(" toggle-stream Start/stop streaming.\n");
printf(" toggle-replay Start/stop replay.\n");
printf(" replay-save Save replay.\n");
+ printf(" take-screenshot Take a screenshot.\n");
printf("\n");
printf("EXAMPLES:\n");
printf(" gsr-ui-cli toggle-show\n");
@@ -65,6 +66,7 @@ static bool is_valid_command(const char *command) {
"toggle-stream",
"toggle-replay",
"replay-save",
+ "take-screenshot",
NULL
};