[systemd-devel] [systemd-level]: how to set property to read only in systemd?
Lennart Poettering
lennart at poettering.net
Tue Apr 21 12:53:02 UTC 2020
On Di, 21.04.20 19:54, www (ouyangxuan10 at 163.com) wrote:
> hi Lennart,
>
>
> I mean the DBUS property.
>
> root at demoboard:/# busctl set-property org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus Features as 1 x
>
> Cannot set read-only property -- the default
>
>
>
>
> root at demoboard:/# busctl set-property com.sugon.sensors.DISCRETE /com/sugon/sensors/HDD/HDD4_Status xyz.openbmc_project.Sensor.DiscreteAll FanDeviceInserted b true -- new add
>
> root at demoboard:/#
>
>
>
> I want the property on Dbus is read only. Just can modify by the
> special method and cannot modify the property directly. How can I
> change it like this?
Is "com.sugon.sensors.DISCRETE" a service you implemented yourself?
With the sd-bus API?
In sd-bus you define a writable property in a vtable with the
SD_BUS_WRITABLE_PROPERTY() macro, and a read-only one with
SD_BUS_PROPERTY().
But not sure I grok your question properly.
Lennart
--
Lennart Poettering, Berlin
More information about the systemd-devel
mailing list