aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-01-16 11:43:10 +0100
committercbdev <cb@cbcdn.com>2021-01-16 11:43:10 +0100
commitb199f019b47829f3745e8af8e62ed1ac4e65acf9 (patch)
tree43bdc3f1e6b7e9559c21d33692053330f90edbda
parent71d86ec46259ce1b5488989ec30152c7cf810a8e (diff)
downloadmidimonster-b199f019b47829f3745e8af8e62ed1ac4e65acf9.tar.gz
midimonster-b199f019b47829f3745e8af8e62ed1ac4e65acf9.tar.bz2
midimonster-b199f019b47829f3745e8af8e62ed1ac4e65acf9.zip
Exit when losing evdev connection
-rw-r--r--backends/evdev.c9
-rw-r--r--backends/evdev.md2
2 files changed, 9 insertions, 2 deletions
diff --git a/backends/evdev.c b/backends/evdev.c
index 4c734f9..3dbf837 100644
--- a/backends/evdev.c
+++ b/backends/evdev.c
@@ -367,7 +367,9 @@ static int evdev_handle(size_t num, managed_fd* fds){
data = (evdev_instance_data*) inst->impl;
- for(read_status = libevdev_next_event(data->input_ev, read_flags, &ev); read_status >= 0; read_status = libevdev_next_event(data->input_ev, read_flags, &ev)){
+ for(read_status = libevdev_next_event(data->input_ev, read_flags, &ev);
+ read_status == LIBEVDEV_READ_STATUS_SUCCESS || read_status == LIBEVDEV_READ_STATUS_SYNC;
+ read_status = libevdev_next_event(data->input_ev, read_flags, &ev)){
read_flags = LIBEVDEV_READ_FLAG_NORMAL;
if(read_status == LIBEVDEV_READ_STATUS_SYNC){
read_flags = LIBEVDEV_READ_FLAG_SYNC;
@@ -383,6 +385,11 @@ static int evdev_handle(size_t num, managed_fd* fds){
return 1;
}
}
+
+ if(read_status != -EAGAIN){
+ LOGPF("Failed to handle events: %s\n", strerror(-read_status));
+ return 1;
+ }
}
return 0;
diff --git a/backends/evdev.md b/backends/evdev.md
index d57201d..bf192b0 100644
--- a/backends/evdev.md
+++ b/backends/evdev.md
@@ -16,7 +16,7 @@ This functionality may require elevated privileges (such as special group member
| Option | Example value | Default value | Description |
|---------------|-----------------------|---------------|-------------------------------------------------------|
| `device` | `/dev/input/event1` | none | `evdev` device to use as input device |
-| `input` | `Xbox Wireless` | none | Presentation name of evdev device to use as input (prefix-matched) |
+| `input` | `Xbox Wireless` | none | Presentation name of evdev device to use as input (prefix-matched), can be used instead of the `device` option |
| `output` | `My Input Device` | none | Output device presentation name. Setting this option enables the instance for output |
| `exclusive` | `1` | `0` | Prevent other processes from using the device |
| `id` | `0x1 0x2 0x3` | none | Set output device bus identification (Vendor, Product and Version), optional |