求大神把这个win下屏幕PWM控制软件编译成ubuntu能用的

由本社区发起的开源项目
回复
Nemo_o
帖子: 3
注册时间: 2014-10-06 11:40
系统: win7&ubuntu
送出感谢: 3 次
接收感谢: 0

求大神把这个win下屏幕PWM控制软件编译成ubuntu能用的

#1

帖子 Nemo_o » 2014-10-06 12:17

我是编程小白,在windows下发现了这个能控制笔记本屏幕PWM频率软件[IntelPWMControl],提高频率后,用手指在屏幕前挥动不再有不连续的残影了,眼睛也舒服了许多。
能不能把这个软件改成在linux下也能用?我有源代码!

软件的下载地址:http://pan.baidu.com/s/1pJnwq8r

源代码:

代码: 全选

// this file is in the public domain

#include <windows.h>
#include <objbase.h>
#include <stdio.h>

#undef NDEBUG
#include <assert.h>

struct ICUIPower : public IUnknown
{
  virtual HRESULT STDMETHODCALLTYPE IsSupported(LPBOOL pSupported);
  virtual HRESULT STDMETHODCALLTYPE dummy1();
  virtual HRESULT STDMETHODCALLTYPE dummy2();
  virtual HRESULT STDMETHODCALLTYPE dummy3();
  virtual HRESULT STDMETHODCALLTYPE dummy4();
  virtual HRESULT STDMETHODCALLTYPE GetPWMFrequency(LPUINT puiInverterType, LPDWORD pdwPWMFreq, LPDWORD pdwErrorCodes);
  virtual HRESULT STDMETHODCALLTYPE SetPWMFrequency(UINT uiInverterType, DWORD dwPWMFreq, LPDWORD pdwErrorCodes);
};

int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  int targetPWMFreq = 500;
  sscanf_s(lpCmdLine, "%d", &targetPWMFreq);
  targetPWMFreq = max(targetPWMFreq, 50);
  targetPWMFreq = min(targetPWMFreq, 1050);
  assert(SUCCEEDED(CoInitialize(0)));
  CLSID clsid = { 0xC332C124, 0x340D, 0x4430, { 0xAA, 0x0D, 0xC7, 0x56, 0x02, 0x87, 0x6F, 0xCC } };
  IID IID_ICUIPower = { 0x299D88F9, 0x2CBD, 0x4225, { 0xBF, 0x19, 0xFC, 0xD1, 0x64, 0xC5, 0x4C, 0x3F } };
  IUnknown *pUnknown;
  assert(SUCCEEDED(CoCreateInstance(clsid, 0, CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**)&pUnknown)));
  ICUIPower *pCUIPower;
  assert(SUCCEEDED(pUnknown->QueryInterface(IID_ICUIPower, (void**)&pCUIPower)));
  while (1)
  {
    UINT uiInverterType = 0;
    DWORD dwPWMFreq = 0,
          dwErrorCodes = 0;
    assert(SUCCEEDED(pCUIPower->GetPWMFrequency(&uiInverterType, &dwPWMFreq, &dwErrorCodes)));
    if (dwPWMFreq != targetPWMFreq)
    {
      dwPWMFreq = targetPWMFreq;
      assert(SUCCEEDED(pCUIPower->SetPWMFrequency(uiInverterType, dwPWMFreq, &dwErrorCodes)));
    }
    Sleep(1000);
  }
  pCUIPower->Release();
  pUnknown->Release();
  CoUninitialize();
  return 0;
}
附件
解决pwm频闪_专门网论坛_IntelPWMControl.zip
IntelPWMControl
(72.31 KiB) 下载 108 次
buntutu
帖子: 61
注册时间: 2009-11-25 1:38
送出感谢: 0
接收感谢: 6 次

Re: 求大神把这个win下屏幕PWM控制软件编译成ubuntu能用的

#2

帖子 buntutu » 2014-10-06 13:56

这些用户感谢了作者 buntutu 于这个帖子:
Nemo_o (2014-10-06 14:02)
评价: 3.7%
回复

回到 “开源小工具”