xref: /linux/Documentation/ABI/testing/sysfs-uevent (revision e622ec579b9ac3a3280088b991e3a26309582b3b)
1f36776faSPeter RajnohaWhat:           /sys/.../uevent
2f36776faSPeter RajnohaDate:           May 2017
3*e622ec57SPeter RajnohaKernelVersion:  4.13
4f36776faSPeter RajnohaContact:        Linux kernel mailing list <linux-kernel@vger.kernel.org>
5f36776faSPeter RajnohaDescription:
6f36776faSPeter Rajnoha                Enable passing additional variables for synthetic uevents that
7f36776faSPeter Rajnoha                are generated by writing /sys/.../uevent file.
8f36776faSPeter Rajnoha
9f36776faSPeter Rajnoha                Recognized extended format is ACTION [UUID [KEY=VALUE ...].
10f36776faSPeter Rajnoha
11f36776faSPeter Rajnoha                The ACTION is compulsory - it is the name of the uevent action
12f36776faSPeter Rajnoha                ("add", "change", "remove"). There is no change compared to
13f36776faSPeter Rajnoha                previous functionality here. The rest of the extended format
14f36776faSPeter Rajnoha                is optional.
15f36776faSPeter Rajnoha
16f36776faSPeter Rajnoha                You need to pass UUID first before any KEY=VALUE pairs.
17f36776faSPeter Rajnoha                The UUID must be in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
18f36776faSPeter Rajnoha                format where 'x' is a hex digit. The UUID is considered to be
19f36776faSPeter Rajnoha                a transaction identifier so it's possible to use the same UUID
20f36776faSPeter Rajnoha                value for one or more synthetic uevents in which case we
21f36776faSPeter Rajnoha                logically group these uevents together for any userspace
22f36776faSPeter Rajnoha                listeners. The UUID value appears in uevent as
23f36776faSPeter Rajnoha                "SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" environment
24f36776faSPeter Rajnoha                variable.
25f36776faSPeter Rajnoha
26f36776faSPeter Rajnoha                If UUID is not passed in, the generated synthetic uevent gains
27f36776faSPeter Rajnoha                "SYNTH_UUID=0" environment variable automatically.
28f36776faSPeter Rajnoha
29f36776faSPeter Rajnoha                The KEY=VALUE pairs can contain alphanumeric characters only.
30f36776faSPeter Rajnoha                It's possible to define zero or more pairs - each pair is then
31f36776faSPeter Rajnoha                delimited by a space character ' '. Each pair appears in
32f36776faSPeter Rajnoha                synthetic uevent as "SYNTH_ARG_KEY=VALUE". That means the KEY
33f36776faSPeter Rajnoha                name gains "SYNTH_ARG_" prefix to avoid possible collisions
34f36776faSPeter Rajnoha                with existing variables.
35f36776faSPeter Rajnoha
36f36776faSPeter Rajnoha                Example of valid sequence written to the uevent file:
37f36776faSPeter Rajnoha
38f36776faSPeter Rajnoha                    add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc
39f36776faSPeter Rajnoha
40f36776faSPeter Rajnoha                This generates synthetic uevent including these variables:
41f36776faSPeter Rajnoha
42f36776faSPeter Rajnoha                    ACTION=add
43f36776faSPeter Rajnoha                    SYNTH_ARG_A=1
44f36776faSPeter Rajnoha                    SYNTH_ARG_B=abc
45f36776faSPeter Rajnoha                    SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed
46f36776faSPeter RajnohaUsers:
47f36776faSPeter Rajnoha                udev, userspace tools generating synthetic uevents
48