Closed tzeikob closed 8 months ago
@lyterk could you take a look?
Taking a look
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.
@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
.
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.
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.
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)
@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:
$HOME/.local/share/jc/jcparsers
$HOME/Library/Application Support/jc/jcparsers
$LOCALAPPDATA\jc\jc\jcparsers
fix in v1.25.1
@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!
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?
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"
}
@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!
Will do
@kellyjonbrazil PR opened, #547
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
JC parser output
The device
DP-4
supposed to have the following propertiesmodel_name
,product_id
andserial_number
.