summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Maathuis <madman2003@gmail.com>2008-07-03 01:05:07 +0200
committerMaarten Maathuis <madman2003@gmail.com>2008-07-03 01:05:07 +0200
commit02b30739f7676082af4ce92448d910085d1dfc65 (patch)
treee38b180c1338d335876be375c68341fcbac85c2c
parent94cf07bff1bf9a42ba6360f8feaa441b763b337f (diff)
[modeseting-101] add connected field to sysfs
-rw-r--r--linux-core/drm_sysfs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/linux-core/drm_sysfs.c b/linux-core/drm_sysfs.c
index 92371c22..02b08534 100644
--- a/linux-core/drm_sysfs.c
+++ b/linux-core/drm_sysfs.c
@@ -176,6 +176,19 @@ static ssize_t dpms_show(struct device *device,
return snprintf(buf, PAGE_SIZE, "%s", drm_get_dpms_name((int)dpms_status));
}
+static ssize_t connected_show(struct device *device,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct drm_connector *connector = container_of(device, struct drm_connector, kdev);
+ struct drm_device *dev = connector->dev;
+
+ if (connector->encoder)
+ return snprintf(buf, PAGE_SIZE, "connected");
+ else
+ return snprintf(buf, PAGE_SIZE, "disconnected");
+}
+
static ssize_t edid_show(struct kobject *kobj, struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{
@@ -221,6 +234,7 @@ static ssize_t modes_show(struct device *device,
static struct device_attribute connector_attrs[] = {
__ATTR_RO(status),
+ __ATTR_RO(connected),
__ATTR_RO(dpms),
__ATTR_RO(modes),
};