[PATCH 3/5] card voltage

Dominik Brodowski linux at dominikbrodowski.de
Tue May 11 22:28:40 BST 2004


Add an attribute "card_voltage" which returns the card's voltage requirements:

"5.0V", "3.3V" or "X.XV".

 drivers/pcmcia/socket_sysfs.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+)

diff -ruN linux-original/drivers/pcmcia/socket_sysfs.c linux/drivers/pcmcia/socket_sysfs.c
--- linux-original/drivers/pcmcia/socket_sysfs.c	2004-05-11 19:28:24.282671312 +0200
+++ linux/drivers/pcmcia/socket_sysfs.c	2004-05-11 19:28:56.459779648 +0200
@@ -58,8 +58,25 @@
 }
 static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL);
 
+static ssize_t pccard_show_voltage(struct class_device *dev, char *buf)
+{
+	int val;
+	struct pcmcia_socket *s = to_socket(dev);
+
+        if (!(s->state & SOCKET_PRESENT))
+                return -ENODEV;
+	s->ops->get_status(s, &val);
+	if (val & SS_3VCARD)
+		return sprintf(buf, "3.3V\n");
+	if (val & SS_XVCARD)
+		return sprintf(buf, "X.XV\n");
+	return sprintf(buf, "5.0V\n");
+}
+static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL);
+
 static struct class_device_attribute *pccard_socket_attributes[] = {
 	&class_device_attr_card_type,
+	&class_device_attr_card_voltage,
 	NULL,
 };
 



More information about the linux-pcmcia mailing list