Linux下LCD自動關閉解決方案

來源:互聯網
上載者:User

主機環境:Gentoo Linux 11.2
核心版本:Linux Kernel 3.2.1
正常情況下Linux會在一段時間後預設關閉螢幕,預設為10分鐘。這裡你可能會認為是Gnome或KDE等案頭環境設定的螢幕保護裝置程式或電源管理功能,即使不安裝案頭環境螢幕照樣會自動關閉。
下面就來分析下原因。
看到網上的資料說這是由vt驅動來設定的。
下面進入核心源碼目錄下的drivers檔案夾,後執行
grep blankinterval ./* -R 

搜尋那個檔案中設定了該變數。

搜尋結果如下:
./tty/vt/vt.c:static void blank_screen_t(unsigned long dummy);
./tty/vt/vt.c:static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
./tty/vt/vt.c:static void blank_screen_t(unsigned long dummy)
下面開啟該檔案修改大約180行的位置
static int vesa_blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ 
static int vesa_off_interval; 
//static int blankinterval = 10*60; 
static int blankinterval = 0; 
core_param(consoleblank, blankinterval, int, 0444); 
這樣只是初始化的時候將其預設設定為0,這樣朝陽可以通過使用者程式對其進行設定。
 
當然還有其他的解決方案,總結如下:
1.修改LCD驅動,把關閉LCD控制器的函數變為空白(不推薦)
2.修改vt.c中的blank_screen_t()函數,讓其為空白(在系統不需要使用關閉顯示功能時推薦)
3.修改vt.c中的blankinterval,讓其為0(系統可能需要使用關閉顯示功能,而且希望系統上電後正常狀態下不會關閉顯示時推薦)
4.修改使用者程式,加入設定blankinterval的代碼(推薦)


摘自 閆明的部落格

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.