Lines Matching refs:device

33 static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
37 assert(device);
39 parent = udev_device_get_parent(device);
60 /* A connector DRM device, let's ignore all but LVDS and eDP! */
75 log_warning("Cannot parse PCI class %s of device %s:%s.",
104 static bool validate_device(struct udev *udev, struct udev_device *device) {
112 assert(device);
115 * backlight device. For backlight devices there might be
124 * device to userspace. However, we still need to make sure
126 * device for the same device exists. */
128 subsystem = udev_device_get_subsystem(device);
132 v = udev_device_get_sysattr_value(device, "type");
136 parent = find_pci_or_platform_parent(device);
166 if (same_device(device, other))
173 /* OK, so there's another backlight device, and it's a
174 * platform or firmware device, so, let's see if we
175 * can verify it belongs to the same device as
184 log_debug("Skipping backlight device %s, since device %s is on same PCI device and takes precedence.",
185 udev_device_get_sysname(device),
193 * and we are a PCI device, that also means we
195 log_debug("Skipping backlight device %s, since device %s is a platform device and takes precedence.",
196 udev_device_get_sysname(device),
205 static unsigned get_max_brightness(struct udev_device *device) {
210 max_brightness_str = udev_device_get_sysattr_value(device, "max_brightness");
223 log_warning("Maximum brightness is 0, ignoring device.");
235 static void clamp_brightness(struct udev_device *device, char **value, unsigned max_brightness) {
246 subsystem = udev_device_get_subsystem(device);
273 _cleanup_udev_device_unref_ struct udev_device *device = NULL;
304 log_error("Requires a subsystem and sysname pair specifying a backlight device.");
317 log_error("Not a backlight or LED device: '%s:%s'", ss, sysname);
322 device = udev_device_new_from_subsystem_sysname(udev, ss, sysname);
323 if (!device) {
325 log_error_errno(errno, "Failed to get backlight or LED device '%s:%s': %m", ss, sysname);
333 * device. This happens on desktops with Asus mainboards
336 max_brightness = get_max_brightness(device);
352 path_id = udev_device_get_property_value(device, "ID_PATH");
371 * means the validity checking of the device then is not
375 * device probing should be complete), so that the validity
385 if (!validate_device(udev, device))
398 clamp = udev_device_get_property_value(device, "ID_BACKLIGHT_CLAMP");
400 clamp_brightness(device, &value, max_brightness);
402 r = udev_device_set_sysattr_value(device, "brightness", value);
411 if (!validate_device(udev, device)) {
416 value = udev_device_get_sysattr_value(device, "brightness");