kellyjonbrazil / jc

CLI tool and python library that converts the output of popular command-line tools, file-types, and common strings to JSON, YAML, or Dictionaries. This allows piping of output to tools like jq and simplifying automation scripts.
MIT License
7.87k stars 207 forks source link

Xrandr parser seems to be broken not extracting display EDID data #525

Closed tzeikob closed 8 months ago

tzeikob commented 9 months ago

The latest changes, perhaps #455, on the xrandr parser may introduced a malfunction as now the parser seems to be unable to extract the EDID information per device when xrandr is called with the --props option.

Xrandr output xrandr --props

Screen 0: minimum 8 x 8, current 2560 x 1440, maximum 32767 x 32767
DVI-D-0 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: TMDS 
                supported: TMDS
        ConnectorType: DVI-D 
        ConnectorNumber: 0 
        _ConnectorLocation: 0 
HDMI-0 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: TMDS 
                supported: TMDS
        ConnectorType: HDMI 
        ConnectorNumber: 3 
        _ConnectorLocation: 3 
DP-0 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: DisplayPort 
                supported: DisplayPort
        ConnectorType: DisplayPort 
        ConnectorNumber: 4 
        _ConnectorLocation: 4 
DP-1 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: TMDS 
                supported: TMDS
        ConnectorType: DisplayPort 
        ConnectorNumber: 4 
        _ConnectorLocation: 4 
DP-2 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: DisplayPort 
                supported: DisplayPort
        ConnectorType: DisplayPort 
        ConnectorNumber: 2 
        _ConnectorLocation: 2 
DP-3 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: TMDS 
                supported: TMDS
        ConnectorType: DisplayPort 
        ConnectorNumber: 2 
        _ConnectorLocation: 2 
DP-4 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        EDID: 
                00ffffffffffff0010ac33424c303541
                0f210104b53c22783eee95a3544c9926
                0f5054a54b00714f8180a9c0a940d1c0
                010101010101565e00a0a0a029503020
                350055502100001a000000ff00365339
                353350330a2020202020000000fc0044
                454c4c20553237323244450a000000fd
                00314c1e5a19010a2020202020200182
                020319f14c90040302011112131f2021
                2223097f0783010000023a801871382d
                40582c450055502100001e7e3900a080
                381f4030203a0055502100001a011d00
                7251d01e206e28550055502100001ebf
                1600a08038134030203a005550210000
                1a000000000000000000000000000000
                00000000000000000000000000000006
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: DisplayPort 
                supported: DisplayPort
        ConnectorType: DisplayPort 
        ConnectorNumber: 1 
        _ConnectorLocation: 1 
   2560x1440     59.95*+
   2048x1080     60.00    24.00  
   1920x1080     60.00    59.94    50.00    29.97    25.00    23.98  
   1600x1200     60.00  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    59.94    59.93  
DP-5 disconnected (normal left inverted right x axis y axis)
        CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 
                0 1 
        CscMatrix: 65536 0 0 0 0 65536 0 0 0 0 65536 0 
        BorderDimensions: 4 
                supported: 4
        Border: 0 0 0 0 
                range: (0, 65535)
        SignalFormat: TMDS 
                supported: TMDS
        ConnectorType: DisplayPort 
        ConnectorNumber: 1 
        _ConnectorLocation: 1

JC parser output

{
  "screens": [
    {
      "devices": [
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DVI-D-0",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "HDMI-0",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-0",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-1",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-2",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-3",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [
            {
              "resolution_width": 2560,
              "resolution_height": 1440,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.95,
                  "is_current": true,
                  "is_preferred": true
                }
              ]
            },
            {
              "resolution_width": 2048,
              "resolution_height": 1080,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 24,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1920,
              "resolution_height": 1080,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 50,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 29.97,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 25,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 23.98,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1600,
              "resolution_height": 1200,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1600,
              "resolution_height": 900,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 1024,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.02,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.02,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 720,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 50,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1152,
              "resolution_height": 864,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1024,
              "resolution_height": 768,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.03,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 800,
              "resolution_height": 600,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.32,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 720,
              "resolution_height": 576,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 50,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 720,
              "resolution_height": 480,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 480,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.93,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            }
          ],
          "is_connected": true,
          "is_primary": true,
          "device_name": "DP-4",
          "rotation": "normal",
          "reflection": "normal",
          "resolution_width": 2560,
          "resolution_height": 1440,
          "offset_width": 0,
          "offset_height": 0,
          "dimension_width": 597,
          "dimension_height": 336
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-5",
          "rotation": "normal",
          "reflection": "normal"
        }
      ],
      "screen_number": 0,
      "minimum_width": 8,
      "minimum_height": 8,
      "current_width": 2560,
      "current_height": 1440,
      "maximum_width": 32767,
      "maximum_height": 32767
    }
  ]
}

