/usr/lib/2013.com.canonical.certification:plainbox-resources/bin/display_resource is in plainbox-provider-resource-generic 0.3-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #!/usr/bin/python3
import re
import sys
import subprocess
CONNECTOR_RE = re.compile(
r"\n(?P<Name>[\w\-]+)"
r"(?:\s+.*?"
r"SignalFormat:\s+(?P<SignalFormat>[\w\-_]+)\s+.*?"
r"ConnectorType:\s+(?P<ConnectorType>[\w\-_]+))?", re.S)
SVIDEO_RE = re.compile(r"s\-?video|din|cv", re.I)
DP_RE = re.compile(r"dp|displayport", re.I)
def main():
try:
xrandr_output = subprocess.check_output(
["xrandr", "-q", "--verbose"], universal_newlines=True)
except subprocess.CalledProcessError:
return 0
xrandr_output = "\n" + ''.join(xrandr_output.splitlines(True)[1:])
supported_connections = dict()
for m in CONNECTOR_RE.finditer(xrandr_output):
name = m.group('Name').lower()
signal_format = connector_type = '' # RandR 1.3 only
if m.group('SignalFormat'):
signal_format = m.group('SignalFormat').lower()
if m.group('ConnectorType'):
connector_type = m.group('ConnectorType').lower()
if name.startswith('vga'):
supported_connections['vga'] = 'supported'
elif name.startswith('dvi'):
supported_connections['dvi'] = 'supported'
elif DP_RE.match(name):
# HDMI uses TMDS links, DisplayPort (DP) uses LVDS pairs (lanes)
# to transmit micro data packets.
# Reported by NVIDIA proprietary drivers (version >= 302.17)
if signal_format == 'tmds':
supported_connections['hdmi'] = 'supported'
else:
supported_connections['dp'] = 'supported'
elif name.startswith('hdmi'):
supported_connections['hdmi'] = 'supported'
elif SVIDEO_RE.match(name):
supported_connections['svideo'] = 'supported'
elif name.startswith('rca'):
supported_connections['rca'] = 'supported'
elif name.startswith('tv'):
if SVIDEO_RE.match(signal_format):
supported_connections['svideo'] = 'supported'
else:
supported_connections['tv'] = 'supported'
# ATI/AMD proprietary FGLRX graphics driver codenames:
elif name.startswith('crt') or name.startswith('dfp'):
if connector_type.startswith('dvi'):
supported_connections['dvi'] = 'supported'
elif connector_type.startswith('vga'):
supported_connections['vga'] = 'supported'
elif DP_RE.match(connector_type) and DP_RE.match(signal_format):
supported_connections['dp'] = 'supported'
else:
# HDMI ports may appear as unknown
# (for both signal format and connector type).
supported_connections['hdmi'] = 'supported'
for connector in supported_connections.keys():
print("%s: supported" % connector)
return 0
if __name__ == "__main__":
sys.exit(main())
|