From 638b505ade92f00e4a780ea3fe0b6cf702bac8b2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 Mar 2016 13:36:53 +1000 Subject: [PATCH] manager: drop GetDeviceById We don't really expect more than 2-3 devices even on a test box. This function serves little purpose, we can easily require a caller to just get all devices (usually just one anyway) and then go from there. Signed-off-by: Peter Hutterer --- README.md | 2 -- src/ratbagd.c | 22 ---------------------- 2 files changed, 24 deletions(-) diff --git a/README.md b/README.md index 56550c0d..4c582017 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,6 @@ The **org.freedesktop.ratbag1.Manager** interface provides: - Signals: - DeviceNew -> new device available, carries object path - DeviceRemoved -> device removed, carries object path -- Methods: - - GetDeviceByName(string) -> returns object path The **org.freedesktop.ratbag1.Device** interface provides: - Properties: diff --git a/src/ratbagd.c b/src/ratbagd.c index 172dda8c..233ec4f3 100644 --- a/src/ratbagd.c +++ b/src/ratbagd.c @@ -144,33 +144,11 @@ static int ratbagd_get_devices(sd_bus *bus, return sd_bus_message_close_container(reply); } -static int ratbagd_get_device_by_name(sd_bus_message *m, - void *userdata, - sd_bus_error *error) -{ - struct ratbagd *ctx = userdata; - struct ratbagd_device *device; - const char *name; - int r; - - r = sd_bus_message_read(m, "s", &name); - if (r < 0) - return r; - - device = ratbagd_device_lookup(ctx, name); - if (!device) - return -ENXIO; - - return sd_bus_reply_method_return(m, "o", - ratbagd_device_get_path(device)); -} - static const sd_bus_vtable ratbagd_vtable[] = { SD_BUS_VTABLE_START(0), SD_BUS_PROPERTY("Devices", "ao", ratbagd_get_devices, 0, 0), SD_BUS_SIGNAL("DeviceNew", "o", 0), SD_BUS_SIGNAL("DeviceRemoved", "o", 0), - SD_BUS_METHOD("GetDeviceByName", "s", "o", ratbagd_get_device_by_name, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_VTABLE_END, };