summaryrefslogtreecommitdiff
path: root/drivers/media/IR/ir-sysfs.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-12-14 05:16:36 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 18:10:23 (GMT)
commit53f870228db0855f2031270ba5774dab0f33facd (patch)
tree1bfb5fee77f174f13f98404788970cd3c3a7b772 /drivers/media/IR/ir-sysfs.c
parente93854da880d6dc357c00625d8371b6a926fd19b (diff)
downloadlinux-53f870228db0855f2031270ba5774dab0f33facd.tar.xz
V4L/DVB (13635): ir-core: Implement protocol table type reading
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/ir-sysfs.c')
-rw-r--r--drivers/media/IR/ir-sysfs.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index 3c60142..821345d 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -22,10 +22,36 @@ unsigned long ir_core_dev_number;
static struct class *ir_input_class;
-static DEVICE_ATTR(ir_protocol, S_IRUGO | S_IWUSR, NULL, NULL);
+
+static ssize_t show_protocol(struct device *d,
+ struct device_attribute *mattr, char *buf)
+{
+ char *s;
+ struct ir_input_dev *ir_dev = dev_get_drvdata(d);
+ enum ir_type ir_type = ir_dev->rc_tab.ir_type;
+
+ IR_dprintk(1, "Current protocol is %ld\n", ir_type);
+
+ /* FIXME: doesn't support multiple protocols at the same time */
+ if (ir_type == IR_TYPE_UNKNOWN)
+ s = "Unknown";
+ else if (ir_type == IR_TYPE_RC5)
+ s = "RC-5";
+ else if (ir_type == IR_TYPE_PD)
+ s = "Pulse/distance";
+ else if (ir_type == IR_TYPE_NEC)
+ s = "NEC";
+ else
+ s = "Other";
+
+ return sprintf(buf, "%s\n", s);
+}
+
+static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
+ show_protocol, NULL);
static struct attribute *ir_dev_attrs[] = {
- &dev_attr_ir_protocol.attr,
+ &dev_attr_current_protocol.attr,
};
int ir_register_class(struct input_dev *input_dev)