Cyb3r Drag0nz Team Shell
Cyb3rDrag0nz


Server : Apache
System : Linux wealthytechsolutions.wealthytechsolutions.com 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : raybondt ( 1003)
PHP Version : 8.3.31
Disable Function : exec,passthru,shell_exec,system
Directory :  /usr/share/wireplumber/scripts/monitors/v4l2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/wireplumber/scripts/monitors/v4l2/name-device.lua
-- WirePlumber
--
-- Copyright © 2023 Collabora Ltd.
--    @author Ashok Sidipotu <ashok.sidipotu@collabora.com>
--
-- SPDX-License-Identifier: MIT

mutils = require ("monitor-utils")

log = Log.open_topic ("s-monitors-v4l2")

SimpleEventHook {
  name = "monitor/v4l2/name-device",
  interests = {
    EventInterest {
      Constraint { "event.type", "=", "create-v4l2-device" },
    },
  },
  execute = function(event)
    local properties = event:get_data ("device-properties")
    local parent = event:get_subject ()
    local id = event:get_data ("device-sub-id")

    local name = "v4l2_device." ..
        (properties["device.name"] or
          properties["device.bus-id"] or
          properties["device.bus-path"] or
          tostring (id)):gsub ("([^%w_%-%.])", "_")

    properties["device.name"] = name

    -- deduplicate devices with the same name
    for counter = 2, 99, 1 do
      if mutils.find_duplicate (parent, id, "device.name", properties["device.name"]) then
        properties["device.name"] = name .. "." .. counter
      else
        break
      end
    end

    -- ensure the device has a description
    properties["device.description"] =
        properties["device.description"]
        or properties["device.product.name"]
        or "Unknown device"

    event:set_data ("device-properties", properties)
  end
}:register ()

Cyb3r Drag0nz Team