mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
committed by
Peter Hutterer
parent
d990e3f027
commit
376adfdf2a
@@ -39,6 +39,7 @@
|
||||
#include "libratbag-util.h"
|
||||
|
||||
struct ratbagd_button {
|
||||
struct ratbagd_device *device;
|
||||
struct ratbag_button *lib_button;
|
||||
unsigned int index;
|
||||
char *path;
|
||||
@@ -112,7 +113,7 @@ static int ratbagd_button_set_button(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ratbagd_button_get_special(sd_bus *bus,
|
||||
@@ -164,7 +165,7 @@ static int ratbagd_button_set_special(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct ratbag_button_macro *, ratbag_button_macro_unref);
|
||||
@@ -337,8 +338,14 @@ static int ratbagd_button_disable(sd_bus_message *m,
|
||||
return r;
|
||||
|
||||
r = ratbag_button_disable(button->lib_button);
|
||||
if (r < 0) {
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
r = ratbagd_device_resync(button->device, bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return sd_bus_reply_method_return(m, "u", r);
|
||||
return sd_bus_reply_method_return(m, "u", 0);
|
||||
}
|
||||
|
||||
const sd_bus_vtable ratbagd_button_vtable[] = {
|
||||
@@ -378,6 +385,7 @@ int ratbagd_button_new(struct ratbagd_button **out,
|
||||
assert(lib_button);
|
||||
|
||||
button = zalloc(sizeof(*button));
|
||||
button->device = device;
|
||||
button->lib_button = lib_button;
|
||||
button->index = index;
|
||||
|
||||
|
||||
@@ -221,8 +221,14 @@ static int ratbagd_device_commit(sd_bus_message *m,
|
||||
int r;
|
||||
|
||||
r = ratbag_device_commit(device->lib_device);
|
||||
if (r < 0) {
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
r = ratbagd_device_resync(device, bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return sd_bus_reply_method_return(m, "u", r);
|
||||
return sd_bus_reply_method_return(m, "u", 0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -81,7 +81,7 @@ static int ratbagd_led_set_mode(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ratbagd_led_get_type(sd_bus *bus,
|
||||
@@ -145,7 +145,7 @@ static int ratbagd_led_set_color(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ratbagd_led_get_effect_rate(sd_bus *bus,
|
||||
@@ -193,7 +193,7 @@ static int ratbagd_led_set_effect_rate(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ratbagd_led_get_brightness(sd_bus *bus,
|
||||
@@ -241,7 +241,7 @@ static int ratbagd_led_set_brightness(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const sd_bus_vtable ratbagd_led_vtable[] = {
|
||||
|
||||
@@ -291,8 +291,12 @@ static int ratbagd_profile_set_active(sd_bus_message *m,
|
||||
return r;
|
||||
|
||||
r = ratbag_profile_set_active(profile->lib_profile);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r < 0) {
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
r = ratbagd_device_resync(profile->device, bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
ratbagd_for_each_profile_signal(sd_bus_message_get_bus(m),
|
||||
profile->device,
|
||||
@@ -328,7 +332,7 @@ ratbagd_profile_set_enabled(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "libratbag-util.h"
|
||||
|
||||
struct ratbagd_resolution {
|
||||
struct ratbagd_device *device;
|
||||
struct ratbagd_profile *profile;
|
||||
struct ratbag_resolution *lib_resolution;
|
||||
unsigned int index;
|
||||
@@ -76,7 +77,7 @@ ratbagd_resolution_set_report_rate(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ratbagd_resolution_active_signal_cb(sd_bus *bus,
|
||||
@@ -102,14 +103,18 @@ static int ratbagd_resolution_set_active(sd_bus_message *m,
|
||||
int r;
|
||||
|
||||
r = ratbag_resolution_set_active(resolution->lib_resolution);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r < 0) {
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
r = ratbagd_device_resync(resolution->device, bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
ratbagd_for_each_resolution_signal(sd_bus_message_get_bus(m),
|
||||
resolution->profile,
|
||||
ratbagd_resolution_active_signal_cb);
|
||||
|
||||
return sd_bus_reply_method_return(m, "u", r);
|
||||
return sd_bus_reply_method_return(m, "u", 0);
|
||||
}
|
||||
|
||||
static int ratbagd_resolution_default_signal_cb(sd_bus *bus,
|
||||
@@ -135,14 +140,18 @@ static int ratbagd_resolution_set_default(sd_bus_message *m,
|
||||
int r;
|
||||
|
||||
r = ratbag_resolution_set_default(resolution->lib_resolution);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r < 0) {
|
||||
sd_bus *bus = sd_bus_message_get_bus(m);
|
||||
r = ratbagd_device_resync(resolution->device, bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
ratbagd_for_each_resolution_signal(sd_bus_message_get_bus(m),
|
||||
resolution->profile,
|
||||
ratbagd_resolution_default_signal_cb);
|
||||
|
||||
return sd_bus_reply_method_return(m, "u", r);
|
||||
return sd_bus_reply_method_return(m, "u", 0);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -270,7 +279,7 @@ ratbagd_resolution_set_resolution(sd_bus *bus,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -363,6 +372,7 @@ int ratbagd_resolution_new(struct ratbagd_resolution **out,
|
||||
if (!resolution)
|
||||
return -ENOMEM;
|
||||
|
||||
resolution->device = device;
|
||||
resolution->profile = profile;
|
||||
resolution->lib_resolution = lib_resolution;
|
||||
resolution->index = index;
|
||||
|
||||
Reference in New Issue
Block a user