ADD USB Code Update enable/disable

phosphor_usb_code_update is an application that use USB to do FW
update. phosphor_usb_code_update service is not a daemon, but an app
that will be called after inserting a USB flash disk.

This commit creates an object of phosphor_usb_code_update when
phosphor_usb_code_update is not started. We can enable/disable
phosphor_usb_code_update by setting the "Enabled" property to
true/false.

Please configure the “usb-code-update” option in your bb/bbappend to
enable this feature.

For phosphor_usb_code_update, useful rules files is
/lib/udev/rules.d/70-bmc-usb.rules. When usb code update is disabled,
srvcfg_manager creates an empty symlink
/etc/udev/rules.d/70-bmc-usb.rules, which causes
/lib/udev/rules.d/70-bmc-usb.rules inoperative. When usb code update is
enabled, srvcfg_manager deletes /etc/udev/rules.d/70-bmc-usb.rules.

The commits of phosphor_usb_code_update is:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-bmc-code-mgmt/+/48742/1

Test:
get "Enabled" property:
busctl get-property xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/phosphor_2dusb_2dcode_2dupdate
xyz.openbmc_project.Control.Service.Attributes Enabled
b true

set "Enabled" property to false:
busctl set-property xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/phosphor_2dusb_2dcode_2dupdate
xyz.openbmc_project.Control.Service.Attributes Enabled b false

busctl get-property xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/phosphor_2dusb_2dcode_2dupdate
xyz.openbmc_project.Control.Service.Attributes Enabled
b false

The "Enabled" property will be persisted,reboot the BMC, then get the
"Enabled" property:
busctl get-property xyz.openbmc_project.Control.Service.Manager
/xyz/openbmc_project/control/service/phosphor_2dusb_2dcode_2dupdate
xyz.openbmc_project.Control.Service.Attributes Enabled
b false

Signed-off-by: Chicago Duan <duanzhijia01@inspur.com>
Change-Id: Iba7ffb541628d563e2c54c3e1c8c4dbe85f1507b
5 files changed
tree: baa4f377fd04f8b8620b24b80ff107673e863768
  1. inc/
  2. src/
  3. subprojects/
  4. .clang-format
  5. .gitignore
  6. LICENSE
  7. MAINTAINERS
  8. meson.build
  9. meson_options.txt
  10. OWNERS
  11. README.md
  12. srvcfg-manager.service
README.md

Service config manager

The service config manager provides a D-Bus interface to manage BMC services as described by the service management D-Bus interfaces.

The configuration settings are intended to persist across BMC reboots.

An example use case for this service is BMCWeb's implementation of the Redfish NetworkProtocol schema.

Design

Implementation details are described in the D-Bus interface README.

The service config manager generally makes configuration changes to systemd units via D-Bus interfaces.

The design pattern to add new services or controls is:

  • Determine if the service you want to control is socket activated.
  • To control the Running and Enabled properties of a service:
    • For a service which uses socket activation, control the socket.
    • For other services, control the service unit itself.