{%
    local function echo_usage(pump_support)
        echo('Usage: ipmcget -d coolingdeviceinfo -v <devicetype>\n')
        echo('devicetype:\n')
        echo('      fan')
        if pump_support == true then
            echo('\n      pump')
        end
    end
    if devicetype == 'fan' then
        -- 当前模式为自动
        if FanCtrlMode == 'Auto' then
            echo('Current fan mode: auto')
        elseif FanCtrlMode == 'Mixed' then
            echo('Current fan mode: mixed')
        else -- 当前模式为手动
            echo('Current fan mode: manual, timeout ' .. FanTimeout .. ' seconds.\n')
            table.sort(GetCoolingFanList, function(a, b)
                return a.FanId < b.FanId
            end)
            echo('Manual fan level:')
            for i = 1, #GetCoolingFanList do
                local sep = (i % 4 == 1 and '\n' or ', ')
                echo(string.format('%sFan%u: %u', sep, GetCoolingFanList[i].FanId, GetCoolingFanList[i].Level))
            end
        end
        table.sort(GetThermalFanList, function(a, b)
            return a.FanId < b.FanId
        end)
        echo('\nActual fan level:')
        for i = 1, #GetThermalFanList do
            local sep = (i % 4 == 1 and '\n' or ', ')
            local max_supported_pwm = GetThermalFanList[i].MaxSupportedPWM
            -- 防止未定义获取为nil和除0
            if math.type(max_supported_pwm) ~= 'integer' or max_supported_pwm <= 0 then
                max_supported_pwm = 255
            end
            echo(string.format('%sFan%u: %u', sep, GetThermalFanList[i].FanId, GetThermalFanList[i].HardwarePWM * 100 // max_supported_pwm))
        end
    -- 散热设备输入为泵且环境支持泵
    elseif devicetype == 'pump' and PumpSupported == true then
        if PumpCtrlMode == 'Auto' then
            echo('Current pump mode: auto')
        else
            echo('Current pump mode: manual, timeout ' .. PumpTimeout .. ' seconds.\n')
            table.sort(GetCoolingPumpList, function(a, b)
                return a.Id < b.Id
            end)
            echo('Manual pump level:')
            for i = 1, #GetCoolingPumpList do
                local sep = (i%4 == 1 and '\n' or ', ')
                echo(string.format('%sPump%u: %u', sep, GetCoolingPumpList[i].Id, GetCoolingPumpList[i].Level))
            end
        end
        table.sort(GetThermalPumpList, function(a, b)
            return a.Id < b.Id
        end)
        echo('\nActual pump level:')
        for i = 1, #GetThermalPumpList do
            local sep = (i % 4 == 1 and '\n' or ', ')
            local max_supported_pwm = GetThermalPumpList[i].MaxSupportedPWM
            -- 防止未定义获取为nil和除0
            if math.type(max_supported_pwm) ~= 'integer' or max_supported_pwm <= 0 then
                max_supported_pwm = 255
            end
            echo(string.format('%sPump%u: %u', sep, GetThermalPumpList[i].Id, GetThermalPumpList[i].ActualPWM * 100 // max_supported_pwm))
        end
    else -- 未输入或者输入为泵，且不支持泵或者输入其他
        echo_usage(PumpSupported)
    end
%}