Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181411
b: refs/heads/master
c: 53f8702
h: refs/heads/master
i:
  181409: e30258a
  181407: d57d8eb
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Feb 26, 2010
1 parent 1aeffff commit a338c65
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e93854da880d6dc357c00625d8371b6a926fd19b
refs/heads/master: 53f870228db0855f2031270ba5774dab0f33facd
30 changes: 28 additions & 2 deletions trunk/drivers/media/IR/ir-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion trunk/include/media/ir-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ struct ir_scancode_table {
struct ir_dev_props {
unsigned long allowed_protos;
void *priv;
int (*change_protocol)(void *priv, unsigned long protocol);
int (*change_protocol)(void *priv, enum ir_type ir_type);
};


struct ir_input_dev {
struct input_dev *dev; /* Input device*/
struct ir_scancode_table rc_tab; /* scan/key table */
Expand All @@ -55,6 +56,7 @@ struct ir_input_dev {
struct device *class_dev; /* virtual class dev */
const struct ir_dev_props *props; /* Device properties */
};
#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr)

/* Routines from ir-keytable.c */

Expand Down

0 comments on commit a338c65

Please sign in to comment.