--- zzzz-none-000/linux-3.10.107/drivers/media/rc/ir-rc6-decoder.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/rc/ir-rc6-decoder.c 2021-02-04 17:41:59.000000000 +0000 @@ -88,6 +88,7 @@ struct rc6_dec *data = &dev->raw->rc6; u32 scancode; u8 toggle; + enum rc_type protocol; if (!(dev->enabled_protocols & (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | @@ -233,9 +234,11 @@ case RC6_MODE_0: scancode = data->body; toggle = data->toggle; + protocol = RC_TYPE_RC6_0; IR_dprintk(1, "RC6(0) scancode 0x%04x (toggle: %u)\n", scancode, toggle); break; + case RC6_MODE_6A: if (data->count > CHAR_BIT * sizeof data->body) { IR_dprintk(1, "RC6 too many (%u) data bits\n", @@ -244,23 +247,39 @@ } scancode = data->body; - if (data->count == RC6_6A_32_NBITS && - (scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { - /* MCE RC */ - toggle = (scancode & RC6_6A_MCE_TOGGLE_MASK) ? 1 : 0; - scancode &= ~RC6_6A_MCE_TOGGLE_MASK; - } else { + switch (data->count) { + case 20: + protocol = RC_TYPE_RC6_6A_20; + toggle = 0; + break; + case 24: + protocol = RC_BIT_RC6_6A_24; toggle = 0; + break; + case 32: + if ((scancode & RC6_6A_LCC_MASK) == RC6_6A_MCE_CC) { + protocol = RC_TYPE_RC6_MCE; + toggle = !!(scancode & RC6_6A_MCE_TOGGLE_MASK); + scancode &= ~RC6_6A_MCE_TOGGLE_MASK; + } else { + protocol = RC_BIT_RC6_6A_32; + toggle = 0; + } + break; + default: + IR_dprintk(1, "RC6(6A) unsupported length\n"); + goto out; } - IR_dprintk(1, "RC6(6A) scancode 0x%08x (toggle: %u)\n", - scancode, toggle); + + IR_dprintk(1, "RC6(6A) proto 0x%04x, scancode 0x%08x (toggle: %u)\n", + protocol, scancode, toggle); break; default: IR_dprintk(1, "RC6 unknown mode\n"); goto out; } - rc_keydown(dev, scancode, toggle); + rc_keydown(dev, protocol, scancode, toggle); data->state = STATE_INACTIVE; return 0; }