Method: ComputeUnit::Device.create_from_path

Defined in:
lib/compute_unit/device.rb

.create_from_path(device_path) ⇒ Device

Returns - creates a device from the given path.

Parameters:

  • device_path (String)
    • the sysfs path to of the device

Returns:

  • (Device)
    • creates a device from the given path



183
184
185
186
187
188
189
190
191
192
# File 'lib/compute_unit/device.rb', line 183

def self.create_from_path(device_path)
  opts = {
    device_class_id: device_class(device_path),
    device_id: device(device_path),
    device_vendor_id: device_vendor(device_path),
    subsystem_vendor_id: subsystem_vendor(device_path),
    subsystem_device_id: subsystem_device(device_path)
  }
  new(device_path, opts)
end