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