18c2ecf20Sopenharmony_ciWhat: /sys/.../uevent 28c2ecf20Sopenharmony_ciDate: May 2017 38c2ecf20Sopenharmony_ciKernelVersion: 4.13 48c2ecf20Sopenharmony_ciContact: Linux kernel mailing list <linux-kernel@vger.kernel.org> 58c2ecf20Sopenharmony_ciDescription: 68c2ecf20Sopenharmony_ci Enable passing additional variables for synthetic uevents that 78c2ecf20Sopenharmony_ci are generated by writing /sys/.../uevent file. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci Recognized extended format is:: 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci ACTION [UUID [KEY=VALUE ...] 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci The ACTION is compulsory - it is the name of the uevent 148c2ecf20Sopenharmony_ci action (``add``, ``change``, ``remove``). There is no change 158c2ecf20Sopenharmony_ci compared to previous functionality here. The rest of the 168c2ecf20Sopenharmony_ci extended format is optional. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci You need to pass UUID first before any KEY=VALUE pairs. 198c2ecf20Sopenharmony_ci The UUID must be in ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` 208c2ecf20Sopenharmony_ci format where 'x' is a hex digit. The UUID is considered to be 218c2ecf20Sopenharmony_ci a transaction identifier so it's possible to use the same UUID 228c2ecf20Sopenharmony_ci value for one or more synthetic uevents in which case we 238c2ecf20Sopenharmony_ci logically group these uevents together for any userspace 248c2ecf20Sopenharmony_ci listeners. The UUID value appears in uevent as 258c2ecf20Sopenharmony_ci ``SYNTH_UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`` environment 268c2ecf20Sopenharmony_ci variable. 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci If UUID is not passed in, the generated synthetic uevent gains 298c2ecf20Sopenharmony_ci ``SYNTH_UUID=0`` environment variable automatically. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci The KEY=VALUE pairs can contain alphanumeric characters only. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci It's possible to define zero or more pairs - each pair is then 348c2ecf20Sopenharmony_ci delimited by a space character ' '. Each pair appears in 358c2ecf20Sopenharmony_ci synthetic uevent as ``SYNTH_ARG_KEY=VALUE``. That means the KEY 368c2ecf20Sopenharmony_ci name gains ``SYNTH_ARG_`` prefix to avoid possible collisions 378c2ecf20Sopenharmony_ci with existing variables. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci Example of valid sequence written to the uevent file:: 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci add fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed A=1 B=abc 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci This generates synthetic uevent including these variables:: 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci ACTION=add 468c2ecf20Sopenharmony_ci SYNTH_ARG_A=1 478c2ecf20Sopenharmony_ci SYNTH_ARG_B=abc 488c2ecf20Sopenharmony_ci SYNTH_UUID=fe4d7c9d-b8c6-4a70-9ef1-3d8a58d18eed 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciUsers: 518c2ecf20Sopenharmony_ci udev, userspace tools generating synthetic uevents 52