ipmi_ret_t ipmi_chassis_set_sys_boot_options(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
                              ipmi_request_t request, ipmi_response_t response,
                              ipmi_data_len_t data_len, ipmi_context_t context)
{
    ipmi_ret_t rc = IPMI_CC_OK;
    char *s;

    printf("IPMI SET_SYS_BOOT_OPTIONS\n");

    set_sys_boot_options_t *reqptr = (set_sys_boot_options_t *) request;

    // This IPMI command does not have any resposne data
    *data_len = 0;

    /*  000101
     * Parameter #5 means boot flags. Please refer to 28.13 of ipmi doc.
     * This is the only parameter used by petitboot.
     */
    if (reqptr->parameter == 5) {

        s = get_boot_option_by_ipmi(((reqptr->data[1] & 0x3C) >> 2));

        printf("%d: %s\n", __LINE__, s);
        if (!strcmp(s,INVALID_STRING)) {

            rc = IPMI_CC_PARM_NOT_SUPPORTED;

        } else {

            int r = dbus_set_property("boot_flags",s);

            if (r < 0) {
                fprintf(stderr, "Dbus set property(boot_flags) failed for set_sys_boot_options.\n");
                rc = IPMI_CC_UNSPECIFIED_ERROR;
            }
        }
      
        /* setting the boot policy */
        s = (char *)(((reqptr->data[0] & SET_PARM_BOOT_FLAGS_PERMANENT) == 
                       SET_PARM_BOOT_FLAGS_PERMANENT) ?"PERMANENT":"ONETIME");

        printf ( "\nBoot Policy is %s",s); 
        int r = dbus_set_property("boot_policy",s);

        if (r < 0) {
            fprintf(stderr, "Dbus set property(boot_policy) failed for set_sys_boot_options.\n");
            rc = IPMI_CC_UNSPECIFIED_ERROR;
        }

    } else {
Esempio n. 2
0
/*
 * Toggle the OfflineMode attribute of Manager.
 * @param set_offline_to the new offline mode to set
 */
int __cmd_toggle_offline_mode(bool set_offline_to)
{
	dbus_bool_t dbus_bool;

	dbus_bool = set_offline_to ? TRUE : FALSE;

	return dbus_set_property(connection, "/",
			"net.connman.Manager", call_return_list, NULL,
			"OfflineMode", DBUS_TYPE_BOOLEAN, &dbus_bool);
}
Esempio n. 3
0
/*
 * Toggle the Powered state of the technology.
 * @param tech_dbus_name the dbus name of the technology
 * @param set_power_to the new power state to set
 */
int __cmd_toggle_tech_power(const char *tech_dbus_name, bool set_power_to)
{
	dbus_bool_t dbus_bool;

	dbus_bool = set_power_to ? TRUE : FALSE;

	return dbus_set_property(connection, tech_dbus_name,
			"net.connman.Technology", call_return_list_free,
			strdup(tech_dbus_name), "Powered",
			DBUS_TYPE_BOOLEAN, &dbus_bool);
}