forked from drath/libratbag
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 <peter.hutterer@who-t.net>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user