Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f124797 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

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: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a9e55ea9
Loading
Loading
Loading
Loading
+18 −9
Original line number Diff line number Diff line
@@ -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,6 +137,11 @@ static ssize_t store_protocols(struct device *d,
		disable = false;
	}


	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);
@@ -145,6 +153,7 @@ static ssize_t store_protocols(struct device *d,
			IR_dprintk(1, "Unknown protocol\n");
			return -EINVAL;
		}
	}

	tmp = skip_spaces(tmp);
	if (*tmp != '\0') {