}
_public_ int sd_device_trigger(sd_device *device, sd_device_action_t action) {
- const char *s;
-
- assert_return(device, -EINVAL);
-
- s = device_action_to_string(action);
- if (!s)
- return -EINVAL;
-
- /* This uses the simple no-UUID interface of kernel < 4.13 */
- return sd_device_set_sysattr_value(device, "uevent", s);
+ return sd_device_trigger_with_uuid(device, action, NULL);
}
_public_ int sd_device_trigger_with_uuid(
assert_return(device, -EINVAL);
- /* If no one wants to know the UUID, use the simple interface from pre-4.13 times */
- if (!ret_uuid)
- return sd_device_trigger(device, action);
-
s = device_action_to_string(action);
if (!s)
return -EINVAL;
if (r < 0)
return r;
- *ret_uuid = u;
+ if (ret_uuid)
+ *ret_uuid = u;
return 0;
}