summaryrefslogtreecommitdiff
path: root/drivers/media/IR
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-06-28 15:58:48 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 17:54:56 (GMT)
commit5f1247972e0fcce6dd4bce94459a9f3db09ae61d (patch)
tree8f9e2d7b1c617d9699614c1af7db5b23d3480eef /drivers/media/IR
parenta9e55ea9774cc87434b386a7fba63d96af32792d (diff)
downloadlinux-fsl-qoriq-5f1247972e0fcce6dd4bce94459a9f3db09ae61d.tar.xz
V4L/DVB: ir-core: Add support for disabling all protocols
Writing "none" to /dev/class/rc/rc*/protocols will disable all protocols. This allows an easier setup, from userspace, as userspace applications don't need to disable protocol per protocol, before enabling a different set of protocols. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/ir-sysfs.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index c0c4dc2..e84f978 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -45,6 +45,8 @@ static struct {
{ IR_TYPE_SONY, "sony" },
};
+#define PROTO_NONE "none"
+
/**
* show_protocols() - shows the current IR protocol(s)
* @d: the device descriptor
@@ -101,6 +103,7 @@ static ssize_t show_protocols(struct device *d,
* Writing "+proto" will add a protocol to the list of enabled protocols.
* Writing "-proto" will remove a protocol from the list of enabled protocols.
* Writing "proto" will enable only "proto".
+ * Writing "none" will disable all protocols.
* Returns -EINVAL if an invalid protocol combination or unknown protocol name
* is used, otherwise @len.
*/
@@ -134,16 +137,22 @@ static ssize_t store_protocols(struct device *d,
disable = false;
}
- for (i = 0; i < ARRAY_SIZE(proto_names); i++) {
- if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) {
- tmp += strlen(proto_names[i].name);
- mask = proto_names[i].type;
- break;
+
+ if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) {
+ mask = 0;
+ tmp += sizeof(PROTO_NONE);
+ } else {
+ for (i = 0; i < ARRAY_SIZE(proto_names); i++) {
+ if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) {
+ tmp += strlen(proto_names[i].name);
+ mask = proto_names[i].type;
+ break;
+ }
+ }
+ if (i == ARRAY_SIZE(proto_names)) {
+ IR_dprintk(1, "Unknown protocol\n");
+ return -EINVAL;
}
- }
- if (i == ARRAY_SIZE(proto_names)) {
- IR_dprintk(1, "Unknown protocol\n");
- return -EINVAL;
}
tmp = skip_spaces(tmp);