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

Commit 9719afae authored by David Härdeman's avatar David Härdeman Committed by Mauro Carvalho Chehab
Browse files

[media] rc-core: don't treat dev->rc_map.rc_type as a bitmap



store_protocols() treats dev->rc_map.rc_type as a bitmap which is wrong for
two reasons. First of all, it is pretty bogus to change the protocol type of
the keymap just because the hardware has been asked to decode a different
protocol.
Second, dev->rc_map.rc_type is an enum (i.e. a single protocol) as pointed
out by James Hogan <james.hogan@imgtec.com>.
Fix both issues by introducing a separate enabled_protocols member to
struct rc_dev.

Signed-off-by: default avatarDavid Härdeman <david@hardeman.nu>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent efa914d7
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -423,6 +423,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
	 */
	 */
	rc->map_name       = ir->ir_codes;
	rc->map_name       = ir->ir_codes;
	rc->allowed_protos = rc_type;
	rc->allowed_protos = rc_type;
	rc->enabled_protocols = rc_type;
	if (!rc->driver_name)
	if (!rc->driver_name)
		rc->driver_name = MODULE_NAME;
		rc->driver_name = MODULE_NAME;


+1 −1
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
{
{
	struct jvc_dec *data = &dev->raw->jvc;
	struct jvc_dec *data = &dev->raw->jvc;


	if (!(dev->raw->enabled_protocols & RC_BIT_JVC))
	if (!(dev->enabled_protocols & RC_BIT_JVC))
		return 0;
		return 0;


	if (!is_timing_event(ev)) {
	if (!is_timing_event(ev)) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
	struct lirc_codec *lirc = &dev->raw->lirc;
	struct lirc_codec *lirc = &dev->raw->lirc;
	int sample;
	int sample;


	if (!(dev->raw->enabled_protocols & RC_BIT_LIRC))
	if (!(dev->enabled_protocols & RC_BIT_LIRC))
		return 0;
		return 0;


	if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
	if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
+1 −1
Original line number Original line Diff line number Diff line
@@ -216,7 +216,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
	u32 scancode;
	u32 scancode;
	unsigned long delay;
	unsigned long delay;


	if (!(dev->raw->enabled_protocols & RC_BIT_MCE_KBD))
	if (!(dev->enabled_protocols & RC_BIT_MCE_KBD))
		return 0;
		return 0;


	if (!is_timing_event(ev)) {
	if (!is_timing_event(ev)) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -52,7 +52,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
	u8 address, not_address, command, not_command;
	u8 address, not_address, command, not_command;
	bool send_32bits = false;
	bool send_32bits = false;


	if (!(dev->raw->enabled_protocols & RC_BIT_NEC))
	if (!(dev->enabled_protocols & RC_BIT_NEC))
		return 0;
		return 0;


	if (!is_timing_event(ev)) {
	if (!is_timing_event(ev)) {
Loading