mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
ratbagd: ignore anything but event devices
We are only interested in evdev, so ignore anything but input-event devices. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
@@ -58,7 +58,7 @@ static void ratbagd_process_device(struct ratbagd *ctx,
|
||||
*/
|
||||
|
||||
name = udev_device_get_sysname(udevice);
|
||||
if (!name)
|
||||
if (!name || !startswith(name, "event"))
|
||||
return;
|
||||
|
||||
device = ratbagd_find_device(ctx, name);
|
||||
|
||||
@@ -185,6 +185,25 @@ static inline bool streq_ptr(const char *a, const char *b)
|
||||
return (a && b) ? streq(a, b) : (!a && !b);
|
||||
}
|
||||
|
||||
/*
|
||||
* startswith() - test prefix of a string
|
||||
* @s: string to test
|
||||
* @prefix: prefix to test for
|
||||
*
|
||||
* This returns a pointer to the first character in @s that follows @prefix. If
|
||||
* @s does not start with @prefix, NULL is returned.
|
||||
*/
|
||||
static inline char *startswith(const char *s, const char *prefix)
|
||||
{
|
||||
size_t l;
|
||||
|
||||
l = strlen(prefix);
|
||||
if (strncmp(s, prefix, l) == 0)
|
||||
return (char*) s + l;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* now() - returns current time in nano-seconds
|
||||
* @clock: clock to use
|
||||
|
||||
Reference in New Issue
Block a user