Debian Codegraph @

src/scripts/device/select-profile.lua

raw
1 -- WirePlumber
2 --
3 -- Copyright © 2022 Collabora Ltd.
4 --
5 -- SPDX-License-Identifier: MIT
6
7 -- look for new devices and raise select-profile event.
8
9 cutils = require ("common-utils")
10 log = Log.open_topic ("s-device")
11
12 SimpleEventHook {
13 name = "device/select-profile",
14 interests = {
15 EventInterest {
16 Constraint { "event.type", "=", "device-added" },
17 },
18 EventInterest {
19 Constraint { "event.type", "=", "device-params-changed" },
20 Constraint { "event.subject.param-id", "=", "EnumProfile" },
21 },
22 },
23 execute = function (event)
24 local source = event:get_source ()
25 local device = event:get_subject ()
26 source:call ("push-event", "select-profile", device, nil)
27 end
28 }:register()