Lines Matching refs:device

38 #include "sd-device.h"
41 #include "device-private.h"
42 #include "device-util.h"
43 #include "libudev-device-internal.h"
48 * SECTION:libudev-device
52 * by their syspath, every device has exactly one path in the kernel sys
59 * @udev_device: udev device
61 * This is only valid if the device was received through a monitor. Devices read from
74 r = sd_device_get_property_value(udev_device->device, "SEQNUM", &seqnum);
93 * @udev_device: udev device
95 * Get the device major/minor number.
106 r = sd_device_get_devnum(udev_device->device, &devnum);
117 * @udev_device: udev device
130 r = sd_device_get_driver(udev_device->device, &driver);
141 * @udev_device: udev device
143 * Retrieve the devtype string of the udev device.
145 * Returns: the devtype name of the udev device, or #NULL if it can not be determined
154 r = sd_device_get_devtype(udev_device->device, &devtype);
165 * @udev_device: udev device
167 * Retrieve the subsystem string of the udev device. The string does not
170 * Returns: the subsystem name of the udev device, or #NULL if it can not be determined
179 r = sd_device_get_subsystem(udev_device->device, &subsystem);
191 * @udev_device: udev device
205 r = sd_device_get_property_value(udev_device->device, key, &value);
237 * @syspath: sys device path including sys directory
239 * Create new udev device, and fill in information from the sys
240 * device and the udev database entry. The syspath is the absolute
241 * path to the device, including the sys mount point.
244 * release the resources of the udev device.
246 * Returns: a new udev device, or #NULL, if it does not exist
256 r = sd_device_new_from_syspath(&udev_device->device, syspath);
269 * @type: char or block device
270 * @devnum: device major/minor number
272 * Create new udev device, and fill in information from the sys
273 * device and the udev database entry. The device is looked-up
274 * by its major/minor number and type. Character and block device
278 * release the resources of the udev device.
280 * Returns: a new udev device, or #NULL, if it does not exist
291 r = sd_device_new_from_devnum(&udev_device->device, type, devnum);
304 * @id: text string identifying a kernel device
306 * Create new udev device, and fill in information from the sys
307 * device and the udev database entry. The device is looked-up
309 * b8:2 - block device major:minor
310 * c128:1 - char device major:minor
311 * n3 - network device ifindex
312 * +sound:card29 - kernel driver core subsystem:device name
315 * release the resources of the udev device.
317 * Returns: a new udev device, or #NULL, if it does not exist
328 r = sd_device_new_from_device_id(&udev_device->device, id);
341 * @subsystem: the subsystem of the device
342 * @sysname: the name of the device
344 * Create new udev device, and fill in information from the sys device
345 * and the udev database entry. The device is looked up by the subsystem
346 * and name string of the device, like "mem" / "zero", or "block" / "sda".
349 * release the resources of the udev device.
351 * Returns: a new udev device, or #NULL, if it does not exist
362 r = sd_device_new_from_subsystem_sysname(&udev_device->device, subsystem, sysname);
376 * Create new udev device, and fill in information from the
382 * release the resources of the udev device.
384 * Returns: a new udev device, or #NULL, if it does not exist
395 r = device_new_from_strv(&udev_device->device, environ);
416 r = sd_device_get_parent(child->device, &parent->device);
424 sd_device_ref(parent->device);
431 * @udev_device: the device to start searching from
433 * Find the next parent device, and fill in information from the sys
434 * device and the udev database entry.
436 * Returned device is not referenced. It is attached to the child
437 * device, and will be cleaned up when the child device is cleaned up.
445 * Returns: a new udev device, or #NULL, if it no parent exist.
462 * @udev_device: udev device to start searching from
463 * @subsystem: the subsystem of the device
464 * @devtype: the type (DEVTYPE) of the device
466 * Find the next parent device, with a matching subsystem and devtype
467 * value, and fill in information from the sys device and the udev
473 * Returned device is not referenced. It is attached to the child
474 * device, and will be cleaned up when the child device is cleaned up.
479 * Returns: a new udev device, or #NULL if no matching parent exists.
492 r = sd_device_get_parent_with_subsystem_devtype(udev_device->device, subsystem, devtype, &parent);
501 if (udev_device->device == parent)
511 * @udev_device: udev device
513 * Retrieve the udev library context the device was created with.
526 * @udev_device: udev device
528 * Take a reference of a udev device.
530 * Returns: the passed udev device
542 * @udev_device: udev device
544 * Drop a reference of a udev device. If the refcount reaches zero,
545 * the resources of the device will be released.
552 sd_device_unref(udev_device->device);
568 * @udev_device: udev device
570 * Retrieve the kernel devpath value of the udev device. The path
573 * Returns: the devpath of the udev device
582 r = sd_device_get_devpath(udev_device->device, &devpath);
593 * @udev_device: udev device
595 * Retrieve the sys path of the udev device. The path is an
598 * Returns: the sys path of the udev device
607 r = sd_device_get_syspath(udev_device->device, &syspath);
618 * @udev_device: udev device
620 * Get the kernel device name in /sys.
622 * Returns: the name string of the device device
631 r = sd_device_get_sysname(udev_device->device, &sysname);
642 * @udev_device: udev device
644 * Get the instance number of the device.
646 * Returns: the trailing number string of the device name
655 r = sd_device_get_sysnum(udev_device->device, &sysnum);
666 * @udev_device: udev device
668 * Retrieve the device node file name belonging to the udev device.
669 * The path is an absolute path, and starts with the device directory.
671 * Returns: the device node file name of the udev device, or #NULL if no device node exists
680 r = sd_device_get_devname(udev_device->device, &devnode);
691 * @udev_device: udev device
693 * Retrieve the list of device links pointing to the device file of
694 * the udev device. The next list entry can be retrieved with
698 * the device directory.
700 * Returns: the first entry of the device node link list
706 if (device_get_devlinks_generation(udev_device->device) != udev_device->devlinks_generation ||
712 FOREACH_DEVICE_DEVLINK(udev_device->device, devlink)
716 udev_device->devlinks_generation = device_get_devlinks_generation(udev_device->device);
724 * @udev_device: udev device
726 * Retrieve the list of key/value device properties of the udev
727 * device. The next list entry can be retrieved with udev_list_entry_get_next(),
738 if (device_get_properties_generation(udev_device->device) != udev_device->properties_generation ||
744 FOREACH_DEVICE_PROPERTY(udev_device->device, key, value)
748 udev_device->properties_generation = device_get_properties_generation(udev_device->device);
756 * @udev_device: udev device
758 * This is only valid if the device was received through a monitor. Devices read from
770 r = sd_device_get_property_value(udev_device->device, "ACTION", &action);
781 * @udev_device: udev device
784 * device for the first time.
789 * Returns: the number of microseconds since the device was first seen.
798 r = sd_device_get_usec_since_initialized(udev_device->device, &ts);
809 * @udev_device: udev device
812 * The retrieved value is cached in the device. Repeated calls will return the same
824 r = sd_device_get_sysattr_value(udev_device->device, sysattr, &value);
835 * @udev_device: udev device
839 * Update the contents of the sys attribute and the cached value of the device.
849 r = sd_device_set_sysattr_value(udev_device->device, sysattr, value);
858 * @udev_device: udev device
862 * device without reading their values.
875 FOREACH_DEVICE_SYSATTR(udev_device->device, sysattr)
886 * @udev_device: udev device
888 * Check if udev has already handled the device and has set up
889 * device node permissions and context, or has renamed a network
890 * device.
892 * This is only implemented for devices with a device node
895 * Returns: 1 if the device is set up. 0 otherwise.
903 r = sd_device_get_is_initialized(udev_device->device, &initialized);
915 * @udev_device: udev device
917 * Retrieve the list of tags attached to the udev device. The next
928 if (device_get_tags_generation(udev_device->device) != udev_device->tags_generation ||
934 FOREACH_DEVICE_TAG(udev_device->device, tag)
938 udev_device->tags_generation = device_get_tags_generation(udev_device->device);
946 * @udev_device: udev device
949 * Check if a given device has a certain tag associated.
957 return sd_device_has_tag(udev_device->device, tag);