Ejemplo n.º 1
0
unsigned int machine_jam(const char *format, ...)
{
    char *str;
    va_list ap;
    ui_jam_action_t ret;

    if (ignore_jam > 0)
        return JAM_NONE;

    va_start(ap, format);

    str = lib_mvsprintf(format, ap);
    ret = ui_jam_dialog(str);
    lib_free(str);

    switch (ret) {
      case UI_JAM_RESET:
        return JAM_RESET;
      case UI_JAM_HARD_RESET:
        return JAM_HARD_RESET;
      case UI_JAM_MONITOR:
        return JAM_MONITOR;
      default:
        break;
    }

    ignore_jam = 1;
    return JAM_NONE;
}
Ejemplo n.º 2
0
unsigned int machine_jam(const char *format, ...)
{
    char *str;
    va_list ap;
    ui_jam_action_t ret;

    if (ignore_jam > 0) {
        return JAM_NONE;
    }

    va_start(ap, format);
    str = lib_mvsprintf(format, ap);
    va_end(ap);

    log_message(LOG_DEFAULT, "*** %s", str);

    if (jam_action == MACHINE_JAM_ACTION_DIALOG) {
        if (monitor_is_remote()) {
            ret = monitor_network_ui_jam_dialog(str);
        } else {
            ret = ui_jam_dialog(str);
        }
    } else {
        int actions[4] = {
            -1, UI_JAM_MONITOR, UI_JAM_RESET, UI_JAM_HARD_RESET
        };
        ret = actions[jam_action - 1];
    }
    lib_free(str);

    /* always ignore subsequent JAMs. reset would clear the flag again, not
     * setting it when going to the monitor would just repeatedly pop up the
     * jam dialog (until reset)
     */
    ignore_jam = 1;

    switch (ret) {
        case UI_JAM_RESET:
            return JAM_RESET;
        case UI_JAM_HARD_RESET:
            return JAM_HARD_RESET;
        case UI_JAM_MONITOR:
            return JAM_MONITOR;
        default:
            break;
    }
    return JAM_NONE;
}