From: "Ilya A. Volynets-Evenbakh" <ilya@total-knowledge.com>
To: linux-acpi@vger.kernel.org
Subject: [PATCH] add access to ACPI docking station UID
Date: Mon, 19 Feb 2007 15:19:31 -0800 [thread overview]
Message-ID: <45DA3083.9080604@total-knowledge.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 341 bytes --]
It is useful to know whether your laptop is docked or not,
but it is even more useful to know which docking station it's
docked to. Attached patch adds "uid" file to sysfs.
Tested on Dell Latitude D600 with D/Dock.
Patch is against official 2.6.20 release.
--
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
http://www.total-knowledge.com
[-- Attachment #2: acpi-dock-uid.diff --]
[-- Type: text/plain, Size: 1107 bytes --]
--- linux-2.6.20.orig/drivers/acpi/dock.c 2007-02-04 10:44:54.000000000 -0800
+++ linux-2.6.20/drivers/acpi/dock.c 2007-02-19 14:43:39.000000000 -0800
@@ -659,6 +659,23 @@
}
DEVICE_ATTR(undock, S_IWUSR, NULL, write_undock);
+/*
+ * show_dock_uid - read method for "uid" file in sysfs
+ */
+static ssize_t show_dock_uid(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ unsigned long lbuf;
+ acpi_status status = acpi_evaluate_integer(dock_station->handle, "_UID", 0, &lbuf);
+ if(ACPI_FAILURE(status)) {
+ return 0;
+ }
+ return snprintf(buf, PAGE_SIZE, "%lx\n", lbuf);
+}
+DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
+
+
+
/**
* dock_add - add a new dock station
* @handle: the dock station handle
@@ -707,6 +724,13 @@
kfree(dock_station);
return ret;
}
+ ret = device_create_file(&dock_device.dev, &dev_attr_uid);
+ if (ret) {
+ printk("Error %d adding sysfs file\n", ret);
+ platform_device_unregister(&dock_device);
+ kfree(dock_station);
+ return ret;
+ }
/* Find dependent devices */
acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
next reply other threads:[~2007-02-19 23:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-19 23:19 Ilya A. Volynets-Evenbakh [this message]
2007-03-10 2:41 ` [PATCH] add access to ACPI docking station UID Len Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45DA3083.9080604@total-knowledge.com \
--to=ilya@total-knowledge.com \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).