aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
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 c0c4dc250599..e84f9783b8c2 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -45,6 +45,8 @@ static struct {
45 { IR_TYPE_SONY, "sony" }, 45 { IR_TYPE_SONY, "sony" },
46}; 46};
47 47
48#define PROTO_NONE "none"
49
48/** 50/**
49 * show_protocols() - shows the current IR protocol(s) 51 * show_protocols() - shows the current IR protocol(s)
50 * @d: the device descriptor 52 * @d: the device descriptor
@@ -101,6 +103,7 @@ static ssize_t show_protocols(struct device *d,
101 * Writing "+proto" will add a protocol to the list of enabled protocols. 103 * Writing "+proto" will add a protocol to the list of enabled protocols.
102 * Writing "-proto" will remove a protocol from the list of enabled protocols. 104 * Writing "-proto" will remove a protocol from the list of enabled protocols.
103 * Writing "proto" will enable only "proto". 105 * Writing "proto" will enable only "proto".
106 * Writing "none" will disable all protocols.
104 * Returns -EINVAL if an invalid protocol combination or unknown protocol name 107 * Returns -EINVAL if an invalid protocol combination or unknown protocol name
105 * is used, otherwise @len. 108 * is used, otherwise @len.
106 */ 109 */
@@ -134,16 +137,22 @@ static ssize_t store_protocols(struct device *d,
134 disable = false; 137 disable = false;
135 } 138 }
136 139
137 for (i = 0; i < ARRAY_SIZE(proto_names); i++) { 140
138 if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) { 141 if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) {
139 tmp += strlen(proto_names[i].name); 142 mask = 0;
140 mask = proto_names[i].type; 143 tmp += sizeof(PROTO_NONE);
141 break; 144 } else {
145 for (i = 0; i < ARRAY_SIZE(proto_names); i++) {
146 if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) {
147 tmp += strlen(proto_names[i].name);
148 mask = proto_names[i].type;
149 break;
150 }
151 }
152 if (i == ARRAY_SIZE(proto_names)) {
153 IR_dprintk(1, "Unknown protocol\n");
154 return -EINVAL;
142 } 155 }
143 }
144 if (i == ARRAY_SIZE(proto_names)) {
145 IR_dprintk(1, "Unknown protocol\n");
146 return -EINVAL;
147 } 156 }
148 157
149 tmp = skip_spaces(tmp); 158 tmp = skip_spaces(tmp);