aboutsummaryrefslogtreecommitdiff
path: root/tools/gsr-global-hotkeys/hotplug.h
blob: 665485ad53d3a5ebc5a510ff4e3e7392179009e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef HOTPLUG_H
#define HOTPLUG_H

/* C stdlib */
#include <stdbool.h>

typedef struct {
    int fd;
    bool event_is_add;
    bool subsystem_is_input;
    char event_data[1024];
} hotplug_event;

typedef void (*hotplug_device_added_callback)(const char *devname, void *userdata);

bool hotplug_event_init(hotplug_event *self);
void hotplug_event_deinit(hotplug_event *self);

int hotplug_event_steal_fd(hotplug_event *self);
void hotplug_event_process_event_data(hotplug_event *self, int fd, hotplug_device_added_callback callback, void *userdata);

#endif /* HOTPLUG_H */