[PATCH phosphor-host-ipmid v4 2/2] Add get/set ipmid command support with correct DBUS property handling.
Stewart Smith
stewart at linux.vnet.ibm.com
Fri Dec 18 09:47:21 AEDT 2015
OpenBMC Patches <openbmc-patches at stwcx.xyz> writes:
> diff --git a/chassishandler.C b/chassishandler.C
> index 1389db9..35b5086 100644
> --- a/chassishandler.C
> +++ b/chassishandler.C
> @@ -9,6 +9,217 @@ const char *chassis_bus_name = "org.openbmc.control.Chassis";
> const char *chassis_object_name = "/org/openbmc/control/chassis0";
> const char *chassis_intf_name = "org.openbmc.control.Chassis";
>
> +// Host settings in dbus
> +// Service name should be referenced by connection name got via object mapper
> +// const char *settings_service_name = "org.openbmc.settings.Host";
> +const char *settings_object_name = "/org/openbmc/settings/host0";
> +const char *settings_intf_name = "org.freedesktop.DBus.Properties";
> +
> +const char *objmapper_service_name = "org.openbmc.objectmapper";
> +const char *objmapper_object_name = "/org/openbmc/objectmapper/objectmapper";
> +const char *objmapper_intf_name = "org.openbmc.objectmapper.ObjectMapper";
> +
> +char* uint8_to_char(uint8_t *a, size_t size)
> +{
> + char* buffer;
> + int i;
> +
> + buffer = (char*)malloc(size * 2 + 1);
> + if (!buffer)
> + return NULL;
> +
> + buffer[size * 2] = 0;
> + for (i = 0; i < size; i++) {
> + uint8_t msb = (a[i] >> 4) & 0xF;
> + uint8_t lsb = a[i] & 0xF;
> + buffer[2*i] = msb > 9 ? msb + 'A' - 10 : msb + '0';
> + buffer[2*i + 1] = lsb > 9 ? lsb + 'A' - 10 : lsb + '0';
> + }
> +
> + return buffer;
> +}
> +
> +uint8_t* char_to_uint8(char *a, size_t size)
> +{
> + uint8_t* buffer;
> + int i;
> +
> + buffer = (uint8_t*)malloc(size);
> + if (!buffer)
> + return NULL;
> +
> + for (i = 0; i < size; i++) {
> + uint8_t msb = (uint8_t)(a[2*i] > '9' ? a[2*i] - 'A' + 10 : a[2*i] - '0');
> + uint8_t lsb = (uint8_t)(a[2*i+1] > '9' ? a[2*i+1] - 'A' + 10 : a[2*i+1] - '0');
> + buffer[i] = ((msb << 4) | (lsb & 0xF)) & 0xFF;
> + }
> +
> + return buffer;
> +}
Use libc.
More information about the openbmc
mailing list