The device DP-4 supposed to have the following properties model_name, product_id and serial_number.

kellyjonbrazil commented 9 months ago

@lyterk could you take a look?

lyterk commented 9 months ago

Taking a look

lyterk commented 8 months ago

I think I'm gonna start tracking indentation state-- I was just swallowing it all in regexes, but it is significant to saving key values data for devices. Hopefully should preempt some other issues.

lyterk commented 8 months ago

@tzeikob Could you please provide the output of xrandr --version?

The output you provided for your test file is somewhat different from on my machine, so I'd like to figure out how defensive I have to be about parsing.

It's easier if I can use tabs to handle parsing, like I would for writing a python parser, but for some reason your test file uses spaces instead of tabs, for example in xrandr_properties.out.

tzeikob commented 8 months ago

Please find all the information about my system below:

OS: Ubuntu 18.04.6 LTS x86_64 Kernel: 5.4.0-150-generic Xrandr version: xrandr program version 1.5.0 Server reports RandR version 1.5 GPU: NVIDIA GeForce GTX 1080 Ti

As for the tabs, I can't remember actually right now but I think my intention was to treat any white spaces (spaces, tabs) as just spaces. In my opinion the regular expressions should be this way as tabs are just blank spaces after all.

lyterk commented 8 months ago

Thanks for providing that, similar enough to my system.

regular expressions should be this way as tabs are just blank spaces after all.

I was hoping I would be able to do that, but unfortunately that didn't work out for me. On my systems, it obligatorily has e.g. 3 spaces in front of the resolution modes (1680x1050 59.95 59.88), and some number of tabs before props (EDID etc). So there's no good way to resolve the indirection without at least considering tabs vs spaces, instead of just generic whitespace.

I'm using that along with my regexes to pre-identify lines before populating them into our structures. I should have a commit for tomorrow.

tzeikob commented 8 months ago

I see, here another setup I have that might be helpful:

OS: ArchLinux x86_64 Kernel: 6.7.2-arch1-1 Xrandr version: xrandr program version 1.5.2 Server reports RandR version 1.6 GPU: Intel Integrated CPU

xrandr --props

Screen 0: minimum 320 x 200, current 2806 x 900, maximum 8192 x 8192
LVDS-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
    EDID:
        00ffffffffffff004ca3523100000000
        0014010380221378eac8959e57549226
        0f505400000001010101010101010101
        010101010101381d56d4500016303020
        250058c2100000190000000f00000000
        000000000025d9066a00000000fe0053
        414d53554e470a204ca34154000000fe
        004c544e313536415432343430310018
    scaling mode: Full aspect
        supported: Full, Center, Full aspect
    link-status: Good
        supported: Good, Bad
    CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
        0 1
    CONNECTOR_ID: 61
        supported: 61
    non-desktop: 0
        range: (0, 1)
   1366x768      60.00*+
   1280x720      60.00    59.99    59.86    59.74
   1024x768      60.04    60.00
   960x720       60.00
   928x696       60.05
   896x672       60.01
   1024x576      59.95    59.96    59.90    59.82
   960x600       59.93    60.00
   960x540       59.96    59.99    59.63    59.82
   800x600       60.00    60.32    56.25
   840x525       60.01    59.88
   864x486       59.92    59.57
   700x525       59.98
   800x450       59.95    59.82
   640x512       60.02
   700x450       59.96    59.88
   640x480       60.00    59.94
   720x405       59.51    58.99
   684x384       59.88    59.85
   640x400       59.88    59.98
   640x360       59.86    59.83    59.84    59.32
   512x384       60.00
   512x288       60.00    59.92
   480x270       59.63    59.82
   400x300       60.32    56.34
   432x243       59.92    59.57
   320x240       60.05
   360x202       59.51    59.13
   320x180       59.84    59.32
