以人类可读的形式获取显示器的品牌和型号以及其他信息


19

我已经提取了连接到计算机的当前监视器的简化版本。
这是一个例子: vendor "VSC", prod id "18500"

在Ubuntu的Monitor Preferences中,它标识为Viewsonic Corporation 16"

如何提取这种可读的表格?...以及如何确定监视器是a CRT还是a LCD?(这实际上是促使我开始执行此任务的原因)

EDID格式可在Wikipedia上找到:扩展的显示标识数据
这是用于获取EDID VendorProduct id

edid=$(xrandr -q --verbose | 
         sed -n '/^[[:space:]]\+00ffffffffffff00/,/[^a-fA-F0-9[:space:]]/{
                                                  /[^a-fA-F0-9[:space:]]/d
                                                  s/[[:space:]]\+//g; p}')
nibble=({0..1}{0..1}{0..1}{0..1})
vend=$(for i in {16..19} ;do 
           printf "%s" ${nibble[$((16#${edid:$i:1}))]}
       done)
vend="$(for i in 1 6 11 ;do
            printf \\x$(printf %x $((2#${vend:$i:5} +64)))
        done)"
prod=$((16#${edid:22:2}${edid:20:2}))
printf "monitor: vendor \"%s\", prod id \"%s\"\n" "${vend}" "$prod"

编辑:这是xrandr -q verboseoutpt 的领先线...直到EDID十六进制转储的结尾

Screen 0: minimum 320 x 200, current 1280 x 960, maximum 8192 x 8192
VGA1 connected 1280x960+0+0 (0x47) normal (normal left inverted right x axis y axis) 320mm x 240mm
        Identifier: 0x41
        Timestamp:  26386
        Subpixel:   unknown
        Clones:    
        CRTC:       0
        CRTCs:      0 1
        Transform:  1.000000 0.000000 0.000000
                    0.000000 1.000000 0.000000
                    0.000000 0.000000 1.000000
                   filter: 
        EDID:
                00ffffffffffff005a63444809000000
                15090101682018b1e84f22a157479925
                0f484ffffe00315945596159714f8140
                818001010101000000ff004848393231
                30303030390a2020000000fd0032781e
                46ff000a202020202020000000fc0056
                696577536f6e696320453737000000fc
                00312d320a2020202020202020200084
  1280x1024 (0x46)  108.0MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock   64.0KHz
        v: height 1024 start 1025 end 1028 total 1066           clock   60.0Hz
  1280x960 (0x47)  ....  
        ...
        ... etc

stackoverflow.com中有类似的主题。
pevik

@ peter-o可能意味着xrandr -q --verbose(您命令中的错字)
dovah

Answers:


8

在Ubuntu的Monitor Preferences中,它被标识为Viewsonic Corporation 16“。如何提取此可读格式?

这种人类可读的格式(“ Viewsonic Corporation”)不是(直接)来自您的EDID:
Ubuntu在下面使用了gnome库。libgnome-desktop 解码edid,并通过pnp-ids将三字母的供应商ID(在特定情况下为“ VSC”)转换为用于显示的漂亮名称

gnome-pnp-ids.c,第51行:

* Note: we now prefer to use data coming from hwdata (and shipped with gnome-desktop)*

在我的系统上

grep VSC /usr/share/hwdata/pnp.ids

返回:

VSC    ViewSonic Corporation

除此之外,可以从EDID,即从描述符块中提取附加信息。来自同一Wikipedia链接:

描述符块。详细的时序描述符,按降序排列。在所有详细的时序描述符之后,可以使用其他描述符:

  • 监视范围限制(必填)
  • ASCII文本(监视器名称(必填),监视器序列号或非结构化文本)
  • 6个其他标准时序信息块
  • 色点数据

当前定义的描述符类型为:

  • 0xFF:监视器序列号(文本)
  • 0xFE:未指定的文本(文本)
  • 0xFD:监视范围限制。6或13字节的二进制描述符。
  • 0xFC:监视器名称(文本)
  • 0xFB:其他白点数据。2个5字节描述符,填充0A 20 20。
  • 0xFA:额外的标准时序标识符。6×2字节描述符,填充0A。

在EDID中0xFF,描述符1(字节54-71)中有(序列号):

00 ff 00 48 48 39 32 31 30 30 30 30 39 0a 20 20 00 00

并且您0xFC在描述符3(字节90-107字节)和描述符4(字节108-125字节)中有(监视器名称):

  00 fc 00 56 69 65 77 53 6f 6e 69 63 20 45 37 37 00 00
  00 fc 00 31 2d 32 0a 20 20 20 20 20 20 20 20 20 00 84

所以这只是从那里提取信息的问题,例如描述符3:

56 69 65 77 53 6f 6e 69 63 20 45 37 37>> 优派E77

有一些Linux工具可以解析EDID ...我使用monitor-edid。这是我的机器上Perl dumper格式的输出:

(
+{
          'EISA_ID' => 'CMO1574',
          'checksum' => 25,
          'detailed_timings' => [
                                  {
                                    'ModeLine' => '"1600x900" 97.75 1600 1648 1680 1760 900 903 908 926 -hsync -vsync',
                                    'ModeLine_comment' => '# Monitor preferred modeline (60.0 Hz vsync, 55.5 kHz hsync, ratio 16/9, 118 dpi)',
                                    'digital_composite' => 3,
                                    'horizontal_active' => 1600,
                                    'horizontal_blanking' => 160,
                                    'horizontal_border' => 0,
                                    'horizontal_dpi' => '118.139534883721',
                                    'horizontal_image_size' => 344,
                                    'horizontal_sync_offset' => 48,
                                    'horizontal_sync_positive' => 0,
                                    'horizontal_sync_pulse_width' => 32,
                                    'interlaced' => 0,
                                    'pixel_clock' => '97.75',
                                    'preferred' => 1,
                                    'stereo' => 0,
                                    'vertical_active' => 900,
                                    'vertical_blanking' => 26,
                                    'vertical_border' => 0,
                                    'vertical_dpi' => '118.445595854922',
                                    'vertical_image_size' => 193,
                                    'vertical_sync_offset' => 3,
                                    'vertical_sync_positive' => 0,
                                    'vertical_sync_pulse_width' => 5
                                  }
                                ],
          'diagonal_size' => '15.5292379824145',
          'edid_revision' => 3,
          'edid_version' => 1,
          'established_timings' => [],
          'extension_flag' => 0,
          'feature_support' => {
                                 'DPMS_active_off' => 0,
                                 'DPMS_standby' => 0,
                                 'DPMS_suspend' => 0,
                                 'GTF_compliance' => 0,
                                 'has_preferred_timing' => 1,
                                 'rgb' => 0,
                                 'sRGB_compliance' => 0
                               },
          'file' => '/sys/class/drm/card0-LVDS-1/edid',
          'gamma' => 120,
          'manufacturer_name' => 'CMO',
          'max_size_horizontal' => '34.4',
          'max_size_precision' => 'mm',
          'max_size_vertical' => '19.3',
          'monitor_details' => '',
          'monitor_text' => [
                              'N156O6-L01',
                              'CMO',
                              'N156O6-L01'
                            ],
          'product_code' => 5492,
          'ratio' => '1.78238341968912',
          'ratio_name' => '16/9',
          'ratio_precision' => 'mm',
          'serial_number' => 0,
          'standard_timings' => [],
          'video_input_definition' => {
                                        'composite_sync' => 0,
                                        'digital' => 1,
                                        'separate_sync' => 0,
                                        'sync_on_green' => 0,
                                        'voltage_level' => 0
                                      },
          'week' => 41,
          'year' => 2008
        }
,
)

最后,我不知道如何确定(在Linux中)监视器是LCD还是CRT。我不知道任何库的实现这种功能(像这样一个从MS)。


那是一个很好的答案。感谢您的努力。
Peter.O 2013年

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.