From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>,
Benjamin Tissoires <btissoir@redhat.com>,
Peter Hutterer <peter.hutterer@redhat.com>,
platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org,
Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 1/2] input/serio: Add a firmware_id sysfs attribute
Date: Thu, 20 Mar 2014 11:12:09 +0100 [thread overview]
Message-ID: <1395310330-3232-2-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1395310330-3232-1-git-send-email-hdegoede@redhat.com>
serio devices exposed via platform firmware interfaces such as ACPI
may provide additional identifying information of use to userspace.
We don't associate the serio devices with the firmware device (we don't
set it as parent), so there's no way for userspace to make use of this
information.
We cannot change the parent for serio devices instantiated though a firmware
interface as that would break suspend / resume ordering.
Therefor this patch adds a new firmware_id sysfs attribute so that userspace
can get a string from there with any additional identifying information the
firmware interface may provide.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/serio/serio.c | 12 ++++++++++++
include/linux/serio.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 8f4c4ab..1788a4d 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -451,6 +451,13 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
return retval;
}
+static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct serio *serio = to_serio_port(dev);
+
+ return sprintf(buf, "%s\n", serio->firmware_id);
+}
+
static DEVICE_ATTR_RO(type);
static DEVICE_ATTR_RO(proto);
static DEVICE_ATTR_RO(id);
@@ -473,12 +480,14 @@ static DEVICE_ATTR_RO(modalias);
static DEVICE_ATTR_WO(drvctl);
static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
+static DEVICE_ATTR_RO(firmware_id);
static struct attribute *serio_device_attrs[] = {
&dev_attr_modalias.attr,
&dev_attr_description.attr,
&dev_attr_drvctl.attr,
&dev_attr_bind_mode.attr,
+ &dev_attr_firmware_id.attr,
NULL
};
@@ -923,6 +932,9 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env)
SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra);
SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X",
serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
+ if (serio->firmware_id[0])
+ SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s",
+ serio->firmware_id);
return 0;
}
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 36aac73..9f779c7 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -23,6 +23,7 @@ struct serio {
char name[32];
char phys[32];
+ char firmware_id[128];
bool manual_bind;
--
1.9.0
next prev parent reply other threads:[~2014-03-20 11:44 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 10:12 [PATCH 0/2] input/serio: Add a firmware_id sysfs attribute Hans de Goede
2014-03-20 10:12 ` Hans de Goede [this message]
2014-03-20 10:12 ` [PATCH 2/2] input/serio/8042: Add firmware_id support Hans de Goede
2014-03-20 17:21 ` [PATCH 0/2] input/serio: Add a firmware_id sysfs attribute Matthew Garrett
2014-03-24 1:07 ` Peter Hutterer
2014-03-28 7:56 ` Dmitry Torokhov
2014-03-28 8:12 ` Hans de Goede
2014-03-28 8:17 ` Dmitry Torokhov
2014-03-28 8:29 ` Hans de Goede
2014-03-28 8:52 ` Dmitry Torokhov
2014-03-28 9:00 ` Matthew Garrett
2014-03-28 16:04 ` Dmitry Torokhov
2014-03-28 9:05 ` Hans de Goede
2014-03-28 8:20 ` Matthew Garrett
2014-03-28 8:24 ` Dmitry Torokhov
2014-03-28 8:27 ` Matthew Garrett
2014-03-28 8:50 ` Dmitry Torokhov
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=1395310330-3232-2-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=btissoir@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=peter.hutterer@redhat.com \
--cc=platform-driver-x86@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).