首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何从Linux命令行确定LCD监视器是否已打开

如何从Linux命令行确定LCD监视器是否已打开
EN

Stack Overflow用户
提问于 2010-08-08 13:26:11
回答 7查看 23.7K关注 0票数 29

在Linux中,如何判断计算机的监视器是否从命令行打开/关闭?我传统上认为监视器是只输出的设备,但我注意到Gnome监视器首选项对话框具有“检测监视器”功能。这是否可以推广到确定监视器是否被物理关闭?

EN

回答 7

Stack Overflow用户

发布于 2010-08-12 03:17:56

VESA DDC连接是可用于查询监视器是否存在的I2C连接。

Linux exposes the I2C device和userland程序可以通过http://jaffar.cs.msu.su/oleg/ddcci/之类的代码直接与监视器通信

注意下面的内容:Control 0xe1: +/1/1 [SAM: Power control (0 - off/1 - on)]

代码语言:javascript
复制
# ddcci-tool /dev/i2c-2 -e -c -d


ddcci-tool version 0.03

Reading EDID : 0x50@/dev/i2c-2
    Plug and Play ID: SAM00BA
    Input type: Analog

Using ddc/ci : 0x37@/dev/i2c-2

Capabilities:
(type(LCD)vcp(04 05 10 12 60(1 3) B0(1 2) B6 C6 C8 C9 D6(1 4) DC(1 2 3 4) DF))

Controls (valid/current/max):
Control 0x04: +/0/1 [Reset Factory Defaults]
Control 0x05: +/0/1 [SAM: Reset Brightness and Contrast]
Control 0x06: +/0/1 [Reset Factory Geometry]
Control 0x08: +/0/1 [Reset Factory Default Color]
Control 0x0e: +/60/120 [SAM: Image Lock Coarse]
Control 0x10: +/0/100 [Brightness]
Control 0x12: +/50/100 [Contrast]
Control 0x16: +/8/16 [Red Video Gain]
Control 0x18: +/8/16 [Green Video Gain]
Control 0x1a: +/8/16 [Blue Video Gain]
Control 0x1e: +/0/2 [SAM: Auto Size Center]
Control 0x20: +/50/100 [Horizontal Position]
Control 0x30: +/25/54 [Vertical Position]
Control 0x3e: +/39/50 [SAM: Image Lock Fine]
Control 0x60: +/1/3 [Input Source Select]
Control 0x62: +/0/100 [Audio Speaker Volume Adjust]
Control 0x6c: +/140/255 [Red Video Black Level]
Control 0x6e: +/127/255 [Green Video Black Level]
Control 0x70: +/121/255 [Blue Video Black Level]
Control 0xb0: +/0/2 [Settings]
Control 0xb6: +/3/8 [???]
Control 0xc6: +/1/1 [???]
Control 0xc8: +/5/16 [???]
Control 0xc9: +/1/0 [???]
Control 0xca: +/2/2 [On Screen Display]
Control 0xcc: +/2/11 [SAM: On Screen Display Language]
Control 0xd6: +/1/4 [SAM: DPMS control (1 - on/4 - stby)]
Control 0xdc: +/4/4 [SAM: MagicBright (1 - text/2 - internet/3 - entertain/4 - custom)]
Control 0xdf: +/512/0 [VCP Version]
Control 0xe0: +/0/2 [SAM: Color preset (0 - normal/1 - warm/2 - cool)]
Control 0xe1: +/1/1 [SAM: Power control (0 - off/1 - on)]
Control 0xe2: +/0/1 [???]
Control 0xed: +/108/255 [SAM: Red Video Black Level]
Control 0xee: +/101/255 [SAM: Green Video Black Level]
Control 0xef: +/103/255 [SAM: Blue Video Black Level]

一个有趣的问题是,您的监视器是否返回这段数据,如果没有,如果当前关闭,它是否会响应。

票数 15
EN

Stack Overflow用户

发布于 2013-04-21 18:58:04

来自systembash.com的代码摘自链接,以防有一天它会宕机:

代码语言:javascript
复制
#!/bin/bash
export DISPLAY=:0.0

if [ $# -eq 0 ]; then
  echo usage: $(basename $0) "on|off|status"
  exit 1
fi

if [ $1 = "off" ]; then
  echo -en "Turning monitor off..."
  xset dpms force off
  echo -en "done.\nCheck:"
  xset -q|grep "Monitor is"
elif [ $1 = "on" ]; then
  echo -en "Turning monitor on..."
  xset dpms force on
  echo -en "done.\nCheck:"
  xset -q|grep "Monitor is"
elif [ $1 = "status" ]; then
  xset -q|sed -ne 's/^[ ]*Monitor is //p'
else 
  echo usage: $(basename $0) "on|off|status"
fi
票数 15
EN

Stack Overflow用户

发布于 2010-08-08 22:14:57

如果您的视频驱动程序支持此扩展,您可以使用xrandr命令行实用程序获取一些信息。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3433203

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档