summaryrefslogtreecommitdiffstats
path: root/src/blueshift_drm_c.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-12 04:39:24 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-12 04:39:24 +0100
commit06f3e5eb7b1efdba086ca178105617c0a85d0290 (patch)
tree19c576f1b686e51e7b1d0ad18da96d55e50a5aa2 /src/blueshift_drm_c.c
parentgamma size retrieval (diff)
downloadblueshift-06f3e5eb7b1efdba086ca178105617c0a85d0290.tar.gz
blueshift-06f3e5eb7b1efdba086ca178105617c0a85d0290.tar.bz2
blueshift-06f3e5eb7b1efdba086ca178105617c0a85d0290.tar.xz
monitor data
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/blueshift_drm_c.c')
-rw-r--r--src/blueshift_drm_c.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c
index c9dea2f..afd27d9 100644
--- a/src/blueshift_drm_c.c
+++ b/src/blueshift_drm_c.c
@@ -166,10 +166,44 @@ int main(int argc, char** argv)
blueshift_drm_open(0);
blueshift_drm_update();
+
printf("CRTC count: %i\n", blueshift_drm_crtc_count());
printf("Connector count: %i\n", blueshift_drm_connector_count());
printf("Gamma size: %i\n", blueshift_drm_gamma_size(0));
+ drmModeConnector* connector = drmModeGetConnector(drm_fd, *(drm_res->connectors + 2));
+ printf("Physical size: %i mm by %i mm\n", connector->mmWidth, connector->mmHeight);
+ /* Accurate dimension on area not covered by the edges */
+ printf("Connected: %i\n", connector->connection == DRM_MODE_CONNECTED);
+ /* DRM_MODE_DISCONNECTED DRM_MODE_UNKNOWNCONNECTION */
+ printf("Encoder: %i\n", connector->encoder_id);
+ static char* types[] = {"Unknown", "VGA", "DVII", "DVID", "DVIA", "Composite", "SVIDEO", "LVDS",
+ "Component", "9PinDIN", "DisplayPort", "HDMIA", "HDMIB", "TV", "eDP",
+ "VIRTUAL", "DSI"};
+ printf("Type: %s (%i)\n", types[connector->connector_type], connector->connector_type);
+ int i;
+ for (i = 0; i < connector->count_props; i++)
+ {
+ drmModePropertyRes* prop;
+ prop = drmModeGetProperty(drm_fd, connector->props[i]);
+ if (!strcmp("EDID", prop->name))
+ {
+ drmModePropertyBlobRes* blob = drmModeGetPropertyBlob(drm_fd, connector->prop_values[i]);
+ char* value = alloca((blob->length * 2 + 1) * sizeof(char));
+ uint32_t j;
+ for (j = 0; j < blob->length; j++)
+ {
+ *(value + j * 2 + 0) = "0123456789abcdef"[(*((char*)(blob->data) + j) >> 4) & 15];
+ *(value + j * 2 + 1) = "0123456789abcdef"[(*((char*)(blob->data) + j) >> 0) & 15];
+ }
+ *(value + blob->length * 2) = 0;
+ printf("%s: %s\n", prop->name, value);
+ drmModeFreePropertyBlob(blob);
+ }
+ drmModeFreeProperty(prop);
+ }
+ drmModeFreeConnector(connector);
+
blueshift_drm_close();
return 0;