VGA-1 connected 1440x900+1366+0 (normal left inverted right x axis y axis) 408mm x 255mm
    EDID:
        00ffffffffffff000469d41901010101
        2011010308291a78ea8585a6574a9c26
        125054bfef80714f8100810f81408180
        9500950f01019a29a0d0518422305098
        360098ff1000001c000000fd00374b1e
        530f000a202020202020000000fc0041
        535553205657313933530a20000000ff
        0037384c383032313130370a20200077
    link-status: Good
        supported: Good, Bad
    CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
        0 1
    CONNECTOR_ID: 65
        supported: 65
    non-desktop: 0
        range: (0, 1)
   1440x900      59.89*+  74.98
   1280x1024     75.02    60.02
   1280x960      60.00
   1280x800      74.93    59.81
   1152x864      75.00
   1024x768      75.03    70.07    60.00
   832x624       74.55
   800x600       72.19    75.00    60.32    56.25
   640x480       75.00    72.81    66.67    59.94
   720x400       70.08
HDMI-1 disconnected (normal left inverted right x axis y axis)
    max bpc: 12
        range: (8, 12)
    content type: No Data
        supported: No Data, Graphics, Photo, Cinema, Game
    Colorspace: Default
        supported: Default, SMPTE_170M_YCC, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, DCI-P3_RGB_Theater
    aspect ratio: Automatic
        supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic
        supported: Automatic, Full, Limited 16:235
    audio: auto
        supported: force-dvi, off, auto, on
    link-status: Good
        supported: Good, Bad
    CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
        0 1
    CONNECTOR_ID: 68
        supported: 68
    non-desktop: 0
        range: (0, 1)
DP-1 disconnected (normal left inverted right x axis y axis)
    Colorspace: Default
        supported: Default, BT709_YCC, XVYCC_601, XVYCC_709, SYCC_601, opYCC_601, opRGB, BT2020_CYCC, BT2020_RGB, BT2020_YCC, DCI-P3_RGB_D65, RGB_WIDE_FIXED, RGB_WIDE_FLOAT, BT601_YCC
    max bpc: 12
        range: (6, 12)
    Broadcast RGB: Automatic
        supported: Automatic, Full, Limited 16:235
    audio: auto
        supported: force-dvi, off, auto, on
    subconnector: Unknown
        supported: Unknown, VGA, DVI-D, HDMI, DP, Wireless, Native
    link-status: Good
        supported: Good, Bad
    CTM: 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
        0 1
    CONNECTOR_ID: 76
        supported: 76
    non-desktop: 0
        range: (0, 1)

xrandr --props | jc --xrandr

{
  "screens": [
    {
      "devices": [
        {
          "modes": [
            {
              "resolution_width": 1366,
              "resolution_height": 768,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": true,
                  "is_preferred": true
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 720,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.99,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.86,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.74,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1024,
              "resolution_height": 768,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.04,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 960,
              "resolution_height": 720,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 928,
              "resolution_height": 696,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.05,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 896,
              "resolution_height": 672,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.01,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1024,
              "resolution_height": 576,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.95,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.96,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.9,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.82,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 960,
              "resolution_height": 600,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.93,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 960,
              "resolution_height": 540,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.96,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.99,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.63,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.82,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 800,
              "resolution_height": 600,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.32,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 56.25,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 840,
              "resolution_height": 525,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.01,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.88,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 864,
              "resolution_height": 486,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.92,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.57,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 700,
              "resolution_height": 525,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.98,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 800,
              "resolution_height": 450,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.95,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.82,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 512,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.02,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 700,
              "resolution_height": 450,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.96,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.88,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 480,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 720,
              "resolution_height": 405,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.51,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 58.99,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 684,
              "resolution_height": 384,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.88,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.85,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 400,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.88,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.98,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 360,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.86,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.83,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.84,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.32,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 512,
              "resolution_height": 384,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 512,
              "resolution_height": 288,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.92,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 480,
              "resolution_height": 270,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.63,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.82,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 400,
              "resolution_height": 300,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.32,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 56.34,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 432,
              "resolution_height": 243,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.92,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.57,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 320,
              "resolution_height": 240,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.05,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 360,
              "resolution_height": 202,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.51,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.13,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 320,
              "resolution_height": 180,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.84,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.32,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            }
          ],
          "is_connected": true,
          "is_primary": true,
          "device_name": "LVDS-1",
          "rotation": "normal",
          "reflection": "normal",
          "resolution_width": 1366,
          "resolution_height": 768,
          "offset_width": 0,
          "offset_height": 0,
          "dimension_width": 344,
          "dimension_height": 194,
          "model_name": "Generic",
          "product_id": "12626",
          "serial_number": "0"
        },
        {
          "modes": [
            {
              "resolution_width": 1440,
              "resolution_height": 900,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.89,
                  "is_current": true,
                  "is_preferred": true
                },
                {
                  "frequency": 74.98,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 1024,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.02,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.02,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 960,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1280,
              "resolution_height": 800,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 74.93,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.81,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1152,
              "resolution_height": 864,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 1024,
              "resolution_height": 768,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.03,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 70.07,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.0,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 832,
              "resolution_height": 624,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 74.55,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 800,
              "resolution_height": 600,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 72.19,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 75.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 60.32,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 56.25,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 640,
              "resolution_height": 480,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 75.0,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 72.81,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 66.67,
                  "is_current": false,
                  "is_preferred": false
                },
                {
                  "frequency": 59.94,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            },
            {
              "resolution_width": 720,
              "resolution_height": 400,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 70.08,
                  "is_current": false,
                  "is_preferred": false
                }
              ]
            }
          ],
          "is_connected": true,
          "is_primary": false,
          "device_name": "VGA-1",
          "rotation": "normal",
          "reflection": "normal",
          "resolution_width": 1440,
          "resolution_height": 900,
          "offset_width": 1366,
          "offset_height": 0,
          "dimension_width": 408,
          "dimension_height": 255
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "HDMI-1",
          "rotation": "normal",
          "reflection": "normal"
        },
        {
          "modes": [],
          "is_connected": false,
          "is_primary": false,
          "device_name": "DP-1",
          "rotation": "normal",
          "reflection": "normal"
        }
      ],
      "screen_number": 0,
      "minimum_width": 320,
      "minimum_height": 200,
      "current_width": 2806,
      "current_height": 900,
      "maximum_width": 8192,
      "maximum_height": 8192
    }
  ]
}

