aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends/evdev.c
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2020-01-12 17:34:14 +0100
committercbdev <cb@cbcdn.com>2020-01-12 17:34:14 +0100
commit78b21a9ac3f975f35ec7b61108531e1495eb91c0 (patch)
treef41cfc78f3392d501293c3afdd7b42111c863615 /backends/evdev.c
parent0a696be5af7db63c1c7354518c839d8543f1ba25 (diff)
downloadmidimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.tar.gz
midimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.tar.bz2
midimonster-78b21a9ac3f975f35ec7b61108531e1495eb91c0.zip
Rework instance creation
Diffstat (limited to 'backends/evdev.c')
-rw-r--r--backends/evdev.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/backends/evdev.c b/backends/evdev.c
index 4725ef7..af5ec74 100644
--- a/backends/evdev.c
+++ b/backends/evdev.c
@@ -63,16 +63,11 @@ static int evdev_configure(char* option, char* value) {
return 1;
}
-static instance* evdev_instance(){
- instance* inst = mm_instance();
- if(!inst){
- return NULL;
- }
-
+static int evdev_instance(instance* inst){
evdev_instance_data* data = calloc(1, sizeof(evdev_instance_data));
if(!data){
LOG("Failed to allocate memory");
- return NULL;
+ return 1;
}
data->input_fd = -1;
@@ -81,12 +76,12 @@ static instance* evdev_instance(){
if(!data->output_proto){
LOG("Failed to initialize libevdev output prototype device");
free(data);
- return NULL;
+ return 1;
}
#endif
inst->impl = data;
- return inst;
+ return 0;
}
static int evdev_attach(instance* inst, evdev_instance_data* data, char* node){