Method: ComputeUnit::Device.subsystem_device_lookup

Defined in:
lib/compute_unit/device.rb

.subsystem_device_lookup(device_id, subsystem_device_id, vendor_id) ⇒ String

Returns - the name of the device.

Parameters:

  • device_id (String)
    • the device id of the device

  • subsystem_device_id (String)
    • the subsystem_device_id of the device

  • vendor_id (String)
    • the subsystem vendor id

Returns:

  • (String)
    • the name of the device



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/compute_unit/device.rb', line 330

def self.subsystem_device_lookup(device_id, subsystem_device_id, vendor_id)
  # "\t\t1002 687f  Vega 10 XT [Radeon RX Vega 64]\n"
  p = manual_device_lookup(device_id, subsystem_device_id, vendor_id)
  return p if p

  re = Regexp.new(/\A\t\t#{vendor_id}\s+#{subsystem_device_id}/)
  d = pci_database.find do |line|
    re.match(line)
  rescue ArgumentError
    next
  end
  return d unless d

  name = d[/\t\t\w+\s+\w+\s+(.*)\n/, 1]
  name[/.*\[(.*)\]/, 1] || name if name
end