Class UdevSubsystemMonitor

java.lang.Object
com.kosdev.kos.core.service.udev.UdevSubsystemMonitor

public class UdevSubsystemMonitor extends Object
Systemd device subsystem monitor. This can be registered with UdevService to monitor an entire device subsystem. As devices are added and removed, this monitor will receive lifecycle events
Since:
10
Version:
10
  • Constructor Details

    • UdevSubsystemMonitor

      public UdevSubsystemMonitor(String name, String subsystem)
      Create a new systemd device subsystem monitor for the named subsystem. As this monitor will have no matchers, no devices will be exposed by this monitor. It is recommended that listeners be added before the monitor is installed. Matchers can be added before or after installation and will generate events for newly matched devices regardless.
      Parameters:
      name - monitor name for display purposes
      subsystem - the subsytsem to monitor
      Since:
      10
  • Method Details

    • setAddRemoveListener

      public UdevSubsystemMonitor setAddRemoveListener(UdevDeviceAddRemoveListener listener)
      Set the UdevDeviceAddRemoveListener for the monitor. This will receive callbacks as matching devices are added or removed from the system.
      Parameters:
      listener - the listener for the monitor to use
      Since:
      10
    • setAvailability

      public UdevSubsystemMonitor setAvailability(UdevDeviceAvailabilityListener listener)
      Set the UdevDeviceAvailabilityListener for the monitor. This will receive callbacks as matching devices change availability.
      Parameters:
      listener - the listener for the monitor to use
      Since:
      10
    • addMatcher

      Add a new matcher to the monitor. Any devices that match this new matcher which don't match existing matchers will generate device add callbacks. This allows matchers to be added after the subsystem is already installed.
    • removeMatcher

      public void removeMatcher(UdevSubsystemMonitor.UdevDeviceMatcher matcher)
      Remove a matcher from the monitor. Any devices that match this matcher which don't match remaining matchers will generate device remove callbacks. This allows matchers to be removed after the subsystem is already installed.
    • getDevices

      public Set<UdevDevice> getDevices()
      Return a list of devices that match this monitor.
      Since:
      10
    • getName

      public String getName()
    • getSubsystem

      public String getSubsystem()