通过命令行显示监视器信息

通过命令行显示监视器信息

有没有办法从命令行查询显示器信息?例如,获取显示器型号,类似于获取lspci显卡信息,或者当前是开启还是关闭,诸如此类。

如果可能的话,上述哪些基本信息可以轻松收集?例如,是否可以确定显示器是纵向还是横向?或者它是否有内置扬声器?

命令行是首选,但如果有 GUI 方法,我也想听听。

答案1

就在这里,已读 VESA PnP 监视器的硬件信息收集工具。此工具有两个命令:get-edidparse-edid使用 VESA VBE DDC 协议检索和解释显示器规格的工具扩展显示识别码扩展显示标识数据) 是显示设备向视频源描述其功能的元数据格式。

第一的:

sudo apt-get install read-edid

然后尝试:

sudo get-edid | parse-edid

答案2

get-edid不显示所有监视器的情况

像我一样,我有:

$ lshw -c display
  *-display               
       description: VGA compatible controller
       product: 3rd Gen Core processor Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 09
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:27 memory:f6400000-f67fffff memory:e0000000-efffffff ioport:f000(size=64)

get-edid仅显示插入 VGA 端口的外接显示器。

  1. 安装read-edid

     sudo apt-get install read-edid
    
  2. 直接从 SYSFS 树读取 EDID 信息,它应该显示所有检测到的监视器

     ls /sys/class/drm/*/edid | xargs -i{} sh -c "echo {}; parse-edid < {}"
    

答案3

$ grep "NVIDIA(GPU-0)" /var/log/Xorg.0.log |head -17| cut -d\: -f2
 Display (Samsung SA300/SA350 (DFP-0)) does not support NVIDIA
     3D Vision stereo.
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "1920x1080" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "1920x1080".
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "1280x720" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "1280x720".
 The EDID for Samsung SA300/SA350 (DFP-0) contradicts itself
     mode "720x576" is specified in the EDID; however, the
     EDID's valid VertRefresh range (56.000-75.000 Hz) would
     exclude this mode's VertRefresh (50.0 Hz); ignoring
     VertRefresh check for mode "720x576".

答案4

这将为您提供所需的所有信息:

dbus-send --session --print-reply --dest=org.gnome.Mutter.DisplayConfig /org/gnome/Mutter/DisplayConfig org.gnome.Mutter.DisplayConfig.GetCurrentState

相关内容