com.sun.jna.platform.linux

## Class Udev.UdevDevice

- java.lang.Object
- - com.sun.jna.PointerType
  - - com.sun.jna.platform.linux.Udev.UdevDevice

All Implemented Interfaces:
  NativeMapped

Enclosing interface:
  Udev

    public static class Udev.UdevDevice
    extends PointerType

To introspect a local device on a system, a udev device object can be created via `Udev.UdevContext.deviceNewFromSyspath(String)` and friends. The device object allows one to query current state, read and write attributes and lookup properties of the device in question.

### Constructor Summary

Constructors
Constructor and Description
`UdevDevice()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.String` `getDevnode()` Gets the devnode of this device
`java.lang.String` `getDevtype()` Gets the devtype of this device
`Udev.UdevDevice` `getParent()` Gets the parent of this device
`Udev.UdevDevice` `getParentWithSubsystemDevtype(java.lang.String subsystem, java.lang.String devtype)` Gets the parent of this device matching a subsystem and devtype
`java.lang.String` `getPropertyValue(java.lang.String key)` Retrieves a device property from this device
`java.lang.String` `getSubsystem()` Gets the subsystem of this device
`java.lang.String` `getSysattrValue(java.lang.String sysattr)` Retrieves a device attribute from this device
`java.lang.String` `getSysname()` Gets the sysname of this device
`java.lang.String` `getSyspath()` Gets the syspath of this device
`Udev.UdevDevice` `ref()` Acquire a further reference to this object.
`void` `unref()` Drop a reference to this object.

### Methods inherited from class com.sun.jna.PointerType

`equals, fromNative, getPointer, hashCode, nativeType, setPointer, toNative, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### UdevDevice

    public UdevDevice()

### Method Detail

#### ref

    public Udev.UdevDevice ref()

Acquire a further reference to this object.

Returns:
  this object, unmodified.

#### unref

    public void unref()

Drop a reference to this object. Once the reference count hits 0, the context object is destroyed and freed.

#### getParent

    public Udev.UdevDevice getParent()

Gets the parent of this device

Returns:
  the parent device. No additional reference to this device is acquired, but the child device owns a reference to the parent device. On failure, NULL is returned.

#### getParentWithSubsystemDevtype

    public Udev.UdevDevice getParentWithSubsystemDevtype(java.lang.String subsystem,
                                                         java.lang.String devtype)

Gets the parent of this device matching a subsystem and devtype

Parameters:
  `subsystem` - The subsystem to match
  `devtype` - The device type to match
Returns:
  the parent device. No additional reference to this device is acquired, but the child device owns a reference to the parent device. On failure, NULL is returned.

#### getSyspath

    public java.lang.String getSyspath()

Gets the syspath of this device

Returns:
  a string that describes the syspath. On failure, may return NULL.

#### getSysname

    public java.lang.String getSysname()

Gets the sysname of this device

Returns:
  a string that describes the sysname. On failure, may return NULL.

#### getDevnode

    public java.lang.String getDevnode()

Gets the devnode of this device

Returns:
  a string that describes the devnode. On failure, may return NULL.

#### getDevtype

    public java.lang.String getDevtype()

Gets the devtype of this device

Returns:
  a string that describes the devtype. On failure, may return NULL.

#### getSubsystem

    public java.lang.String getSubsystem()

Gets the subsystem of this device

Returns:
  a string that describes the subsystem. On failure, may return NULL.

#### getSysattrValue

    public java.lang.String getSysattrValue(java.lang.String sysattr)

Retrieves a device attribute from this device

Parameters:
  `sysattr` - The attribute to retrieve.
Returns:
  a string of the requested value. On error, NULL is returned. Attributes that may contain NUL bytes should not be retrieved with udev_device_get_sysattr_value(); instead, read them directly from the files within the device's syspath.

#### getPropertyValue

    public java.lang.String getPropertyValue(java.lang.String key)

Retrieves a device property from this device

Parameters:
  `key` - The property to retrieve.
Returns:
  a string of the requested value. On error, NULL is returned.

Copyright © 2007-2018 Timothy Wall. All Rights Reserved.