aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR/ir-sysfs.c
diff options
context:
space:
mode:
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 3c601421632b..821345dbe7c9 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;
22 22
23static struct class *ir_input_class; 23static struct class *ir_input_class;
24 24
25static DEVICE_ATTR(ir_protocol, S_IRUGO | S_IWUSR, NULL, NULL); 25
26static ssize_t show_protocol(struct device *d,
27 struct device_attribute *mattr, char *buf)
28{
29 char *s;
30 struct ir_input_dev *ir_dev = dev_get_drvdata(d);
31 enum ir_type ir_type = ir_dev->rc_tab.ir_type;
32
33 IR_dprintk(1, "Current protocol is %ld\n", ir_type);
34
35 /* FIXME: doesn't support multiple protocols at the same time */
36 if (ir_type == IR_TYPE_UNKNOWN)
37 s = "Unknown";
38 else if (ir_type == IR_TYPE_RC5)
39 s = "RC-5";
40 else if (ir_type == IR_TYPE_PD)
41 s = "Pulse/distance";
42 else if (ir_type == IR_TYPE_NEC)
43 s = "NEC";
44 else
45 s = "Other";
46
47 return sprintf(buf, "%s\n", s);
48}
49
50static DEVICE_ATTR(current_protocol, S_IRUGO | S_IWUSR,
51 show_protocol, NULL);
26 52
27static struct attribute *ir_dev_attrs[] = { 53static struct attribute *ir_dev_attrs[] = {
28 &dev_attr_ir_protocol.attr, 54 &dev_attr_current_protocol.attr,
29}; 55};
30 56
31int ir_register_class(struct input_dev *input_dev) 57int ir_register_class(struct input_dev *input_dev)