---
name: "udev_device_get_driver"
section: "3"
platform: "linux"
package: "libudev-dev"
version: "257.13-1~deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/udev_device_get_syspath"
---

# udev\_device\_get\_driver(3)

Query device properties

Part of [udev\_device\_get\_syspath(3)](/udev_device_get_syspath/3.md).

## NAME

udev\_device\_get\_syspath, udev\_device\_get\_sysname, udev\_device\_get\_sysnum, udev\_device\_get\_devpath, udev\_device\_get\_devnode, udev\_device\_get\_devnum, udev\_device\_get\_devtype, udev\_device\_get\_subsystem, udev\_device\_get\_driver, udev\_device\_get\_udev, udev\_device\_get\_parent, udev\_device\_get\_parent\_with\_subsystem\_devtype, udev\_device\_get\_is\_initialized, udev\_device\_get\_action - Query device properties

## SYNOPSIS

```
#include <libudev.h>
```

**const char \*udev\_device\_get\_syspath(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_sysname(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_sysnum(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_devpath(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_devnode(struct udev\_device \****udev\_device***);**

**dev\_t udev\_device\_get\_devnum(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_devtype(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_subsystem(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_driver(struct udev\_device \****udev\_device***);**

**struct udev \*udev\_device\_get\_udev(struct udev\_device \****udev\_device***);**

**struct udev\_device \*udev\_device\_get\_parent(struct udev\_device \****udev\_device***);**

**struct udev\_device \*udev\_device\_get\_parent\_with\_subsystem\_devtype(struct udev\_device \****udev\_device***, const char \****subsystem***, const char \****devtype***);**

**int udev\_device\_get\_is\_initialized(struct udev\_device \****udev\_device***);**

**const char \*udev\_device\_get\_action(struct udev\_device \****udev\_device***);**

## RETURN VALUE

On success, **udev\_device\_get\_syspath()**, **udev\_device\_get\_sysname()**, **udev\_device\_get\_sysnum()**, **udev\_device\_get\_devpath()**, **udev\_device\_get\_devnode()**, **udev\_device\_get\_devtype()**, **udev\_device\_get\_subsystem()**, **udev\_device\_get\_driver()** and **udev\_device\_get\_action()** return a pointer to a constant string that describes the requested property. The lifetime of this string is bound to the device it was requested on. On failure, each function may return **NULL**.

On success, **udev\_device\_get\_devnum()** returns the device type of the passed device. On failure, a device type with minor and major number set to **0** is returned.

**udev\_device\_get\_udev()** always returns a valid pointer to the udev context that this device belongs to.

On success, **udev\_device\_get\_parent()** and **udev\_device\_get\_parent\_with\_subsystem\_devtype()** return a pointer to the parent device. No additional reference to this device is acquired, but the child device owns a reference to such a parent device. On failure, **NULL** is returned.

On success, **udev\_device\_get\_is\_initialized()** returns either **1** or **0**, depending on whether the passed device has already been initialized by udev or not. On failure, a negative error code is returned. Note that devices for which no udev rules are defined are never reported initialized.

## HISTORY

**udev\_device\_get\_syspath()**, **udev\_device\_get\_sysname()**, **udev\_device\_get\_sysnum()**, **udev\_device\_get\_devpath()**, **udev\_device\_get\_devnode()**, **udev\_device\_get\_devnum()**, **udev\_device\_get\_devtype()**, **udev\_device\_get\_subsystem()**, **udev\_device\_get\_driver()**, **udev\_device\_get\_udev()**, **udev\_device\_get\_parent()**, **udev\_device\_get\_parent\_with\_subsystem\_devtype()**, **udev\_device\_get\_is\_initialized()**, and **udev\_device\_get\_action()** were added in version 221.

## SEE ALSO

[**udev\_new**(3)](/udev_new/3.md), [**udev\_device\_new\_from\_syspath**(3)](/udev_device_new_from_syspath/3.md), [**udev\_device\_has\_tag**(3)](/udev_device_has_tag/3.md), [**udev\_enumerate\_new**(3)](/udev_enumerate_new/3.md), [**udev\_monitor\_new\_from\_netlink**(3)](/udev_monitor_new_from_netlink/3.md), [**udev\_list\_entry**(3)](/udev_list_entry/3.md), [**systemd**(1)](/systemd/1.md)