All of my systems having installed the latest jc version: jc version: 1.24.0

Only the python version differs: python interpreter version: 3.10.9 instead of 3.11.6 (ArchLinux)

kellyjonbrazil commented 8 months ago

@tzeikob could you test with the latest xrandr parser in the dev branch?

https://github.com/kellyjonbrazil/jc/blob/dev/jc/parsers/xrandr.py

You should be able to copy the file above to the jc parser plugins directory on your system:

kellyjonbrazil commented 8 months ago

fix in v1.25.1

tzeikob commented 8 months ago

@kellyjonbrazil I see the schema has been chaged a bit, now having all props under a separated field with the corresponding key name. Not a big deal, I need though to update my code to comply with the new schema!

@lyterk thanks for your time, both guys!

kellyjonbrazil commented 8 months ago

Do we need to update the schema docs? I'll also add some higher-level tests so we can detect a schema change in the future. @lyterk can we go back to the original schema?

tzeikob commented 8 months ago

The addition of the props member is a nice to have information for anyone who wants to use those detailed EDID data and so we can keep it as root field of the device object. My suggestion though is to allow a bit of redundancy by having the members name, product_id and serial_number of props.EdidModel duplicated at the root level of the device object:

Device Schema:


        {
          "props": {
            "CTM": [""],
            "CscMatrix": [""],
            "EDID": [""],
            "BorderDimensions": [""],
            "Border": [""],
            "SignalFormat": [""],
            "ConnectorType": [""],
            "ConnectorNumber": [""],
            "_ConnectorLocation": [""],
            "EdidModel": {
              "name": "DELL U2722DE",
              "product_id": "16947",
              "serial_number": "6S953P3"
            }
          },
          "resolution_modes": [
            {
              "resolution_width": 2560,
              "resolution_height": 1440,
              "is_high_resolution": false,
              "frequencies": [
                {
                  "frequency": 59.95,
                  "is_current": true,
                  "is_preferred": true
                }
              ]
            }
          ],
          "is_connected": true,
          "is_primary": true,
          "device_name": "DP-4",
          "rotation": "normal",
          "reflection": "normal",
          "resolution_width": 2560,
          "resolution_height": 1440,
          "offset_width": 0,
          "offset_height": 0,
          "dimension_width": 597,
          "dimension_height": 336,
          "model_name": "DELL U2722DE",
          "product_id": "16947",
          "serial_number": "6S953P3"
        }
kellyjonbrazil commented 8 months ago

@lyterk could you add a PR in the dev branch to update the schema documentation? After that I'll add some tests to make sure any schema changes are flagged in the future. Thanks!

lyterk commented 7 months ago

Will do

lyterk commented 7 months ago

@kellyjonbrazil PR opened, #547