rc-core: do not change 32bit NEC scancode format for now
Subsystems (3)
PATCH 1/1 rc-core: do not change 32bit NEC scancode format for now
This reverts 18bc17448147e93f31cc9b1a83be49f1224657b2
The patch ignores the fact that NEC32 scancodes are generated not only in the NEC raw decoder but also directly in some drivers. Whichever approach is chosen it should be consistent across drivers and this patch needs more discussion.
Furthermore, I'm convinced that we have to stop playing games trying to decipher the "meaning" of NEC scancodes (what's the customer/vendor/address, which byte is the MSB, etc).
I'll post separate proposals to that effect later.
--- drivers/media/rc/ir-nec-decoder.c | 5 -- drivers/media/rc/keymaps/rc-tivo.c | 86 ++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 47 deletions(-)
drivers/media/rc/ir-nec-decoder.c +1 -4
@@ -172,10 +172,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)if (send_32bits) {/* NEC transport, but modified protocol, used by at * least Apple and TiVo remotes */ - scancode = not_address <<24 | - address <<16 | - not_command <<8 | - command; + scancode = data->bits;IR_dprintk (1 ,"NEC (modified) scancode 0x%08x\n" , scancode); }else if ((address ^ not_address) !=0xff ) {/* Extended NEC */
drivers/media/rc/keymaps/rc-tivo.c +43 -43
105 lines not on this page · raw message
Hi David,
Quoted 6 lines · On Thursday 27 March 2014 22:00:37 David Härdeman wrote:
This reverts
18bc17448147e93f31cc9b1a83be49f1224657b2The patch ignores the fact that NEC32 scancodes are generated not only in the NEC raw decoder but also directly in some drivers. Whichever approach is chosen it should be consistent across drivers and this patch needs more discussion.
Fair enough. For reference which drivers are you referring to?
Quoted 3 lines
Furthermore, I'm convinced that we have to stop playing games trying to decipher the "meaning" of NEC scancodes (what's the customer/vendor/address, which byte is the MSB, etc).
Well when all the buttons on a remote have the same address, and the numeric buttons are sequential commands only in a certain bit/byte order, then I think the word "decipher" is probably a bit of a stretch.
Nevertheless I don't have any attachment to 32-bit NEC. If it's likely to change again I'd prefer img-ir-nec just not support it for now, so please could you add the following hunks to your patch (or if the original patch is to be dropped this could be squashed into the img-ir-nec patch):
drivers/media/rc/img-ir/img-ir-nec.c +2 -14
@@ -21,12 +21,7 @@ static int img_ir_nec_scancode(int len, u64 raw, int *scancode, u64 protocols) data = (raw >>16 ) &0xff ; data_inv = (raw >>24 ) &0xff ;if ((data_inv ^ data) !=0xff ) { -/* 32-bit NEC (used by Apple and TiVo remotes) */ -/* scan encoding: aaAAddDD */ - *scancode = addr_inv <<24 | - addr <<16 | - data_inv <<8 | - data; +return -EINVAL ; }else if ((addr_inv ^ addr) !=0xff ) {/* Extended NEC */ /* scan encoding: AAaaDD */
@@ -53,14 +48,7 @@ static int img_ir_nec_filter(const struct rc_scancode_filter *in, data_m = in->mask &0xff ;if ((in->data | in->mask) &0xff000000 ) { -/* 32-bit NEC (used by Apple and TiVo remotes) */ -/* scan encoding: aaAAddDD */ - addr_inv = (in->data >>24 ) &0xff ; - addr_inv_m = (in->mask >>24 ) &0xff ; - addr = (in->data >>16 ) &0xff ; - addr_m = (in->mask >>16 ) &0xff ; - data_inv = (in->data >>8 ) &0xff ; - data_inv_m = (in->mask >>8 ) &0xff ; +return -EINVAL ; }else if ((in->data | in->mask) &0x00ff0000 ) {/* Extended NEC */ /* scan encoding AAaaDD */
Quoted 2 lines
I'll post separate proposals to that effect later.
Great, please do Cc me
(I have a work in progress branch to unify NEC scancodes, but I'm not sure I'd have time to complete it any time soon anyway)
Thanks
James
Quoted 140 lines
Signed-off-by David Härdeman <[email protected]>--- drivers/media/rc/ir-nec-decoder.c | 5 -- drivers/media/rc/keymaps/rc-tivo.c | 86++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 47 deletions(-)
(quoted diff) +0
-0
b/drivers/media/rc/ir-nec-decoder.cindex 735a509..c4333d5 100644drivers/media/rc/ir-nec-decoder.c +1
-4@@ -172,10 +172,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) if (send_32bits) {/* NEC transport, but modified protocol, used by at * least Apple and TiVo remotes */ - scancode = not_address <<24 | - address <<16 | - not_command <<8 | - command; + scancode = data->bits;IR_dprintk (1 ,"NEC (modified) scancode 0x%08x\n" , scancode); } else if ((address ^ not_address) != 0xff) {/* Extended NEC */ (quoted diff) +0
-0
b/drivers/media/rc/keymaps/rc-tivo.cindex 5cc1b45..454e062 100644drivers/media/rc/keymaps/rc-tivo.c +0
-0@@ -15,62 +15,62 @@* Initial mapping is for the TiVo remote included in the Nero LiquidTV bundle, * which also ships with a TiVo-branded IR transceiver, supported by the mceusb * driver. Note that the remote uses an NEC-ish protocol, but instead of having - * a command/not_command pair, it has a vendor ID of
0x3085, but some keys, the + * a command/not_command pair, it has a vendor ID of0xa10c, but some keys, the * NEC extended checksums do pass, so the table presently has the intended * values and the checksum-passed versions for those keys.
*/
static structrc_map_tabletivo[] = {drivers/media/rc/keymaps/rc-tivo.c +42
-43- { 0x3085f009, KEY_MEDIA }, /* TiVo Button */ - { 0x3085e010, KEY_POWER2 }, /* TV Power */ - { 0x3085e011, KEY_TV }, /* Live TV/Swap */ - { 0x3085c034, KEY_VIDEO_NEXT }, /* TV Input */ - { 0x3085e013, KEY_INFO }, - { 0x3085a05f, KEY_CYCLEWINDOWS }, /* Window */ + { 0xa10c900f, KEY_MEDIA }, /* TiVo Button */ + { 0xa10c0807, KEY_POWER2 }, /* TV Power */ + { 0xa10c8807, KEY_TV }, /* Live TV/Swap */ + { 0xa10c2c03, KEY_VIDEO_NEXT }, /* TV Input */ + { 0xa10cc807, KEY_INFO }, + { 0xa10cfa05, KEY_CYCLEWINDOWS }, /* Window */ { 0x0085305f, KEY_CYCLEWINDOWS }, - { 0x3085c036, KEY_EPG }, /* Guide */ + { 0xa10c6c03, KEY_EPG }, /* Guide */ - { 0x3085e014, KEY_UP }, - { 0x3085e016, KEY_DOWN }, - { 0x3085e017, KEY_LEFT }, - { 0x3085e015, KEY_RIGHT }, + { 0xa10c2807, KEY_UP }, + { 0xa10c6807, KEY_DOWN }, + { 0xa10ce807, KEY_LEFT }, + { 0xa10ca807, KEY_RIGHT }, - { 0x3085e018, KEY_SCROLLDOWN }, /* Red Thumbs Down */ - { 0x3085e019, KEY_SELECT }, - { 0x3085e01a, KEY_SCROLLUP }, /* Green Thumbs Up */ + { 0xa10c1807, KEY_SCROLLDOWN }, /* Red Thumbs Down */ + { 0xa10c9807, KEY_SELECT }, + { 0xa10c5807, KEY_SCROLLUP }, /* Green Thumbs Up */ - { 0x3085e01c, KEY_VOLUMEUP }, - { 0x3085e01d, KEY_VOLUMEDOWN }, - { 0x3085e01b, KEY_MUTE }, - { 0x3085d020, KEY_RECORD }, - { 0x3085e01e, KEY_CHANNELUP }, - { 0x3085e01f, KEY_CHANNELDOWN }, + { 0xa10c3807, KEY_VOLUMEUP }, + { 0xa10cb807, KEY_VOLUMEDOWN }, + { 0xa10cd807, KEY_MUTE }, + { 0xa10c040b, KEY_RECORD }, + { 0xa10c7807, KEY_CHANNELUP }, + { 0xa10cf807, KEY_CHANNELDOWN }, { 0x0085301f, KEY_CHANNELDOWN }, - { 0x3085d021, KEY_PLAY }, - { 0x3085d023, KEY_PAUSE }, - { 0x3085d025, KEY_SLOW }, - { 0x3085d022, KEY_REWIND }, - { 0x3085d024, KEY_FASTFORWARD }, - { 0x3085d026, KEY_PREVIOUS }, - { 0x3085d027, KEY_NEXT }, /* ->| */ + { 0xa10c840b, KEY_PLAY }, + { 0xa10cc40b, KEY_PAUSE }, + { 0xa10ca40b, KEY_SLOW }, + { 0xa10c440b, KEY_REWIND }, + { 0xa10c240b, KEY_FASTFORWARD }, + { 0xa10c640b, KEY_PREVIOUS }, + { 0xa10ce40b, KEY_NEXT }, /* ->| */ - { 0x3085b044, KEY_ZOOM }, /* Aspect */ - { 0x3085b048, KEY_STOP }, - { 0x3085b04a, KEY_DVD }, /* DVD Menu */ + { 0xa10c220d, KEY_ZOOM }, /* Aspect */ + { 0xa10c120d, KEY_STOP }, + { 0xa10c520d, KEY_DVD }, /* DVD Menu */ - { 0x3085d028, KEY_NUMERIC_1 }, - { 0x3085d029, KEY_NUMERIC_2 }, - { 0x3085d02a, KEY_NUMERIC_3 }, - { 0x3085d02b, KEY_NUMERIC_4 }, - { 0x3085d02c, KEY_NUMERIC_5 }, - { 0x3085d02d, KEY_NUMERIC_6 }, - { 0x3085d02e, KEY_NUMERIC_7 }, - { 0x3085d02f, KEY_NUMERIC_8 }, + { 0xa10c140b, KEY_NUMERIC_1 }, + { 0xa10c940b, KEY_NUMERIC_2 }, + { 0xa10c540b, KEY_NUMERIC_3 }, + { 0xa10cd40b, KEY_NUMERIC_4 }, + { 0xa10c340b, KEY_NUMERIC_5 }, + { 0xa10cb40b, KEY_NUMERIC_6 }, + { 0xa10c740b, KEY_NUMERIC_7 }, + { 0xa10cf40b, KEY_NUMERIC_8 }, { 0x0085302f, KEY_NUMERIC_8 }, - { 0x3085c030, KEY_NUMERIC_9 }, - { 0x3085c031, KEY_NUMERIC_0 }, - { 0x3085c033, KEY_ENTER }, - { 0x3085c032, KEY_CLEAR }, + { 0xa10c0c03, KEY_NUMERIC_9 }, + { 0xa10c8c03, KEY_NUMERIC_0 }, + { 0xa10ccc03, KEY_ENTER }, + { 0xa10c4c03, KEY_CLEAR }, }; static struct rc_map_list tivo_map = { --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · James Hogan
Hi David,
Quoted 6 lines · On Thursday 27 March 2014 22:00:37 David Härdeman wrote:
This reverts
18bc17448147e93f31cc9b1a83be49f1224657b2The patch ignores the fact that NEC32 scancodes are generated not only in the NEC raw decoder but also directly in some drivers. Whichever approach is chosen it should be consistent across drivers and this patch needs more discussion.
Fair enough. For reference which drivers are you referring to?
The ones I'm aware of right now are:drivers/media/usb/dvb-usb/dib0700_core.cdrivers/media/usb/dvb-usb-v2/az6007.cdrivers/media/usb/dvb-usb-v2/af9035.cdrivers/media/usb/dvb-usb-v2/rtl28xxu.cdrivers/media/usb/dvb-usb-v2/af9015.cdrivers/media/usb/em28xx/em28xx-input.c
Quoted 7 lines
Quoted 3 lines
Furthermore, I'm convinced that we have to stop playing games trying to decipher the "meaning" of NEC scancodes (what's the customer/vendor/address, which byte is the MSB, etc).
Well when all the buttons on a remote have the same address, and the numeric buttons are sequential commands only in a certain bit/byte order, then I think the word "decipher" is probably a bit of a stretch.
I think you misunderstood me. "decipher" is a bit of a stretch when talking of one remote control (I'm guessing you're referring to the Tivo remote). It's not that much of a stretch if we're referring to trying to derive a common meaning from the encoding used for *all* remote controls out there.
The discussion about the 24-bit version of NEC and whether the address bytes were in MSB or LSB order was a good example. Andy Walls cited a NEC manual which stated one thing and people also referred to
http://www.sbprojects.com/knowledge/ir/nec.php which stated the opposite (while referring to an unnamed VCR service manual).
As a third example...I've read a Samsung service manual which happily stated that the remote (which used the NEC protocol) sent IR commands starting with the address x 2 (and looking at the raw NEC command, it did start with something like 0x07 0x07).
So don't get me wrong, I wasn't referring to your analysis of the Tivo remote but more the general approach that has been taken until now wrt. the NEC protocol in the kernel drivers.
Quoted 4 lines
Nevertheless I don't have any attachment to 32-bit NEC. If it's likely to change again I'd prefer img-ir-nec just not support it for now, so please could you add the following hunks to your patch (or if the original patch is to be dropped this could be squashed into the img-ir-nec patch):
I'd rather show you my complete proposal first before doing something radical with your driver. But it was a good reminder that I need to keep the NEC32 parsing in your driver in mind as well.
Quoted 6 lines
Quoted 1 line
I'll post separate proposals to that effect later.
Great, please do Cc me
(I have a work in progress branch to unify NEC scancodes, but I'm not sure I'd have time to complete it any time soon anyway)
That is what I'm working on as well at the moment. It's actually to solve two problems...both to unify NEC scancodes (by simply using 32 bit scancodes everywhere and some fallback code...I'm not 100% sure it's doable but I hope so since it's the only sane solution I can think of in the long run)...and to make sure that protocol information actually gets used in keymaps, etc.
I hope to post patches soon that'll make it clearer.
Regards,
David
Quoted 12 lines · On Friday 28 March 2014 01:08:56 David Härdeman wrote:
Quoted 11 lines · James Hogan
Hi David,
Quoted 7 lines · On Thursday 27 March 2014 22:00:37 David Härdeman wrote:
This reverts
18bc17448147e93f31cc9b1a83be49f1224657b2The patch ignores the fact that NEC32 scancodes are generated not only in the NEC raw decoder but also directly in some drivers. Whichever approach is chosen it should be consistent across drivers and this patch needs more
discussion.
Quoted 3 lines
Quoted 1 line
Fair enough. For reference which drivers are you referring to?
The ones I'm aware of right now are:
Thanks, I hadn't looked properly outside of drivers/media/rc/ :(
Quoted 1 line
drivers/media/usb/dvb-usb/dib0700_core.c
AFAICT this only seems to support 16bit and 24bit NEC, so NEC-32 doesn't affect it. I may have missed something subtle.
Quoted 5 lines
drivers/media/usb/dvb-usb-v2/az6007.cdrivers/media/usb/dvb-usb-v2/af9035.cdrivers/media/usb/dvb-usb-v2/rtl28xxu.cdrivers/media/usb/dvb-usb-v2/af9015.cdrivers/media/usb/em28xx/em28xx-input.c
Note, it appears none of these do any bit reversing for the 32bit case compared to 16/24 bit, so they're already different to the NEC32 scancode encoding that the raw nec decoder and tivo keymap were using, which used a different bitorder (!!) between the 32-bit and the 24/16-bit cases.
Quoted 21 lines
Quoted 8 lines
Quoted 4 lines
Furthermore, I'm convinced that we have to stop playing games trying to decipher the "meaning" of NEC scancodes (what's the customer/vendor/address, which byte is the MSB, etc).
Well when all the buttons on a remote have the same address, and the numeric buttons are sequential commands only in a certain bit/byte order, then I think the word "decipher" is probably a bit of a stretch.
I think you misunderstood me. "decipher" is a bit of a stretch when talking of one remote control (I'm guessing you're referring to the Tivo remote). It's not that much of a stretch if we're referring to trying to derive a common meaning from the encoding used for *all* remote controls out there.
The discussion about the 24-bit version of NEC and whether the address bytes were in MSB or LSB order was a good example. Andy Walls cited a NEC manual which stated one thing and people also referred to
http://www.sbprojects.com/knowledge/ir/nec.php which stated the opposite (while referring to an unnamed VCR service manual).
Quoted 8 lines
As a third example...I've read a Samsung service manual which happily stated that the remote (which used the NEC protocol) sent IR commands starting with the address x 2 (and looking at the raw NEC command, it did start with something like
0x070x07).So don't get me wrong, I wasn't referring to your analysis of the Tivo remote but more the general approach that has been taken until now wrt. the NEC protocol in the kernel drivers.
Okay, thanks for the clarification.
Quoted 9 lines
Quoted 6 lines
Nevertheless I don't have any attachment to 32-bit NEC. If it's likely to change again I'd prefer img-ir-nec just not support it for now, so please could you add the following hunks to your patch (or if the original patch is
to be dropped this could be squashed into the img-ir-nec patch):I'd rather show you my complete proposal first before doing something radical with your driver. But it was a good reminder that I need to keep the NEC32 parsing in your driver in mind as well.
Okay no problem. I had assumed you were aiming for a short term fix to prevent the encoding change hitting mainline or an actual release (v3.15).
Cheers
James
Quoted 24 lines
Quoted 7 lines
Quoted 2 lines
I'll post separate proposals to that effect later.
Great, please do Cc me
(I have a work in progress branch to unify NEC scancodes, but I'm not sure I'd have time to complete it any time soon anyway)
That is what I'm working on as well at the moment. It's actually to solve two problems...both to unify NEC scancodes (by simply using 32 bit scancodes everywhere and some fallback code...I'm not 100% sure it's doable but I hope so since it's the only sane solution I can think of in the long run)...and to make sure that protocol information actually gets used in keymaps, etc.
I hope to post patches soon that'll make it clearer.
Regards,
David--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · James Hogan
Quoted 5 lines · On Friday 28 March 2014 01:08:56 David Härdeman wrote:
drivers/media/usb/dvb-usb-v2/az6007.cdrivers/media/usb/dvb-usb-v2/af9035.cdrivers/media/usb/dvb-usb-v2/rtl28xxu.cdrivers/media/usb/dvb-usb-v2/af9015.cdrivers/media/usb/em28xx/em28xx-input.cNote, it appears none of these do any bit reversing for the 32bit case compared to 16/24 bit, so they're already different to the NEC32 scancode encoding that the raw nec decoder and tivo keymap were using, which used a different bitorder (!!) between the 32-bit and the 24/16-bit cases.
I know, and none of those drivers have an in-kernel NEC32 keymap, so if anyone is using them in that manner...it's with a homebrew keymap.
Quoted 6 lines
Quoted 3 lines
I'd rather show you my complete proposal first before doing something radical with your driver. But it was a good reminder that I need to keep the NEC32 parsing in your driver in mind as well.
Okay no problem. I had assumed you were aiming for a short term fix to prevent the encoding change hitting mainline or an actual release (v3.15).
I am aiming for a fix within that time frame...but I hope that it can be more than a short term one :)
Patches are on their way right now...
Regards,
David
Quoted 13 lines · James Hogan
Quoted 12 lines · On Friday 28 March 2014 01:08:56 David Härdeman wrote:
Quoted 10 lines · James Hogan
Quoted 7 lines · On Thursday 27 March 2014 22:00:37 David Härdeman wrote:
This reverts
18bc17448147e93f31cc9b1a83be49f1224657b2The patch ignores the fact that NEC32 scancodes are generated not only in the NEC raw decoder but also directly in some drivers. Whichever approach is chosen it should be consistent across drivers and this patch needs more
discussion.Fair enough. For reference which drivers are you referring to?
Quoted 8 lines
Quoted 1 line
The ones I'm aware of right now are:
Thanks, I hadn't looked properly outside of
drivers/media/rc/:(Quoted 1 line
drivers/media/usb/dvb-usb/dib0700_core.cAFAICT this only seems to support 16bit and 24bit NEC, so NEC-32 doesn't affect it. I may have missed something subtle.
Nah. You're right, it can be converted to NEC32 by simply removing one check, but it isn't NEC32 capable yet.
Quoted 10 lines
Quoted 5 lines
drivers/media/usb/dvb-usb-v2/az6007.cdrivers/media/usb/dvb-usb-v2/af9035.cdrivers/media/usb/dvb-usb-v2/rtl28xxu.cdrivers/media/usb/dvb-usb-v2/af9015.cdrivers/media/usb/em28xx/em28xx-input.cNote, it appears none of these do any bit reversing for the 32bit case compared to 16/24 bit, so they're already different to the NEC32 scancode encoding that the raw nec decoder and tivo keymap were using, which used a different bitorder (!!) between the 32-bit and the 24/16-bit cases.
I think that might also be a reason to generate the NEC32 scancode in the order that I've proposed (i.e. it only requires change to the sw NEC decoder).
On the other hand I'm still dithering on whether your proposed NEC32 scancode (which is what the sw decoder uses) or my proposal (which is what the other hw decoders use) should be canonical... :)
Signature · 1 line
David Härdeman