All of lore.kernel.org
 help / color / mirror / Atom feed
* ir-keytable: infinite loops, segfaults
@ 2016-11-16 10:52 Vincent McIntyre
  2016-11-17 13:45 ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-16 10:52 UTC (permalink / raw)
  To: linux-media

Hi,

I have a fairly old dvico dual digital 4 tuner and remote.
There seem to be some issues with support for it, can I help fix them?

I am using ir-keytable 1.10.0-1 on Ubuntu 16.04 LTS,
with kernel 4.4.0-47-generic (package version 4.4.0-47-generic)

The remote's keymapping is the one in /lib/udev/rc_keymaps/dvico_mce;
kernel support for the device is in media/usb/dvb-usb/cxusb.c.

Mostly it works, in that I get correct keycodes back from evtest
and ir-keytable -t. But I want to change some of the keycode mappings
and that is not working.

  # cat >testfile
  0xfe47 KEY_PAUSE
  ^D
  
  # ir-keytable -v -d /dev/input/event15 -w testfile
  Parsing testfile keycode file
  parsing 0xfe47=KEY_PAUSE:   value=119
  Opening /dev/input/event15
  Input Protocol version: 0x00010001
      fe47=0077
  Wrote 1 keycode(s) to driver

So far so good, yes? But evtest still reports the same keycode
for the key I tried to modify.

  # evtest
  <select device 15>
  <press PLAYPAUSE key on remote>
  Event: time 1479206112.262746, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
  Event: time 1479206112.262746, -------------- SYN_REPORT ------------
  Event: time 1479206112.262760, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
  Event: time 1479206112.262760, -------------- SYN_REPORT ------------
 
  # irkeytable -r -d /dev/input/event15 |grep PAUSE
  Enabled protocols: unknown rc-5 sony nec sanyo mce-kbd rc-6 sharp xmp 
  scancode 0xfe02 = KEY_PAUSE (0x77)
  scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)

I thought that I might need to clear and replace the entire table
to get things working. This is where the problems really start.

First trying to clear the table causes an infinite loop.

  # ir-keytable -d /dev/input/event15 -c
  Opening /dev/input/event15
  Input Protocol version: 0x00010001
  Deleting entry 1
  Deleting entry 2
  Deleting entry 3
  Deleting entry 4
  ....
  Deleting entry 2114689
  Deleting entry 2114690
  ^C

Then I tried to load a modified version of dvico_mce
The whole file was there, with just this change:
--- dvico_mce   2016-11-13 22:50:11.442092350 +1100
+++ testfile    2016-11-16 20:46:29.361411631 +1100
@@ -38,7 +38,7 @@
 0xfe03 KEY_0
 0xfe1f KEY_ZOOM
 0xfe43 KEY_REWIND
-0xfe47 KEY_PLAYPAUSE
+0xfe47 KEY_PAUSE
 0xfe4f KEY_FASTFORWARD
 0xfe57 KEY_MUTE
 0xfe0d KEY_STOP

The program seems to parse the modified file ok but then
segaults while reading from the input device.

  # ir-keytable -v -d /dev/input/event15 -w testfile
  Parsing testfile keycode file
  parsing 0xfe02=KEY_TV:  value=377
  parsing 0xfe0e=KEY_MP3: value=391
  parsing 0xfe1a=KEY_DVD: value=389
  parsing 0xfe1e=KEY_FAVORITES:   value=364
  parsing 0xfe16=KEY_SETUP:   value=141
  parsing 0xfe46=KEY_POWER2:  value=356
  parsing 0xfe0a=KEY_EPG: value=365
  parsing 0xfe49=KEY_BACK:    value=158
  parsing 0xfe4d=KEY_MENU:    value=139
  parsing 0xfe51=KEY_UP:  value=103
  parsing 0xfe5b=KEY_LEFT:    value=105
  parsing 0xfe5f=KEY_RIGHT:   value=106
  parsing 0xfe53=KEY_DOWN:    value=108
  parsing 0xfe5e=KEY_OK:  value=352
  parsing 0xfe59=KEY_INFO:    value=358
  parsing 0xfe55=KEY_TAB: value=15
  parsing 0xfe0f=KEY_PREVIOUSSONG:    value=165
  parsing 0xfe12=KEY_NEXTSONG:    value=163
  parsing 0xfe42=KEY_ENTER:   value=28
  parsing 0xfe15=KEY_VOLUMEUP:    value=115
  parsing 0xfe05=KEY_VOLUMEDOWN:  value=114
  parsing 0xfe11=KEY_CHANNELUP:   value=402
  parsing 0xfe09=KEY_CHANNELDOWN: value=403
  parsing 0xfe52=KEY_CAMERA:  value=212
  parsing 0xfe5a=KEY_TUNER:   value=386
  parsing 0xfe19=KEY_OPEN:    value=134
  parsing 0xfe0b=KEY_1:   value=2
  parsing 0xfe17=KEY_2:   value=3
  parsing 0xfe1b=KEY_3:   value=4
  parsing 0xfe07=KEY_4:   value=5
  parsing 0xfe50=KEY_5:   value=6
  parsing 0xfe54=KEY_6:   value=7
  parsing 0xfe48=KEY_7:   value=8
  parsing 0xfe4c=KEY_8:   value=9
  parsing 0xfe58=KEY_9:   value=10
  parsing 0xfe13=KEY_ANGLE:   value=371
  parsing 0xfe03=KEY_0:   value=11
  parsing 0xfe1f=KEY_ZOOM:    value=372
  parsing 0xfe43=KEY_REWIND:  value=168
  parsing 0xfe47=KEY_PAUSE:   value=119
  parsing 0xfe4f=KEY_FASTFORWARD: value=208
  parsing 0xfe57=KEY_MUTE:    value=113
  parsing 0xfe0d=KEY_STOP:    value=128
  parsing 0xfe01=KEY_RECORD:  value=167
  parsing 0xfe4e=KEY_POWER:   value=116
  Read dvico_mce table
  Opening /dev/input/event15
  Input Protocol version: 0x00010001
      fe4e=0074
      fe01=00a7
      fe0d=0080
      fe57=0071
      fe4f=00d0
      fe47=0077
      fe43=00a8
      fe1f=0174
      fe03=000b
      fe13=0173
      fe58=000a
      fe4c=0009
      fe48=0008
      fe54=0007
      fe50=0006
      fe07=0005
      fe1b=0004
      fe17=0003
      fe0b=0002
      fe19=0086
      fe5a=0182
      fe52=00d4
      fe09=0193
      fe11=0192
      fe05=0072
      fe15=0073
      fe42=001c
      fe12=00a3
      fe0f=00a5
      fe55=000f
      fe59=0166
      fe5e=0160
      fe53=006c
      fe5f=006a
      fe5b=0069
      fe51=0067
      fe4d=008b
      fe49=009e
      fe0a=016d
      fe46=0164
      fe16=008d
      fe1e=016c
      fe1a=0185
      fe0e=0187
      fe02=0179
  Wrote 45 keycode(s) to driver
  Segmentation fault (core dumped)
 
Is this just operator error?
What further diagnostics would help?

Vince

PS evtest reports this about the device:
  # evtest /dev/input/event15
  Input driver version is 1.0.1
  Input device ID: bus 0x3 vendor 0xfe9 product 0xdb78 version 0x827b
  Input device name: "IR-receiver inside an USB DVB receiver"
  Supported events:
    Event type 0 (EV_SYN)
    Event type 1 (EV_KEY)
    ...<elided>...
    Event code 403 (KEY_CHANNELDOWN)
  Properties:
  Testing ... (interrupt to exit)
  ^C

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-16 10:52 ir-keytable: infinite loops, segfaults Vincent McIntyre
@ 2016-11-17 13:45 ` Sean Young
  2016-11-18 12:14   ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2016-11-17 13:45 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Wed, Nov 16, 2016 at 09:52:58PM +1100, Vincent McIntyre wrote:
> I have a fairly old dvico dual digital 4 tuner and remote.
> There seem to be some issues with support for it, can I help fix them?
> 
> I am using ir-keytable 1.10.0-1 on Ubuntu 16.04 LTS,
> with kernel 4.4.0-47-generic (package version 4.4.0-47-generic)
> 
> The remote's keymapping is the one in /lib/udev/rc_keymaps/dvico_mce;
> kernel support for the device is in media/usb/dvb-usb/cxusb.c.
> 
> Mostly it works, in that I get correct keycodes back from evtest
> and ir-keytable -t. But I want to change some of the keycode mappings
> and that is not working.

I suspect the problem here is rc-core is not used and 
legacy_dvb_usb_setkeycode has a bug (it has several problems).

It would be nicer if we could move it rc-core, but for that to work
we need to know what scancodes remote sends (and in what protocol).
A scancode of 0xfe47 is not a valid RC5 scancode.

Would it be possible to test the remote with another device (say an
usb mce receiver or so) and see what scancodes it sends? Then we can
translate the keymap to a real one and make the cxusb driver send
correct scancodes to rc-core.


Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-17 13:45 ` Sean Young
@ 2016-11-18 12:14   ` Vincent McIntyre
  2016-11-18 17:40     ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-18 12:14 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Thu, Nov 17, 2016 at 01:45:26PM +0000, Sean Young wrote:
> On Wed, Nov 16, 2016 at 09:52:58PM +1100, Vincent McIntyre wrote:
> > I have a fairly old dvico dual digital 4 tuner and remote.
> > There seem to be some issues with support for it, can I help fix them?
> > 
> > I am using ir-keytable 1.10.0-1 on Ubuntu 16.04 LTS,
> > with kernel 4.4.0-47-generic (package version 4.4.0-47-generic)
> > 
> > The remote's keymapping is the one in /lib/udev/rc_keymaps/dvico_mce;
> > kernel support for the device is in media/usb/dvb-usb/cxusb.c.
> > 
> > Mostly it works, in that I get correct keycodes back from evtest
> > and ir-keytable -t. But I want to change some of the keycode mappings
> > and that is not working.
> 
> I suspect the problem here is rc-core is not used and 
> legacy_dvb_usb_setkeycode has a bug (it has several problems).
> 
> It would be nicer if we could move it rc-core, but for that to work
> we need to know what scancodes remote sends (and in what protocol).
> A scancode of 0xfe47 is not a valid RC5 scancode.
 
So are you saying that the hex codes in the rc_map_dvico_mce_table
struct are invalid (at least in some cases)?

How can I tell what protocol is in use?
0x00010001 doesn't mean much to me; I did search the linux source
for the code but didn't find any helpful matches.

> Would it be possible to test the remote with another device (say an
> usb mce receiver or so) and see what scancodes it sends? Then we can
> translate the keymap to a real one and make the cxusb driver send
> correct scancodes to rc-core.

Great idea. Do you mean something like [1]?
Or the (presumably generic) receiver that comes with [2]?
Would a FLIRC work?

Probably dumb question - in this machine I also have
an iMon Remote (152c:ffdc)
and Leadtek WinFast DTV Dongle Dual
Do you think either of those would be helpful?
I tried evtest with them and the remote, no responses.

# ir-keytable
Found /sys/class/rc/rce0/ (/dev/input/event5) with:
    Driver imon, table rc-imon-mce
    Supported protocols: rc-6 
    Enabled protocols: rc-6 
    Name: iMON Remote (15c2:ffdc)
    bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
    Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event16) with:
    Driver dvb_usb_af9035, table rc-empty
    Supported protocols: nec 
    Enabled protocols: 
    Name: Leadtek WinFamst DTV Dongle Dual
    bus: 3, vendor/product: 0413:6a05, version: 0x0200
    Repeat delay = 500 mss, repeat period = 125 ms

Thanks
Vince

[1] http://www.ebay.com.au/itm/New-HP-USB-MCE-IR-Wireless-Receiver-Windows-7-Vista-/261127073131
[2] https://www.jaycar.com.au/home-theatre-pc-remote-control/p/XC4939


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-18 12:14   ` Vincent McIntyre
@ 2016-11-18 17:40     ` Sean Young
  2016-11-18 22:01       ` Vincent McIntyre
                         ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Sean Young @ 2016-11-18 17:40 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Fri, Nov 18, 2016 at 11:14:25PM +1100, Vincent McIntyre wrote:
> On Thu, Nov 17, 2016 at 01:45:26PM +0000, Sean Young wrote:
> > On Wed, Nov 16, 2016 at 09:52:58PM +1100, Vincent McIntyre wrote:
> > > I have a fairly old dvico dual digital 4 tuner and remote.
> > > There seem to be some issues with support for it, can I help fix them?
> > > 
> > > I am using ir-keytable 1.10.0-1 on Ubuntu 16.04 LTS,
> > > with kernel 4.4.0-47-generic (package version 4.4.0-47-generic)
> > > 
> > > The remote's keymapping is the one in /lib/udev/rc_keymaps/dvico_mce;
> > > kernel support for the device is in media/usb/dvb-usb/cxusb.c.
> > > 
> > > Mostly it works, in that I get correct keycodes back from evtest
> > > and ir-keytable -t. But I want to change some of the keycode mappings
> > > and that is not working.
> > 
> > I suspect the problem here is rc-core is not used and 
> > legacy_dvb_usb_setkeycode has a bug (it has several problems).
> > 
> > It would be nicer if we could move it rc-core, but for that to work
> > we need to know what scancodes remote sends (and in what protocol).
> > A scancode of 0xfe47 is not a valid RC5 scancode.
>  
> So are you saying that the hex codes in the rc_map_dvico_mce_table
> struct are invalid (at least in some cases)?

Most likely the remote produces IR in a standard protocol (e.g. rc5, rc6). 
If we first get the keymap right then the remote can be used with any 
IR receiver that can deal with its protocol; conversely, if we know 
what protocol the IR receiver can receive, and we make it produce the 
scancodes in the right format, it can then be used with any remote that 
uses the protocol it understands.

So at the moment we don't know what protocol it is, and even if it is 
rc5 then some bit shifting might be needed to make it into a proper
rc5 scancode (both driver and keymap).

> How can I tell what protocol is in use?
> 0x00010001 doesn't mean much to me; I did search the linux source
> for the code but didn't find any helpful matches.

At the moment it's not easy to determine what protocol an remote uses;
I would like to change that but for now, the following is probably
the easiest way.

cd /sys/class/rc/rc1 # replace rc1 with your receiver
for i in $(<protocols); do echo +$i > protocols; done
echo 3 > /sys/module/rc_core/parameters/debug
journal -f -k

Protocol numbers are defined in enum rc_type, see include/media/rc-map.h

> > Would it be possible to test the remote with another device (say an
> > usb mce receiver or so) and see what scancodes it sends? Then we can
> > translate the keymap to a real one and make the cxusb driver send
> > correct scancodes to rc-core.
> 
> Great idea. Do you mean something like [1]?

Yes, it would be a receiver like that.

> Or the (presumably generic) receiver that comes with [2]?

It's not clear what usb receiver it uses.

> Would a FLIRC work?

I hadn't heard of flirc, looks like it doesn't have a kernel driver. Maybe
I'll go and get one. :)

> Probably dumb question - in this machine I also have
> an iMon Remote (152c:ffdc)
> and Leadtek WinFast DTV Dongle Dual
> Do you think either of those would be helpful?
> I tried evtest with them and the remote, no responses.
> 
> # ir-keytable
> Found /sys/class/rc/rce0/ (/dev/input/event5) with:
>     Driver imon, table rc-imon-mce
>     Supported protocols: rc-6 
>     Enabled protocols: rc-6 
>     Name: iMON Remote (15c2:ffdc)
>     bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>     Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc1/ (/dev/input/event16) with:
>     Driver dvb_usb_af9035, table rc-empty
>     Supported protocols: nec 
>     Enabled protocols: 
>     Name: Leadtek WinFamst DTV Dongle Dual
>     bus: 3, vendor/product: 0413:6a05, version: 0x0200
>     Repeat delay = 500 mss, repeat period = 125 ms

Looks like it's neither rc6 nor nec then.

If you don't have the right receiver then all of this a bit academic.
Maybe it's possible to port to rc-core with the existing scancodes.

Thanks
Sean

> 
> Thanks
> Vince
> 
> [1] http://www.ebay.com.au/itm/New-HP-USB-MCE-IR-Wireless-Receiver-Windows-7-Vista-/261127073131
> [2] https://www.jaycar.com.au/home-theatre-pc-remote-control/p/XC4939
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-18 17:40     ` Sean Young
@ 2016-11-18 22:01       ` Vincent McIntyre
  2016-11-20 13:29         ` Sean Young
  2016-11-18 22:49       ` Vincent McIntyre
  2016-11-18 23:57       ` Vincent McIntyre
  2 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-18 22:01 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Fri, Nov 18, 2016 at 05:40:34PM +0000, Sean Young wrote:
> >  
> > So are you saying that the hex codes in the rc_map_dvico_mce_table
> > struct are invalid (at least in some cases)?
> 
> Most likely the remote produces IR in a standard protocol (e.g. rc5, rc6). 
> If we first get the keymap right then the remote can be used with any 
> IR receiver that can deal with its protocol; conversely, if we know 
> what protocol the IR receiver can receive, and we make it produce the 
> scancodes in the right format, it can then be used with any remote that 
> uses the protocol it understands.
> 
> So at the moment we don't know what protocol it is, and even if it is 
> rc5 then some bit shifting might be needed to make it into a proper
> rc5 scancode (both driver and keymap).
> 
> > How can I tell what protocol is in use?
> > 0x00010001 doesn't mean much to me; I did search the linux source
> > for the code but didn't find any helpful matches.
> 
> At the moment it's not easy to determine what protocol an remote uses;
> I would like to change that but for now, the following is probably
> the easiest way.
> 
> cd /sys/class/rc/rc1 # replace rc1 with your receiver
> for i in $(<protocols); do echo +$i > protocols; done
> echo 3 > /sys/module/rc_core/parameters/debug
> journal -f -k
 
Ah. Here we have a problem. The device (/dev/input/event15)
doesn't have a corresponding rcX node, see ir-keytable output below.
I had it explained to me like this:

  A "HID" device is basically any input device that resembles
  a keyboard or mouse (Human Interface Device). The label may also cover
  things like joysticks, etc. It does /not/ include remotes, so it
  seems, since "remote" can cover a wide variety of input devices.

  Some remotes can emulate fully or partially keyboard keypresses
  which is why they can be treated as HID devices. Of course, not all
  the keys may be mapped correctly or at all.


> Protocol numbers are defined in enum rc_type, see include/media/rc-map.h
> 
> > > Would it be possible to test the remote with another device (say an
> > > usb mce receiver or so) and see what scancodes it sends? Then we can
> > > translate the keymap to a real one and make the cxusb driver send
> > > correct scancodes to rc-core.
> > 
> > Great idea. Do you mean something like [1]?
> 
> Yes, it would be a receiver like that.
> 
> > Or the (presumably generic) receiver that comes with [2]?
> 
> It's not clear what usb receiver it uses.
> 
> > Would a FLIRC work?
> 
> I hadn't heard of flirc, looks like it doesn't have a kernel driver. Maybe
> I'll go and get one. :)
> 
> > Probably dumb question - in this machine I also have
> > an iMon Remote (152c:ffdc)
> > and Leadtek WinFast DTV Dongle Dual
> > Do you think either of those would be helpful?
> > I tried evtest with them and the remote, no responses.
> > 
> > # ir-keytable
> > Found /sys/class/rc/rce0/ (/dev/input/event5) with:
> >     Driver imon, table rc-imon-mce
> >     Supported protocols: rc-6 
> >     Enabled protocols: rc-6 
> >     Name: iMON Remote (15c2:ffdc)
> >     bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
> >     Repeat delay = 500 ms, repeat period = 125 ms
> > Found /sys/class/rc/rc1/ (/dev/input/event16) with:
> >     Driver dvb_usb_af9035, table rc-empty
> >     Supported protocols: nec 
> >     Enabled protocols: 
> >     Name: Leadtek WinFamst DTV Dongle Dual
> >     bus: 3, vendor/product: 0413:6a05, version: 0x0200
> >     Repeat delay = 500 mss, repeat period = 125 ms
> 
> Looks like it's neither rc6 nor nec then.
> 
> If you don't have the right receiver then all of this a bit academic.
> Maybe it's possible to port to rc-core with the existing scancodes.

I may have given bad information here - I need to check whether the
IR receivers for these devices are properly connected. That might be
why there was no response...

Thanks for your help so far
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-18 17:40     ` Sean Young
  2016-11-18 22:01       ` Vincent McIntyre
@ 2016-11-18 22:49       ` Vincent McIntyre
  2016-11-18 23:57       ` Vincent McIntyre
  2 siblings, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-18 22:49 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Fri, Nov 18, 2016 at 05:40:34PM +0000, Sean Young wrote:
> > 
> > # ir-keytable
> > Found /sys/class/rc/rce0/ (/dev/input/event5) with:
> >     Driver imon, table rc-imon-mce
> >     Supported protocols: rc-6 
> >     Enabled protocols: rc-6 
> >     Name: iMON Remote (15c2:ffdc)
> >     bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
> >     Repeat delay = 500 ms, repeat period = 125 ms
> > Found /sys/class/rc/rc1/ (/dev/input/event16) with:
> >     Driver dvb_usb_af9035, table rc-empty
> >     Supported protocols: nec 
> >     Enabled protocols: 
> >     Name: Leadtek WinFamst DTV Dongle Dual
> >     bus: 3, vendor/product: 0413:6a05, version: 0x0200
> >     Repeat delay = 500 mss, repeat period = 125 ms

So I checked on the ir receivers and found the rc1 device ir receiver
was indeed blocked (haven't checked rc0 properly, time is short)

I tested it with evtest and the remote that comes with the device

# evtest /dev/input/event16
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x413 product 0x6a05 version 0x200
Input device name: "Leadtek WinFast DTV Dongle Dual"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 28 (KEY_ENTER)
    Event code 103 (KEY_UP)
    Event code 105 (KEY_LEFT)
    Event code 106 (KEY_RIGHT)
    Event code 108 (KEY_DOWN)
    Event code 111 (KEY_DELETE)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 119 (KEY_PAUSE)
    Event code 128 (KEY_STOP)
    Event code 142 (KEY_SLEEP)
    Event code 152 (KEY_SCREENLOCK)
    Event code 161 (KEY_EJECTCD)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 167 (KEY_RECORD)
    Event code 168 (KEY_REWIND)
    Event code 174 (KEY_EXIT)
    Event code 207 (KEY_PLAY)
    Event code 208 (KEY_FASTFORWARD)
    Event code 210 (KEY_PRINT)
    Event code 212 (KEY_CAMERA)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 226 (KEY_MEDIA)
    Event code 352 (KEY_OK)
    Event code 356 (KEY_POWER2)
    Event code 358 (KEY_INFO)
    Event code 365 (KEY_EPG)
    Event code 366 (KEY_PVR)
    Event code 368 (KEY_LANGUAGE)
    Event code 369 (KEY_TITLE)
    Event code 370 (KEY_SUBTITLE)
    Event code 372 (KEY_ZOOM)
    Event code 373 (KEY_MODE)
    Event code 377 (KEY_TV)
    Event code 385 (KEY_RADIO)
    Event code 386 (KEY_TUNER)
    Event code 387 (KEY_PLAYER)
    Event code 389 (KEY_DVD)
    Event code 392 (KEY_AUDIO)
    Event code 393 (KEY_VIDEO)
    Event code 398 (KEY_RED)
    Event code 399 (KEY_GREEN)
    Event code 400 (KEY_YELLOW)
    Event code 401 (KEY_BLUE)
    Event code 402 (KEY_CHANNELUP)
    Event code 403 (KEY_CHANNELDOWN)
    Event code 407 (KEY_NEXT)
    Event code 412 (KEY_PREVIOUS)
    Event code 425 (KEY_PRESENTATION)
    Event code 512 (KEY_NUMERIC_0)
    Event code 513 (KEY_NUMERIC_1)
    Event code 514 (KEY_NUMERIC_2)
    Event code 515 (KEY_NUMERIC_3)
    Event code 516 (KEY_NUMERIC_4)
    Event code 517 (KEY_NUMERIC_5)
    Event code 518 (KEY_NUMERIC_6)
    Event code 519 (KEY_NUMERIC_7)
    Event code 520 (KEY_NUMERIC_8)
    Event code 521 (KEY_NUMERIC_9)
    Event code 522 (KEY_NUMERIC_STAR)
    Event code 523 (KEY_NUMERIC_POUND)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    500
    Repeat code 1 (REP_PERIOD)
      Value    125
Properties:
Testing ... (interrupt to exit)
<volumedown pressed>
Event: time 1479509081.158426, type 4 (EV_MSC), code 4 (MSC_SCAN), value 35a
Event: time 1479509081.158426, -------------- SYN_REPORT ------------
<volumeup pressed>
Event: time 1479509084.658351, type 4 (EV_MSC), code 4 (MSC_SCAN), value 35e
Event: time 1479509084.658351, -------------- SYN_REPORT ------------
^C

I tried to load a keymap but got another segfault

# ir-keytable -p nec -d /dev/input/event16 -w /lib/udev/rc_keymaps/rc6_mce 
Read rc6_mce table
Wrote 63 keycode(s) to driver
Segmentation fault (core dumped)

Can't find a -dbg package so can't give you a useful backtrace
at the moment.

Anyway: trying the same evtest with the dvico remote
evtest /dev/input/event16
<volumedown>
Event: time 1479509251.174361, type 4 (EV_MSC), code 4 (MSC_SCAN), value 105
Event: time 1479509251.174361, -------------- SYN_REPORT ------------
<volumeup>
Event: time 1479509254.174403, type 4 (EV_MSC), code 4 (MSC_SCAN), value 115
Event: time 1479509254.174403, -------------- SYN_REPORT ------------

So something is connecting via IR.
Out of time now, more later
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-18 17:40     ` Sean Young
  2016-11-18 22:01       ` Vincent McIntyre
  2016-11-18 22:49       ` Vincent McIntyre
@ 2016-11-18 23:57       ` Vincent McIntyre
  2 siblings, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-18 23:57 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Fri, Nov 18, 2016 at 05:40:34PM +0000, Sean Young wrote:
> 
> At the moment it's not easy to determine what protocol an remote uses;
> I would like to change that but for now, the following is probably
> the easiest way.
> 
> cd /sys/class/rc/rc1 # replace rc1 with your receiver
> for i in $(<protocols); do echo +$i > protocols; done
> echo 3 > /sys/module/rc_core/parameters/debug
> journal -f -k
> 
> Protocol numbers are defined in enum rc_type, see include/media/rc-map.h

I tried this with the rc1 device as a test. I get this odd result:
# cat protocols
nec
# echo '+nec' > protocols
bash: echo: write error: Invalid argument

and ir-keytable still shows no protocols enabled
# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
    Driver imon, table rc-imon-mce
    Supported protocols: rc-6 
    Enabled protocols: rc-6 
    Name: iMON Remote (15c2:ffdc)
    bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
    Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event16) with:
    Driver dvb_usb_af9035, table rc-empty
    Supported protocols: nec 
    Enabled protocols: 
    Name: Leadtek WinFast DTV Dongle Dual
    bus: 3, vendor/product: 0413:6a05, version: 0x0200
    Repeat delay = 500 ms, repeat period = 125 ms

I messed around some more with ir-keytable and got more segfaults
if I try to use the -d argument.

# ir-keytable -d /dev/input/event16 -p NEC -p RC6 -w /lib/udev/rc_keymaps/rc6_mce 
Read rc6_mce table
Wrote 63 keycode(s) to driver
Segmentation fault (core dumped)

-s at least doesn't segfault, but doesn't advance the cause.

# ir-keytable -s rc1 -p NEC -p RC6 -w /lib/udev/rc_keymaps/rc6_mce 
Read rc6_mce table
Wrote 63 keycode(s) to driver
/sys/class/rc/rc1//protocols: Invalid argument
Couldn't change the IR protocols


# ir-keytable -s rc1 -p NEC -w /lib/udev/rc_keymaps/winfast
Read winfast table
Wrote 56 keycode(s) to driver
/sys/class/rc/rc1//protocols: Invalid argument
Couldn't change the IR protocols

Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-18 22:01       ` Vincent McIntyre
@ 2016-11-20 13:29         ` Sean Young
  2016-11-22  7:25           ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2016-11-20 13:29 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Sat, Nov 19, 2016 at 09:01:10AM +1100, Vincent McIntyre wrote:
> On Fri, Nov 18, 2016 at 05:40:34PM +0000, Sean Young wrote:
> > >  
> > > So are you saying that the hex codes in the rc_map_dvico_mce_table
> > > struct are invalid (at least in some cases)?
> > 
> > Most likely the remote produces IR in a standard protocol (e.g. rc5, rc6). 
> > If we first get the keymap right then the remote can be used with any 
> > IR receiver that can deal with its protocol; conversely, if we know 
> > what protocol the IR receiver can receive, and we make it produce the 
> > scancodes in the right format, it can then be used with any remote that 
> > uses the protocol it understands.
> > 
> > So at the moment we don't know what protocol it is, and even if it is 
> > rc5 then some bit shifting might be needed to make it into a proper
> > rc5 scancode (both driver and keymap).
> > 
> > > How can I tell what protocol is in use?
> > > 0x00010001 doesn't mean much to me; I did search the linux source
> > > for the code but didn't find any helpful matches.
> > 
> > At the moment it's not easy to determine what protocol an remote uses;
> > I would like to change that but for now, the following is probably
> > the easiest way.
> > 
> > cd /sys/class/rc/rc1 # replace rc1 with your receiver
> > for i in $(<protocols); do echo +$i > protocols; done
> > echo 3 > /sys/module/rc_core/parameters/debug
> > journal -f -k
>  
> Ah. Here we have a problem. The device (/dev/input/event15)
> doesn't have a corresponding rcX node, see ir-keytable output below.
> I had it explained to me like this:

As I said you would need to use a raw IR receiver which has rc-core support
to determine the protocol, so never mind. Please can you try this patch:

I don't have the hardware to test this so your input would be appreciated.


Sean

From: Sean Young <sean@mess.org>
Subject: [PATCH] [media] cxusb: port to rc-core

The d680_dmb keymap has some new new mappings.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/keymaps/Makefile            |   3 +
 drivers/media/rc/keymaps/rc-d680-dmb.c       |  75 +++++++
 drivers/media/rc/keymaps/rc-dvico-mce.c      |  85 ++++++++
 drivers/media/rc/keymaps/rc-dvico-portable.c |  76 +++++++
 drivers/media/usb/dvb-usb/cxusb.c            | 298 ++++++---------------------
 include/media/rc-map.h                       |   3 +
 6 files changed, 308 insertions(+), 232 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-d680-dmb.c
 create mode 100644 drivers/media/rc/keymaps/rc-dvico-mce.c
 create mode 100644 drivers/media/rc/keymaps/rc-dvico-portable.c

diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index d7b13fa..11d5d5a 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-cec.o \
 			rc-cinergy-1400.o \
 			rc-cinergy.o \
+			rc-d680-dmb.o \
 			rc-delock-61959.o \
 			rc-dib0700-nec.o \
 			rc-dib0700-rc5.o \
@@ -31,6 +32,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-dntv-live-dvbt-pro.o \
 			rc-dtt200u.o \
 			rc-dvbsky.o \
+			rc-dvico-mce.o \
+			rc-dvico-portable.o \
 			rc-em-terratec.o \
 			rc-encore-enltv2.o \
 			rc-encore-enltv.o \
diff --git a/drivers/media/rc/keymaps/rc-d680-dmb.c b/drivers/media/rc/keymaps/rc-d680-dmb.c
new file mode 100644
index 0000000..bb5745d
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-d680-dmb.c
@@ -0,0 +1,75 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_d680_dmb_table[] = {
+	{ 0x0038, KEY_SWITCHVIDEOMODE },	/* TV/AV */
+	{ 0x080c, KEY_ZOOM },
+	{ 0x0800, KEY_0 },
+	{ 0x0001, KEY_1 },
+	{ 0x0802, KEY_2 },
+	{ 0x0003, KEY_3 },
+	{ 0x0804, KEY_4 },
+	{ 0x0005, KEY_5 },
+	{ 0x0806, KEY_6 },
+	{ 0x0007, KEY_7 },
+	{ 0x0808, KEY_8 },
+	{ 0x0009, KEY_9 },
+	{ 0x000a, KEY_MUTE },
+	{ 0x0829, KEY_BACK },
+	{ 0x0012, KEY_CHANNELUP },
+	{ 0x0813, KEY_CHANNELDOWN },
+	{ 0x002b, KEY_VOLUMEUP },
+	{ 0x082c, KEY_VOLUMEDOWN },
+	{ 0x0020, KEY_UP },
+	{ 0x0821, KEY_DOWN },
+	{ 0x0011, KEY_LEFT },
+	{ 0x0810, KEY_RIGHT },
+	{ 0x000d, KEY_OK },
+	{ 0x081f, KEY_RECORD },
+	{ 0x0017, KEY_PLAYPAUSE },
+	{ 0x0816, KEY_PLAYPAUSE },
+	{ 0x000b, KEY_STOP },
+	{ 0x0827, KEY_FASTFORWARD },
+	{ 0x0026, KEY_REWIND },
+	{ 0x081e, KEY_UNKNOWN },    /* Time Shift */
+	{ 0x000e, KEY_UNKNOWN },    /* Snapshot */
+	{ 0x082d, KEY_UNKNOWN },    /* Mouse Cursor */
+	{ 0x000f, KEY_UNKNOWN },    /* Minimize/Maximize */
+	{ 0x0814, KEY_SHUFFLE },    /* Shuffle */
+	{ 0x0025, KEY_POWER },
+};
+
+static struct rc_map_list d680_dmb_map = {
+	.map = {
+		.scan    = rc_map_d680_dmb_table,
+		.size    = ARRAY_SIZE(rc_map_d680_dmb_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_D680_DMB,
+	}
+};
+
+static int __init init_rc_map_d680_dmb(void)
+{
+	return rc_map_register(&d680_dmb_map);
+}
+
+static void __exit exit_rc_map_d680_dmb(void)
+{
+	rc_map_unregister(&d680_dmb_map);
+}
+
+module_init(init_rc_map_d680_dmb)
+module_exit(exit_rc_map_d680_dmb)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dvico-mce.c b/drivers/media/rc/keymaps/rc-dvico-mce.c
new file mode 100644
index 0000000..e5f098c
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-dvico-mce.c
@@ -0,0 +1,85 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_dvico_mce_table[] = {
+	{ 0xfe02, KEY_TV },
+	{ 0xfe0e, KEY_MP3 },
+	{ 0xfe1a, KEY_DVD },
+	{ 0xfe1e, KEY_FAVORITES },
+	{ 0xfe16, KEY_SETUP },
+	{ 0xfe46, KEY_POWER2 },
+	{ 0xfe0a, KEY_EPG },
+	{ 0xfe49, KEY_BACK },
+	{ 0xfe4d, KEY_MENU },
+	{ 0xfe51, KEY_UP },
+	{ 0xfe5b, KEY_LEFT },
+	{ 0xfe5f, KEY_RIGHT },
+	{ 0xfe53, KEY_DOWN },
+	{ 0xfe5e, KEY_OK },
+	{ 0xfe59, KEY_INFO },
+	{ 0xfe55, KEY_TAB },
+	{ 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
+	{ 0xfe12, KEY_NEXTSONG },	/* Skip */
+	{ 0xfe42, KEY_ENTER	 },	/* Windows/Start */
+	{ 0xfe15, KEY_VOLUMEUP },
+	{ 0xfe05, KEY_VOLUMEDOWN },
+	{ 0xfe11, KEY_CHANNELUP },
+	{ 0xfe09, KEY_CHANNELDOWN },
+	{ 0xfe52, KEY_CAMERA },
+	{ 0xfe5a, KEY_TUNER },	/* Live */
+	{ 0xfe19, KEY_OPEN },
+	{ 0xfe0b, KEY_1 },
+	{ 0xfe17, KEY_2 },
+	{ 0xfe1b, KEY_3 },
+	{ 0xfe07, KEY_4 },
+	{ 0xfe50, KEY_5 },
+	{ 0xfe54, KEY_6 },
+	{ 0xfe48, KEY_7 },
+	{ 0xfe4c, KEY_8 },
+	{ 0xfe58, KEY_9 },
+	{ 0xfe13, KEY_ANGLE },	/* Aspect */
+	{ 0xfe03, KEY_0 },
+	{ 0xfe1f, KEY_ZOOM },
+	{ 0xfe43, KEY_REWIND },
+	{ 0xfe47, KEY_PLAYPAUSE },
+	{ 0xfe4f, KEY_FASTFORWARD },
+	{ 0xfe57, KEY_MUTE },
+	{ 0xfe0d, KEY_STOP },
+	{ 0xfe01, KEY_RECORD },
+	{ 0xfe4e, KEY_POWER },
+};
+
+static struct rc_map_list dvico_mce_map = {
+	.map = {
+		.scan    = rc_map_dvico_mce_table,
+		.size    = ARRAY_SIZE(rc_map_dvico_mce_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_DVICO_MCE,
+	}
+};
+
+static int __init init_rc_map_dvico_mce(void)
+{
+	return rc_map_register(&dvico_mce_map);
+}
+
+static void __exit exit_rc_map_dvico_mce(void)
+{
+	rc_map_unregister(&dvico_mce_map);
+}
+
+module_init(init_rc_map_dvico_mce)
+module_exit(exit_rc_map_dvico_mce)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dvico-portable.c b/drivers/media/rc/keymaps/rc-dvico-portable.c
new file mode 100644
index 0000000..94ceeee
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-dvico-portable.c
@@ -0,0 +1,76 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_dvico_portable_table[] = {
+	{ 0xfc02, KEY_SETUP },       /* Profile */
+	{ 0xfc43, KEY_POWER2 },
+	{ 0xfc06, KEY_EPG },
+	{ 0xfc5a, KEY_BACK },
+	{ 0xfc05, KEY_MENU },
+	{ 0xfc47, KEY_INFO },
+	{ 0xfc01, KEY_TAB },
+	{ 0xfc42, KEY_PREVIOUSSONG },/* Replay */
+	{ 0xfc49, KEY_VOLUMEUP },
+	{ 0xfc09, KEY_VOLUMEDOWN },
+	{ 0xfc54, KEY_CHANNELUP },
+	{ 0xfc0b, KEY_CHANNELDOWN },
+	{ 0xfc16, KEY_CAMERA },
+	{ 0xfc40, KEY_TUNER },	/* ATV/DTV */
+	{ 0xfc45, KEY_OPEN },
+	{ 0xfc19, KEY_1 },
+	{ 0xfc18, KEY_2 },
+	{ 0xfc1b, KEY_3 },
+	{ 0xfc1a, KEY_4 },
+	{ 0xfc58, KEY_5 },
+	{ 0xfc59, KEY_6 },
+	{ 0xfc15, KEY_7 },
+	{ 0xfc14, KEY_8 },
+	{ 0xfc17, KEY_9 },
+	{ 0xfc44, KEY_ANGLE },	/* Aspect */
+	{ 0xfc55, KEY_0 },
+	{ 0xfc07, KEY_ZOOM },
+	{ 0xfc0a, KEY_REWIND },
+	{ 0xfc08, KEY_PLAYPAUSE },
+	{ 0xfc4b, KEY_FASTFORWARD },
+	{ 0xfc5b, KEY_MUTE },
+	{ 0xfc04, KEY_STOP },
+	{ 0xfc56, KEY_RECORD },
+	{ 0xfc57, KEY_POWER },
+	{ 0xfc41, KEY_UNKNOWN },    /* INPUT */
+	{ 0xfc00, KEY_UNKNOWN },    /* HD */
+};
+
+static struct rc_map_list dvico_portable_map = {
+	.map = {
+		.scan    = rc_map_dvico_portable_table,
+		.size    = ARRAY_SIZE(rc_map_dvico_portable_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_DVICO_PORTABLE,
+	}
+};
+
+static int __init init_rc_map_dvico_portable(void)
+{
+	return rc_map_register(&dvico_portable_map);
+}
+
+static void __exit exit_rc_map_dvico_portable(void)
+{
+	rc_map_unregister(&dvico_portable_map);
+}
+
+module_init(init_rc_map_dvico_portable)
+module_exit(exit_rc_map_dvico_portable)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index 9b8771e..29d89c4 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -450,209 +450,43 @@ static int cxusb_d680_dmb_streaming_ctrl(
 	}
 }
 
-static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int cxusb_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[4];
-	int i;
 
 	cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
 
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
-
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[2] &&
-		    rc5_data(&keymap[i]) == ircode[3]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[2], ircode[3]), 0);
 	return 0;
 }
 
-static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
-				    int *state)
+static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[4];
-	int i;
 	struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
 			       .buf = ircode, .len = 4 };
 
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
-
 	if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
 		return 0;
 
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[1] &&
-		    rc5_data(&keymap[i]) == ircode[2]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[1], ircode[2]), 0);
 	return 0;
 }
 
-static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
-		int *state)
+static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[2];
-	int i;
-
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
 
 	if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
 		return 0;
 
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[0] &&
-		    rc5_data(&keymap[i]) == ircode[1]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
 	return 0;
 }
 
-static struct rc_map_table rc_map_dvico_mce_table[] = {
-	{ 0xfe02, KEY_TV },
-	{ 0xfe0e, KEY_MP3 },
-	{ 0xfe1a, KEY_DVD },
-	{ 0xfe1e, KEY_FAVORITES },
-	{ 0xfe16, KEY_SETUP },
-	{ 0xfe46, KEY_POWER2 },
-	{ 0xfe0a, KEY_EPG },
-	{ 0xfe49, KEY_BACK },
-	{ 0xfe4d, KEY_MENU },
-	{ 0xfe51, KEY_UP },
-	{ 0xfe5b, KEY_LEFT },
-	{ 0xfe5f, KEY_RIGHT },
-	{ 0xfe53, KEY_DOWN },
-	{ 0xfe5e, KEY_OK },
-	{ 0xfe59, KEY_INFO },
-	{ 0xfe55, KEY_TAB },
-	{ 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfe12, KEY_NEXTSONG },	/* Skip */
-	{ 0xfe42, KEY_ENTER	 },	/* Windows/Start */
-	{ 0xfe15, KEY_VOLUMEUP },
-	{ 0xfe05, KEY_VOLUMEDOWN },
-	{ 0xfe11, KEY_CHANNELUP },
-	{ 0xfe09, KEY_CHANNELDOWN },
-	{ 0xfe52, KEY_CAMERA },
-	{ 0xfe5a, KEY_TUNER },	/* Live */
-	{ 0xfe19, KEY_OPEN },
-	{ 0xfe0b, KEY_1 },
-	{ 0xfe17, KEY_2 },
-	{ 0xfe1b, KEY_3 },
-	{ 0xfe07, KEY_4 },
-	{ 0xfe50, KEY_5 },
-	{ 0xfe54, KEY_6 },
-	{ 0xfe48, KEY_7 },
-	{ 0xfe4c, KEY_8 },
-	{ 0xfe58, KEY_9 },
-	{ 0xfe13, KEY_ANGLE },	/* Aspect */
-	{ 0xfe03, KEY_0 },
-	{ 0xfe1f, KEY_ZOOM },
-	{ 0xfe43, KEY_REWIND },
-	{ 0xfe47, KEY_PLAYPAUSE },
-	{ 0xfe4f, KEY_FASTFORWARD },
-	{ 0xfe57, KEY_MUTE },
-	{ 0xfe0d, KEY_STOP },
-	{ 0xfe01, KEY_RECORD },
-	{ 0xfe4e, KEY_POWER },
-};
-
-static struct rc_map_table rc_map_dvico_portable_table[] = {
-	{ 0xfc02, KEY_SETUP },       /* Profile */
-	{ 0xfc43, KEY_POWER2 },
-	{ 0xfc06, KEY_EPG },
-	{ 0xfc5a, KEY_BACK },
-	{ 0xfc05, KEY_MENU },
-	{ 0xfc47, KEY_INFO },
-	{ 0xfc01, KEY_TAB },
-	{ 0xfc42, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfc49, KEY_VOLUMEUP },
-	{ 0xfc09, KEY_VOLUMEDOWN },
-	{ 0xfc54, KEY_CHANNELUP },
-	{ 0xfc0b, KEY_CHANNELDOWN },
-	{ 0xfc16, KEY_CAMERA },
-	{ 0xfc40, KEY_TUNER },	/* ATV/DTV */
-	{ 0xfc45, KEY_OPEN },
-	{ 0xfc19, KEY_1 },
-	{ 0xfc18, KEY_2 },
-	{ 0xfc1b, KEY_3 },
-	{ 0xfc1a, KEY_4 },
-	{ 0xfc58, KEY_5 },
-	{ 0xfc59, KEY_6 },
-	{ 0xfc15, KEY_7 },
-	{ 0xfc14, KEY_8 },
-	{ 0xfc17, KEY_9 },
-	{ 0xfc44, KEY_ANGLE },	/* Aspect */
-	{ 0xfc55, KEY_0 },
-	{ 0xfc07, KEY_ZOOM },
-	{ 0xfc0a, KEY_REWIND },
-	{ 0xfc08, KEY_PLAYPAUSE },
-	{ 0xfc4b, KEY_FASTFORWARD },
-	{ 0xfc5b, KEY_MUTE },
-	{ 0xfc04, KEY_STOP },
-	{ 0xfc56, KEY_RECORD },
-	{ 0xfc57, KEY_POWER },
-	{ 0xfc41, KEY_UNKNOWN },    /* INPUT */
-	{ 0xfc00, KEY_UNKNOWN },    /* HD */
-};
-
-static struct rc_map_table rc_map_d680_dmb_table[] = {
-	{ 0x0038, KEY_UNKNOWN },	/* TV/AV */
-	{ 0x080c, KEY_ZOOM },
-	{ 0x0800, KEY_0 },
-	{ 0x0001, KEY_1 },
-	{ 0x0802, KEY_2 },
-	{ 0x0003, KEY_3 },
-	{ 0x0804, KEY_4 },
-	{ 0x0005, KEY_5 },
-	{ 0x0806, KEY_6 },
-	{ 0x0007, KEY_7 },
-	{ 0x0808, KEY_8 },
-	{ 0x0009, KEY_9 },
-	{ 0x000a, KEY_MUTE },
-	{ 0x0829, KEY_BACK },
-	{ 0x0012, KEY_CHANNELUP },
-	{ 0x0813, KEY_CHANNELDOWN },
-	{ 0x002b, KEY_VOLUMEUP },
-	{ 0x082c, KEY_VOLUMEDOWN },
-	{ 0x0020, KEY_UP },
-	{ 0x0821, KEY_DOWN },
-	{ 0x0011, KEY_LEFT },
-	{ 0x0810, KEY_RIGHT },
-	{ 0x000d, KEY_OK },
-	{ 0x081f, KEY_RECORD },
-	{ 0x0017, KEY_PLAYPAUSE },
-	{ 0x0816, KEY_PLAYPAUSE },
-	{ 0x000b, KEY_STOP },
-	{ 0x0827, KEY_FASTFORWARD },
-	{ 0x0026, KEY_REWIND },
-	{ 0x081e, KEY_UNKNOWN },    /* Time Shift */
-	{ 0x000e, KEY_UNKNOWN },    /* Snapshot */
-	{ 0x082d, KEY_UNKNOWN },    /* Mouse Cursor */
-	{ 0x000f, KEY_UNKNOWN },    /* Minimize/Maximize */
-	{ 0x0814, KEY_UNKNOWN },    /* Shuffle */
-	{ 0x0025, KEY_POWER },
-};
-
 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
 {
 	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
@@ -1000,7 +834,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
 		return -EIO;
 
 	/* try to determine if there is no IR decoder on the I2C bus */
-	for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) {
+	for (i = 0; adap->dev->props.rc.core.rc_codes != NULL && i < 5; i++) {
 		msleep(20);
 		if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
 			goto no_IR;
@@ -1008,7 +842,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
 			continue;
 		if (ircode[2] + ircode[3] != 0xff) {
 no_IR:
-			adap->dev->props.rc.legacy.rc_map_table = NULL;
+			adap->dev->props.rc.core.rc_codes = NULL;
 			info("No IR receiver detected on this device.");
 			break;
 		}
@@ -1720,11 +1554,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1776,11 +1610,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 150,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1840,11 +1674,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1895,11 +1729,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1949,11 +1783,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_bluebird2_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.rc_query	= cxusb_bluebird2_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2002,11 +1836,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_bluebird2_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.rc_query       = cxusb_bluebird2_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2057,11 +1891,11 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2155,11 +1989,11 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2208,11 +2042,11 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2262,11 +2096,11 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2315,11 +2149,11 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e1cc14c..82feb2d 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -198,6 +198,7 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_CEC                       "rc-cec"
 #define RC_MAP_CINERGY_1400              "rc-cinergy-1400"
 #define RC_MAP_CINERGY                   "rc-cinergy"
+#define RC_MAP_D680_DMB                  "rc-d680-dmb"
 #define RC_MAP_DELOCK_61959              "rc-delock-61959"
 #define RC_MAP_DIB0700_NEC_TABLE         "rc-dib0700-nec"
 #define RC_MAP_DIB0700_RC5_TABLE         "rc-dib0700-rc5"
@@ -208,6 +209,8 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_DNTV_LIVE_DVB_T           "rc-dntv-live-dvb-t"
 #define RC_MAP_DTT200U                   "rc-dtt200u"
 #define RC_MAP_DVBSKY                    "rc-dvbsky"
+#define RC_MAP_DVICO_MCE		 "rc-dvico-mce"
+#define RC_MAP_DVICO_PORTABLE		 "rc-dvico-portable"
 #define RC_MAP_EMPTY                     "rc-empty"
 #define RC_MAP_EM_TERRATEC               "rc-em-terratec"
 #define RC_MAP_ENCORE_ENLTV2             "rc-encore-enltv2"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-20 13:29         ` Sean Young
@ 2016-11-22  7:25           ` Vincent McIntyre
  2016-11-22  9:20             ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-22  7:25 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On 11/21/16, Sean Young <sean@mess.org> wrote:
>>
>> Ah. Here we have a problem. The device (/dev/input/event15)
>> doesn't have a corresponding rcX node, see ir-keytable output below.
>> I had it explained to me like this:
>
> As I said you would need to use a raw IR receiver which has rc-core support
> to determine the protocol, so never mind. Please can you try this patch:
>
> I don't have the hardware to test this so your input would be appreciated.
>

Thanks for this. I have got it to build within the media_build setup
but will need to find some windows in the schedule for testing. More
in a couple of days. Are there specific things you would like me to
test?

Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-22  7:25           ` Vincent McIntyre
@ 2016-11-22  9:20             ` Sean Young
  2016-11-23 12:39               ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2016-11-22  9:20 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Tue, Nov 22, 2016 at 06:25:59PM +1100, Vincent McIntyre wrote:
> On 11/21/16, Sean Young <sean@mess.org> wrote:
> >>
> >> Ah. Here we have a problem. The device (/dev/input/event15)
> >> doesn't have a corresponding rcX node, see ir-keytable output below.
> >> I had it explained to me like this:
> >
> > As I said you would need to use a raw IR receiver which has rc-core support
> > to determine the protocol, so never mind. Please can you try this patch:
> >
> > I don't have the hardware to test this so your input would be appreciated.
> >
> 
> Thanks for this. I have got it to build within the media_build setup
> but will need to find some windows in the schedule for testing. More
> in a couple of days. Are there specific things you would like me to
> test?

You should have an rc device for the IR receiver in the dvb device; does
it continue to work and can you clear/load a new keymap with ir-keytable,
and does it work after that.

A "Tested-by" would be great if it all works of course.

Thanks
Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-22  9:20             ` Sean Young
@ 2016-11-23 12:39               ` Vincent McIntyre
  2016-11-23 22:34                 ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-23 12:39 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Tue, Nov 22, 2016 at 09:20:44AM +0000, Sean Young wrote:
> > Thanks for this. I have got it to build within the media_build setup
> > but will need to find some windows in the schedule for testing. More
> > in a couple of days. Are there specific things you would like me to
> > test?
> 
> You should have an rc device for the IR receiver in the dvb device; does
> it continue to work and can you clear/load a new keymap with ir-keytable,
> and does it work after that.
> 
> A "Tested-by" would be great if it all works of course.

Time for some initial results. Good start, not quite there yet.

Nov 23 23:04:56 kernel: Registered IR keymap rc-dvico-mce
Nov 23 23:04:56 kernel: input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00
Nov 23 23:04:56 kernel: rc rc1: IR-receiver inside an USB DVB receiver as /devices/pci0000:0
Nov 23 23:04:56 kernel: dvb-usb: schedule remote query interval to 100 msecs.
Nov 23 23:04:56 kernel: dvb-usb: DViCO FusionHDTV DVB-T Dual Digital 4 successfully initiali
Nov 23 23:04:56 kernel: dvb-usb: found a 'DViCO FusionHDTV DVB-T Dual Digital 4' in warm sta
Nov 23 23:04:56 kernel: dvb-usb: will pass the complete MPEG2 transport stream to the softwa
Nov 23 23:04:56 kernel: dvbdev: DVB: registering new adapter (DViCO FusionHDTV DVB-T Dual Di
Nov 23 23:04:56 kernel: usb 3-2: media controller created
Nov 23 23:04:56 kernel: dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered
Nov 23 23:04:56 kernel: cxusb: No IR receiver detected on this device.
Nov 23 23:04:56 kernel: usb 3-2: DVB: registering adapter 1 frontend 0 (Zarlink ZL10353 DVB-
Nov 23 23:04:56 kernel: dvbdev: dvb_create_media_entity: media entity 'Zarlink ZL10353 DVB-T
Nov 23 23:04:56 kernel: xc2028 5-0061: creating new instance
Nov 23 23:04:56 kernel: xc2028 5-0061: type set to XCeive xc2028/xc3028 tuner
Nov 23 23:04:56 kernel: xc2028 5-0061: Loading 80 firmware images from xc3028-v27.fw, type: 
Nov 23 23:04:56 kernel: dvb-usb: DViCO FusionHDTV DVB-T Dual Digital 4 successfully initiali
Nov 23 23:04:56 kernel: usbcore: registered new interface driver dvb_usb_cxusb

# lsmod |grep rc
rc_dvico_mce           16384  0
rc_imon_mce            16384  0
rc_core                32768  11 imon,dvb_usb,winbond_cir,dvb_usb_cxusb,rc_imon_mce,rc_dvico_mce,dvb_usb_v2,dvb_usb_af9035
libcrc32c              16384  1 raid456
crc_itu_t              16384  1 firewire_core

# lsmod |grep cxu
dvb_usb_cxusb          77824  2
dib0070                20480  1 dvb_usb_cxusb
dvb_usb                32768  1 dvb_usb_cxusb
rc_core                32768  11 imon,dvb_usb,winbond_cir,dvb_usb_cxusb,rc_imon_mce,rc_dvico_mce,dvb_usb_v2,dvb_usb_af9035


# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
    Driver imon, table rc-imon-mce
    Supported protocols: rc-6 
    Enabled protocols: rc-6 
    Name: iMON Remote (15c2:ffdc)
    bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
    Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
    Driver (null), table rc-dvico-mce
    Supported protocols: unknown 
    Enabled protocols: 
    Name: IR-receiver inside an USB DVB re
    bus: 3, vendor/product: 0fe9:db78, version: 0x827b
    Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
    Driver dvb_usb_af9035, table rc-empty
    Supported protocols: nec 
    Enabled protocols: 
    Name: Leadtek WinFast DTV Dongle Dual
    bus: 3, vendor/product: 0413:6a05, version: 0x0200
    Repeat delay = 500 ms, repeat period = 125 ms

Not sure why Driver is (null), dvb_usb_cxusb is loaded.

# ir-keytable -s rc1 -r -v
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
scancode 0xfe01 = KEY_RECORD (0xa7)
scancode 0xfe02 = KEY_TV (0x179)
scancode 0xfe03 = KEY_0 (0x0b)
scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
scancode 0xfe07 = KEY_4 (0x05)
scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
scancode 0xfe0a = KEY_EPG (0x16d)
scancode 0xfe0b = KEY_1 (0x02)
scancode 0xfe0d = KEY_STOP (0x80)
scancode 0xfe0e = KEY_MP3 (0x187)
scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
scancode 0xfe11 = KEY_CHANNELUP (0x192)
scancode 0xfe12 = KEY_NEXTSONG (0xa3)
scancode 0xfe13 = KEY_ANGLE (0x173)
scancode 0xfe15 = KEY_VOLUMEUP (0x73)
scancode 0xfe16 = KEY_SETUP (0x8d)
scancode 0xfe17 = KEY_2 (0x03)
scancode 0xfe19 = KEY_OPEN (0x86)
scancode 0xfe1a = KEY_DVD (0x185)
scancode 0xfe1b = KEY_3 (0x04)
scancode 0xfe1e = KEY_FAVORITES (0x16c)
scancode 0xfe1f = KEY_ZOOM (0x174)
scancode 0xfe42 = KEY_ENTER (0x1c)
scancode 0xfe43 = KEY_REWIND (0xa8)
scancode 0xfe46 = KEY_POWER2 (0x164)
scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
scancode 0xfe48 = KEY_7 (0x08)
scancode 0xfe49 = KEY_BACK (0x9e)
scancode 0xfe4c = KEY_8 (0x09)
scancode 0xfe4d = KEY_MENU (0x8b)
scancode 0xfe4e = KEY_POWER (0x74)
scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
scancode 0xfe50 = KEY_5 (0x06)
scancode 0xfe51 = KEY_UP (0x67)
scancode 0xfe52 = KEY_CAMERA (0xd4)
scancode 0xfe53 = KEY_DOWN (0x6c)
scancode 0xfe54 = KEY_6 (0x07)
scancode 0xfe55 = KEY_TAB (0x0f)
scancode 0xfe57 = KEY_MUTE (0x71)
scancode 0xfe58 = KEY_9 (0x0a)
scancode 0xfe59 = KEY_INFO (0x166)
scancode 0xfe5a = KEY_TUNER (0x182)
scancode 0xfe5b = KEY_LEFT (0x69)
scancode 0xfe5e = KEY_OK (0x160)
scancode 0xfe5f = KEY_RIGHT (0x6a)
Enabled protocols: 
#

I tried -t and it generated events constantly, before I could press
any keys.
# ir-keytable -s rc1 -t
Testing events. Please, press CTRL-C to abort.
1479903007.535509: event type EV_MSC(0x04): scancode = 0x00
1479903007.535509: event type EV_SYN(0x00).
1479903007.635521: event type EV_MSC(0x04): scancode = 0x00
1479903007.635521: event type EV_SYN(0x00).
1479903007.735535: event type EV_MSC(0x04): scancode = 0x00
1479903007.735535: event type EV_SYN(0x00).
1479903007.839552: event type EV_MSC(0x04): scancode = 0x00
1479903007.839552: event type EV_SYN(0x00).
1479903007.939565: event type EV_MSC(0x04): scancode = 0x00
1479903007.939565: event type EV_SYN(0x00).
1479903008.039579: event type EV_MSC(0x04): scancode = 0x00
1479903008.039579: event type EV_SYN(0x00).
1479903008.143594: event type EV_MSC(0x04): scancode = 0x00
1479903008.143594: event type EV_SYN(0x00).
1479903008.243608: event type EV_MSC(0x04): scancode = 0x00
1479903008.243608: event type EV_SYN(0x00).
1479903008.343622: event type EV_MSC(0x04): scancode = 0x00
1479903008.343622: event type EV_SYN(0x00).
1479903008.443512: event type EV_MSC(0x04): scancode = 0x00
1479903008.443512: event type EV_SYN(0x00).
1479903008.543525: event type EV_MSC(0x04): scancode = 0x00
1479903008.543525: event type EV_SYN(0x00).
1479903008.647541: event type EV_MSC(0x04): scancode = 0x00
1479903008.647541: event type EV_SYN(0x00).
^C

Same behaviour with -d /dev/input/event15.

I tried pressing the PLAYPAUSE key:
1479903175.199520: event type EV_MSC(0x04): scancode = 0x00
1479903175.199520: event type EV_SYN(0x00).
1479903175.299538: event type EV_MSC(0x04): scancode = 0xfe47
1479903175.299538: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
1479903175.299538: event type EV_SYN(0x00).
1479903175.399554: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
1479903175.399554: event type EV_MSC(0x04): scancode = 0x00
1479903175.399554: event type EV_SYN(0x00).
1479903175.499563: event type EV_MSC(0x04): scancode = 0x00
1479903175.499563: event type EV_SYN(0x00).
1479903175.599579: event type EV_MSC(0x04): scancode = 0x00
1479903175.599579: event type EV_SYN(0x00).
1479903175.699593: event type EV_MSC(0x04): scancode = 0x00
1479903175.699593: event type EV_SYN(0x00).
1479903175.799481: event type EV_MSC(0x04): scancode = 0x00
1479903175.799481: event type EV_SYN(0x00).
1479903175.899496: event type EV_MSC(0x04): scancode = 0x00
1479903175.899496: event type EV_SYN(0x00).
1479903175.999510: event type EV_MSC(0x04): scancode = 0x00
1479903175.999510: event type EV_SYN(0x00).
1479903176.099653: event type EV_MSC(0x04): scancode = 0xfe47
1479903176.099653: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
1479903176.099653: event type EV_SYN(0x00).
1479903176.199540: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
1479903176.199540: event type EV_MSC(0x04): scancode = 0x00
1479903176.199540: event type EV_SYN(0x00).

Same behaviour wth 'evtest'

I explored telling it what protocol to use etc.

# cat /sys/class/rc/rc1/protocols 
unknown
# echo 3 > /sys/module/rc_core/parameters/debug
# journalctl -f -k
(Pressing PLAYPAUSE, once)
Nov 23 23:21:52 kernel: rc_core: IR-receiver inside an USB DVB receiver: scancode 0xfe47 keycode 0xa4
Nov 23 23:21:52 kernel: rc_core: IR-receiver inside an USB DVB receiver: key down event, key 0x00a4, protocol 0x0000, scancode 0x0000fe47
Nov 23 23:21:52 kernel: rc_core: keyup key 0x00a4

(MENU)
Nov 23 23:24:34 kernel: rc_core: IR-receiver inside an USB DVB receiver: scancode 0xfe4d keycode 0x8b
Nov 23 23:24:34 kernel: rc_core: IR-receiver inside an USB DVB receiver: key down event, key 0x008b, protocol 0x0000, scancode 0x0000fe4d
Nov 23 23:24:34 kernel: rc_core: keyup key 0x008b

# echo rc-6 > /sys/class/rc/rc1/protocols 
Nov 23 23:26:01 kernel: rc_core: Normal protocol change requested
Nov 23 23:26:01 kernel: rc_core: Protocol switching not supported
# cat /sys/class/rc/rc1/protocols
unknown

Try to load a keytable:
# ir-keytable -v -s rc1 -w /lib/udev/rc_keymaps/dvico_mce 
Parsing /lib/udev/rc_keymaps/dvico_mce keycode file
parsing 0xfe02=KEY_TV:  value=377
parsing 0xfe0e=KEY_MP3: value=391
parsing 0xfe1a=KEY_DVD: value=389
parsing 0xfe1e=KEY_FAVORITES:   value=364
parsing 0xfe16=KEY_SETUP:   value=141
parsing 0xfe46=KEY_POWER2:  value=356
parsing 0xfe0a=KEY_EPG: value=365
parsing 0xfe49=KEY_BACK:    value=158
parsing 0xfe4d=KEY_MENU:    value=139
parsing 0xfe51=KEY_UP:  value=103
parsing 0xfe5b=KEY_LEFT:    value=105
parsing 0xfe5f=KEY_RIGHT:   value=106
parsing 0xfe53=KEY_DOWN:    value=108
parsing 0xfe5e=KEY_OK:  value=352
parsing 0xfe59=KEY_INFO:    value=358
parsing 0xfe55=KEY_TAB: value=15
parsing 0xfe0f=KEY_PREVIOUSSONG:    value=165
parsing 0xfe12=KEY_NEXTSONG:    value=163
parsing 0xfe42=KEY_ENTER:   value=28
parsing 0xfe15=KEY_VOLUMEUP:    value=115
parsing 0xfe05=KEY_VOLUMEDOWN:  value=114
parsing 0xfe11=KEY_CHANNELUP:   value=402
parsing 0xfe09=KEY_CHANNELDOWN: value=403
parsing 0xfe52=KEY_CAMERA:  value=212
parsing 0xfe5a=KEY_TUNER:   value=386
parsing 0xfe19=KEY_OPEN:    value=134
parsing 0xfe0b=KEY_1:   value=2
parsing 0xfe17=KEY_2:   value=3
parsing 0xfe1b=KEY_3:   value=4
parsing 0xfe07=KEY_4:   value=5
parsing 0xfe50=KEY_5:   value=6
parsing 0xfe54=KEY_6:   value=7
parsing 0xfe48=KEY_7:   value=8
parsing 0xfe4c=KEY_8:   value=9
parsing 0xfe58=KEY_9:   value=10
parsing 0xfe13=KEY_ANGLE:   value=371
parsing 0xfe03=KEY_0:   value=11
parsing 0xfe1f=KEY_ZOOM:    value=372
parsing 0xfe43=KEY_REWIND:  value=168
parsing 0xfe47=KEY_PLAYPAUSE:   value=164
parsing 0xfe4f=KEY_FASTFORWARD: value=208
parsing 0xfe57=KEY_MUTE:    value=113
parsing 0xfe0d=KEY_STOP:    value=128
parsing 0xfe01=KEY_RECORD:  value=167
parsing 0xfe4e=KEY_POWER:   value=116
Read dvico_mce table
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
    fe4e=0074
    fe01=00a7
    fe0d=0080
    fe57=0071
    fe4f=00d0
    fe47=00a4
    fe43=00a8
    fe1f=0174
    fe03=000b
    fe13=0173
    fe58=000a
    fe4c=0009
    fe48=0008
    fe54=0007
    fe50=0006
    fe07=0005
    fe1b=0004
    fe17=0003
    fe0b=0002
    fe19=0086
    fe5a=0182
    fe52=00d4
    fe09=0193
    fe11=0192
    fe05=0072
    fe15=0073
    fe42=001c
    fe12=00a3
    fe0f=00a5
    fe55=000f
    fe59=0166
    fe5e=0160
    fe53=006c
    fe5f=006a
    fe5b=0069
    fe51=0067
    fe4d=008b
    fe49=009e
    fe0a=016d
    fe46=0164
    fe16=008d
    fe1e=016c
    fe1a=0185
    fe0e=0187
    fe02=0179
Wrote 45 keycode(s) to driver
/sys/class/rc/rc1//protocols: Invalid argument
Couldn't change the IR protocols
#

Same result if I add -p RC-6 to the argument list.

Cheers
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-23 12:39               ` Vincent McIntyre
@ 2016-11-23 22:34                 ` Sean Young
  2016-11-24 12:12                   ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2016-11-23 22:34 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Wed, Nov 23, 2016 at 11:39:06PM +1100, Vincent McIntyre wrote:
> On Tue, Nov 22, 2016 at 09:20:44AM +0000, Sean Young wrote:
> > > Thanks for this. I have got it to build within the media_build setup
> > > but will need to find some windows in the schedule for testing. More
> > > in a couple of days. Are there specific things you would like me to
> > > test?
> > 
> > You should have an rc device for the IR receiver in the dvb device; does
> > it continue to work and can you clear/load a new keymap with ir-keytable,
> > and does it work after that.
> > 
> > A "Tested-by" would be great if it all works of course.
> 
> Time for some initial results. Good start, not quite there yet.
> 
> Nov 23 23:04:56 kernel: Registered IR keymap rc-dvico-mce
> Nov 23 23:04:56 kernel: input: IR-receiver inside an USB DVB receiver as /devices/pci0000:00
> Nov 23 23:04:56 kernel: rc rc1: IR-receiver inside an USB DVB receiver as /devices/pci0000:0
> Nov 23 23:04:56 kernel: dvb-usb: schedule remote query interval to 100 msecs.
> Nov 23 23:04:56 kernel: dvb-usb: DViCO FusionHDTV DVB-T Dual Digital 4 successfully initiali
> Nov 23 23:04:56 kernel: dvb-usb: found a 'DViCO FusionHDTV DVB-T Dual Digital 4' in warm sta
> Nov 23 23:04:56 kernel: dvb-usb: will pass the complete MPEG2 transport stream to the softwa
> Nov 23 23:04:56 kernel: dvbdev: DVB: registering new adapter (DViCO FusionHDTV DVB-T Dual Di
> Nov 23 23:04:56 kernel: usb 3-2: media controller created
> Nov 23 23:04:56 kernel: dvbdev: dvb_create_media_entity: media entity 'dvb-demux' registered
> Nov 23 23:04:56 kernel: cxusb: No IR receiver detected on this device.
> Nov 23 23:04:56 kernel: usb 3-2: DVB: registering adapter 1 frontend 0 (Zarlink ZL10353 DVB-
> Nov 23 23:04:56 kernel: dvbdev: dvb_create_media_entity: media entity 'Zarlink ZL10353 DVB-T
> Nov 23 23:04:56 kernel: xc2028 5-0061: creating new instance
> Nov 23 23:04:56 kernel: xc2028 5-0061: type set to XCeive xc2028/xc3028 tuner
> Nov 23 23:04:56 kernel: xc2028 5-0061: Loading 80 firmware images from xc3028-v27.fw, type: 
> Nov 23 23:04:56 kernel: dvb-usb: DViCO FusionHDTV DVB-T Dual Digital 4 successfully initiali
> Nov 23 23:04:56 kernel: usbcore: registered new interface driver dvb_usb_cxusb
> 
> # lsmod |grep rc
> rc_dvico_mce           16384  0
> rc_imon_mce            16384  0
> rc_core                32768  11 imon,dvb_usb,winbond_cir,dvb_usb_cxusb,rc_imon_mce,rc_dvico_mce,dvb_usb_v2,dvb_usb_af9035
> libcrc32c              16384  1 raid456
> crc_itu_t              16384  1 firewire_core
> 
> # lsmod |grep cxu
> dvb_usb_cxusb          77824  2
> dib0070                20480  1 dvb_usb_cxusb
> dvb_usb                32768  1 dvb_usb_cxusb
> rc_core                32768  11 imon,dvb_usb,winbond_cir,dvb_usb_cxusb,rc_imon_mce,rc_dvico_mce,dvb_usb_v2,dvb_usb_af9035
> 
> 
> # ir-keytable
> Found /sys/class/rc/rc0/ (/dev/input/event5) with:
>     Driver imon, table rc-imon-mce
>     Supported protocols: rc-6 
>     Enabled protocols: rc-6 
>     Name: iMON Remote (15c2:ffdc)
>     bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>     Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc1/ (/dev/input/event15) with:
>     Driver (null), table rc-dvico-mce
>     Supported protocols: unknown 
>     Enabled protocols: 
>     Name: IR-receiver inside an USB DVB re
>     bus: 3, vendor/product: 0fe9:db78, version: 0x827b
>     Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
>     Driver dvb_usb_af9035, table rc-empty
>     Supported protocols: nec 
>     Enabled protocols: 
>     Name: Leadtek WinFast DTV Dongle Dual
>     bus: 3, vendor/product: 0413:6a05, version: 0x0200
>     Repeat delay = 500 ms, repeat period = 125 ms
> 
> Not sure why Driver is (null), dvb_usb_cxusb is loaded.

That's a mistake, I've fixed that now.

> # ir-keytable -s rc1 -r -v
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
> scancode 0xfe01 = KEY_RECORD (0xa7)
> scancode 0xfe02 = KEY_TV (0x179)
> scancode 0xfe03 = KEY_0 (0x0b)
> scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
> scancode 0xfe07 = KEY_4 (0x05)
> scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
> scancode 0xfe0a = KEY_EPG (0x16d)
> scancode 0xfe0b = KEY_1 (0x02)
> scancode 0xfe0d = KEY_STOP (0x80)
> scancode 0xfe0e = KEY_MP3 (0x187)
> scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
> scancode 0xfe11 = KEY_CHANNELUP (0x192)
> scancode 0xfe12 = KEY_NEXTSONG (0xa3)
> scancode 0xfe13 = KEY_ANGLE (0x173)
> scancode 0xfe15 = KEY_VOLUMEUP (0x73)
> scancode 0xfe16 = KEY_SETUP (0x8d)
> scancode 0xfe17 = KEY_2 (0x03)
> scancode 0xfe19 = KEY_OPEN (0x86)
> scancode 0xfe1a = KEY_DVD (0x185)
> scancode 0xfe1b = KEY_3 (0x04)
> scancode 0xfe1e = KEY_FAVORITES (0x16c)
> scancode 0xfe1f = KEY_ZOOM (0x174)
> scancode 0xfe42 = KEY_ENTER (0x1c)
> scancode 0xfe43 = KEY_REWIND (0xa8)
> scancode 0xfe46 = KEY_POWER2 (0x164)
> scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
> scancode 0xfe48 = KEY_7 (0x08)
> scancode 0xfe49 = KEY_BACK (0x9e)
> scancode 0xfe4c = KEY_8 (0x09)
> scancode 0xfe4d = KEY_MENU (0x8b)
> scancode 0xfe4e = KEY_POWER (0x74)
> scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
> scancode 0xfe50 = KEY_5 (0x06)
> scancode 0xfe51 = KEY_UP (0x67)
> scancode 0xfe52 = KEY_CAMERA (0xd4)
> scancode 0xfe53 = KEY_DOWN (0x6c)
> scancode 0xfe54 = KEY_6 (0x07)
> scancode 0xfe55 = KEY_TAB (0x0f)
> scancode 0xfe57 = KEY_MUTE (0x71)
> scancode 0xfe58 = KEY_9 (0x0a)
> scancode 0xfe59 = KEY_INFO (0x166)
> scancode 0xfe5a = KEY_TUNER (0x182)
> scancode 0xfe5b = KEY_LEFT (0x69)
> scancode 0xfe5e = KEY_OK (0x160)
> scancode 0xfe5f = KEY_RIGHT (0x6a)
> Enabled protocols: 
> #
> 
> I tried -t and it generated events constantly, before I could press
> any keys.
> # ir-keytable -s rc1 -t
> Testing events. Please, press CTRL-C to abort.
> 1479903007.535509: event type EV_MSC(0x04): scancode = 0x00
> 1479903007.535509: event type EV_SYN(0x00).
> 1479903007.635521: event type EV_MSC(0x04): scancode = 0x00
> 1479903007.635521: event type EV_SYN(0x00).
> 1479903007.735535: event type EV_MSC(0x04): scancode = 0x00
> 1479903007.735535: event type EV_SYN(0x00).
> 1479903007.839552: event type EV_MSC(0x04): scancode = 0x00
> 1479903007.839552: event type EV_SYN(0x00).
> 1479903007.939565: event type EV_MSC(0x04): scancode = 0x00
> 1479903007.939565: event type EV_SYN(0x00).
> 1479903008.039579: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.039579: event type EV_SYN(0x00).
> 1479903008.143594: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.143594: event type EV_SYN(0x00).
> 1479903008.243608: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.243608: event type EV_SYN(0x00).
> 1479903008.343622: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.343622: event type EV_SYN(0x00).
> 1479903008.443512: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.443512: event type EV_SYN(0x00).
> 1479903008.543525: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.543525: event type EV_SYN(0x00).
> 1479903008.647541: event type EV_MSC(0x04): scancode = 0x00
> 1479903008.647541: event type EV_SYN(0x00).
> ^C

That's also been fixed.

> Same behaviour with -d /dev/input/event15.
> 
> I tried pressing the PLAYPAUSE key:
> 1479903175.199520: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.199520: event type EV_SYN(0x00).
> 1479903175.299538: event type EV_MSC(0x04): scancode = 0xfe47
> 1479903175.299538: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
> 1479903175.299538: event type EV_SYN(0x00).
> 1479903175.399554: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
> 1479903175.399554: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.399554: event type EV_SYN(0x00).
> 1479903175.499563: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.499563: event type EV_SYN(0x00).
> 1479903175.599579: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.599579: event type EV_SYN(0x00).
> 1479903175.699593: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.699593: event type EV_SYN(0x00).
> 1479903175.799481: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.799481: event type EV_SYN(0x00).
> 1479903175.899496: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.899496: event type EV_SYN(0x00).
> 1479903175.999510: event type EV_MSC(0x04): scancode = 0x00
> 1479903175.999510: event type EV_SYN(0x00).
> 1479903176.099653: event type EV_MSC(0x04): scancode = 0xfe47
> 1479903176.099653: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
> 1479903176.099653: event type EV_SYN(0x00).
> 1479903176.199540: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
> 1479903176.199540: event type EV_MSC(0x04): scancode = 0x00
> 1479903176.199540: event type EV_SYN(0x00).
> 
> Same behaviour wth 'evtest'
> 
> I explored telling it what protocol to use etc.
> 
> # cat /sys/class/rc/rc1/protocols 
> unknown
> # echo 3 > /sys/module/rc_core/parameters/debug
> # journalctl -f -k
> (Pressing PLAYPAUSE, once)
> Nov 23 23:21:52 kernel: rc_core: IR-receiver inside an USB DVB receiver: scancode 0xfe47 keycode 0xa4
> Nov 23 23:21:52 kernel: rc_core: IR-receiver inside an USB DVB receiver: key down event, key 0x00a4, protocol 0x0000, scancode 0x0000fe47
> Nov 23 23:21:52 kernel: rc_core: keyup key 0x00a4
> 
> (MENU)
> Nov 23 23:24:34 kernel: rc_core: IR-receiver inside an USB DVB receiver: scancode 0xfe4d keycode 0x8b
> Nov 23 23:24:34 kernel: rc_core: IR-receiver inside an USB DVB receiver: key down event, key 0x008b, protocol 0x0000, scancode 0x0000fe4d
> Nov 23 23:24:34 kernel: rc_core: keyup key 0x008b
> 
> # echo rc-6 > /sys/class/rc/rc1/protocols 
> Nov 23 23:26:01 kernel: rc_core: Normal protocol change requested
> Nov 23 23:26:01 kernel: rc_core: Protocol switching not supported
> # cat /sys/class/rc/rc1/protocols
> unknown

Well, it's unknown because we don't know what protocol the remote and
the receiver use.

> Try to load a keytable:
> # ir-keytable -v -s rc1 -w /lib/udev/rc_keymaps/dvico_mce 
> Parsing /lib/udev/rc_keymaps/dvico_mce keycode file
> parsing 0xfe02=KEY_TV:  value=377
> parsing 0xfe0e=KEY_MP3: value=391
> parsing 0xfe1a=KEY_DVD: value=389
> parsing 0xfe1e=KEY_FAVORITES:   value=364
> parsing 0xfe16=KEY_SETUP:   value=141
> parsing 0xfe46=KEY_POWER2:  value=356
> parsing 0xfe0a=KEY_EPG: value=365
> parsing 0xfe49=KEY_BACK:    value=158
> parsing 0xfe4d=KEY_MENU:    value=139
> parsing 0xfe51=KEY_UP:  value=103
> parsing 0xfe5b=KEY_LEFT:    value=105
> parsing 0xfe5f=KEY_RIGHT:   value=106
> parsing 0xfe53=KEY_DOWN:    value=108
> parsing 0xfe5e=KEY_OK:  value=352
> parsing 0xfe59=KEY_INFO:    value=358
> parsing 0xfe55=KEY_TAB: value=15
> parsing 0xfe0f=KEY_PREVIOUSSONG:    value=165
> parsing 0xfe12=KEY_NEXTSONG:    value=163
> parsing 0xfe42=KEY_ENTER:   value=28
> parsing 0xfe15=KEY_VOLUMEUP:    value=115
> parsing 0xfe05=KEY_VOLUMEDOWN:  value=114
> parsing 0xfe11=KEY_CHANNELUP:   value=402
> parsing 0xfe09=KEY_CHANNELDOWN: value=403
> parsing 0xfe52=KEY_CAMERA:  value=212
> parsing 0xfe5a=KEY_TUNER:   value=386
> parsing 0xfe19=KEY_OPEN:    value=134
> parsing 0xfe0b=KEY_1:   value=2
> parsing 0xfe17=KEY_2:   value=3
> parsing 0xfe1b=KEY_3:   value=4
> parsing 0xfe07=KEY_4:   value=5
> parsing 0xfe50=KEY_5:   value=6
> parsing 0xfe54=KEY_6:   value=7
> parsing 0xfe48=KEY_7:   value=8
> parsing 0xfe4c=KEY_8:   value=9
> parsing 0xfe58=KEY_9:   value=10
> parsing 0xfe13=KEY_ANGLE:   value=371
> parsing 0xfe03=KEY_0:   value=11
> parsing 0xfe1f=KEY_ZOOM:    value=372
> parsing 0xfe43=KEY_REWIND:  value=168
> parsing 0xfe47=KEY_PLAYPAUSE:   value=164
> parsing 0xfe4f=KEY_FASTFORWARD: value=208
> parsing 0xfe57=KEY_MUTE:    value=113
> parsing 0xfe0d=KEY_STOP:    value=128
> parsing 0xfe01=KEY_RECORD:  value=167
> parsing 0xfe4e=KEY_POWER:   value=116
> Read dvico_mce table
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
>     fe4e=0074
>     fe01=00a7
>     fe0d=0080
>     fe57=0071
>     fe4f=00d0
>     fe47=00a4
>     fe43=00a8
>     fe1f=0174
>     fe03=000b
>     fe13=0173
>     fe58=000a
>     fe4c=0009
>     fe48=0008
>     fe54=0007
>     fe50=0006
>     fe07=0005
>     fe1b=0004
>     fe17=0003
>     fe0b=0002
>     fe19=0086
>     fe5a=0182
>     fe52=00d4
>     fe09=0193
>     fe11=0192
>     fe05=0072
>     fe15=0073
>     fe42=001c
>     fe12=00a3
>     fe0f=00a5
>     fe55=000f
>     fe59=0166
>     fe5e=0160
>     fe53=006c
>     fe5f=006a
>     fe5b=0069
>     fe51=0067
>     fe4d=008b
>     fe49=009e
>     fe0a=016d
>     fe46=0164
>     fe16=008d
>     fe1e=016c
>     fe1a=0185
>     fe0e=0187
>     fe02=0179
> Wrote 45 keycode(s) to driver
> /sys/class/rc/rc1//protocols: Invalid argument
> Couldn't change the IR protocols
> #
> 
> Same result if I add -p RC-6 to the argument list.

Well, that won't work as the protocol can't be changed -- it's unknown.

The attached version should fix the driver name problem and the problem
of scancode 0 appearing without anything being pressed.

Thanks for testing!

Sean

From: Sean Young <sean@mess.org>
Subject: [PATCH] [media] cxusb: port to rc-core

The d680_dmb keymap has some new new mappings.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/keymaps/Makefile            |   3 +
 drivers/media/rc/keymaps/rc-d680-dmb.c       |  75 +++++++
 drivers/media/rc/keymaps/rc-dvico-mce.c      |  85 ++++++++
 drivers/media/rc/keymaps/rc-dvico-portable.c |  76 +++++++
 drivers/media/usb/dvb-usb/cxusb.c            | 312 +++++++--------------------
 include/media/rc-map.h                       |   3 +
 6 files changed, 322 insertions(+), 232 deletions(-)
 create mode 100644 drivers/media/rc/keymaps/rc-d680-dmb.c
 create mode 100644 drivers/media/rc/keymaps/rc-dvico-mce.c
 create mode 100644 drivers/media/rc/keymaps/rc-dvico-portable.c

diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index d7b13fa..11d5d5a 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-cec.o \
 			rc-cinergy-1400.o \
 			rc-cinergy.o \
+			rc-d680-dmb.o \
 			rc-delock-61959.o \
 			rc-dib0700-nec.o \
 			rc-dib0700-rc5.o \
@@ -31,6 +32,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
 			rc-dntv-live-dvbt-pro.o \
 			rc-dtt200u.o \
 			rc-dvbsky.o \
+			rc-dvico-mce.o \
+			rc-dvico-portable.o \
 			rc-em-terratec.o \
 			rc-encore-enltv2.o \
 			rc-encore-enltv.o \
diff --git a/drivers/media/rc/keymaps/rc-d680-dmb.c b/drivers/media/rc/keymaps/rc-d680-dmb.c
new file mode 100644
index 0000000..bb5745d
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-d680-dmb.c
@@ -0,0 +1,75 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_d680_dmb_table[] = {
+	{ 0x0038, KEY_SWITCHVIDEOMODE },	/* TV/AV */
+	{ 0x080c, KEY_ZOOM },
+	{ 0x0800, KEY_0 },
+	{ 0x0001, KEY_1 },
+	{ 0x0802, KEY_2 },
+	{ 0x0003, KEY_3 },
+	{ 0x0804, KEY_4 },
+	{ 0x0005, KEY_5 },
+	{ 0x0806, KEY_6 },
+	{ 0x0007, KEY_7 },
+	{ 0x0808, KEY_8 },
+	{ 0x0009, KEY_9 },
+	{ 0x000a, KEY_MUTE },
+	{ 0x0829, KEY_BACK },
+	{ 0x0012, KEY_CHANNELUP },
+	{ 0x0813, KEY_CHANNELDOWN },
+	{ 0x002b, KEY_VOLUMEUP },
+	{ 0x082c, KEY_VOLUMEDOWN },
+	{ 0x0020, KEY_UP },
+	{ 0x0821, KEY_DOWN },
+	{ 0x0011, KEY_LEFT },
+	{ 0x0810, KEY_RIGHT },
+	{ 0x000d, KEY_OK },
+	{ 0x081f, KEY_RECORD },
+	{ 0x0017, KEY_PLAYPAUSE },
+	{ 0x0816, KEY_PLAYPAUSE },
+	{ 0x000b, KEY_STOP },
+	{ 0x0827, KEY_FASTFORWARD },
+	{ 0x0026, KEY_REWIND },
+	{ 0x081e, KEY_UNKNOWN },    /* Time Shift */
+	{ 0x000e, KEY_UNKNOWN },    /* Snapshot */
+	{ 0x082d, KEY_UNKNOWN },    /* Mouse Cursor */
+	{ 0x000f, KEY_UNKNOWN },    /* Minimize/Maximize */
+	{ 0x0814, KEY_SHUFFLE },    /* Shuffle */
+	{ 0x0025, KEY_POWER },
+};
+
+static struct rc_map_list d680_dmb_map = {
+	.map = {
+		.scan    = rc_map_d680_dmb_table,
+		.size    = ARRAY_SIZE(rc_map_d680_dmb_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_D680_DMB,
+	}
+};
+
+static int __init init_rc_map_d680_dmb(void)
+{
+	return rc_map_register(&d680_dmb_map);
+}
+
+static void __exit exit_rc_map_d680_dmb(void)
+{
+	rc_map_unregister(&d680_dmb_map);
+}
+
+module_init(init_rc_map_d680_dmb)
+module_exit(exit_rc_map_d680_dmb)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dvico-mce.c b/drivers/media/rc/keymaps/rc-dvico-mce.c
new file mode 100644
index 0000000..e5f098c
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-dvico-mce.c
@@ -0,0 +1,85 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_dvico_mce_table[] = {
+	{ 0xfe02, KEY_TV },
+	{ 0xfe0e, KEY_MP3 },
+	{ 0xfe1a, KEY_DVD },
+	{ 0xfe1e, KEY_FAVORITES },
+	{ 0xfe16, KEY_SETUP },
+	{ 0xfe46, KEY_POWER2 },
+	{ 0xfe0a, KEY_EPG },
+	{ 0xfe49, KEY_BACK },
+	{ 0xfe4d, KEY_MENU },
+	{ 0xfe51, KEY_UP },
+	{ 0xfe5b, KEY_LEFT },
+	{ 0xfe5f, KEY_RIGHT },
+	{ 0xfe53, KEY_DOWN },
+	{ 0xfe5e, KEY_OK },
+	{ 0xfe59, KEY_INFO },
+	{ 0xfe55, KEY_TAB },
+	{ 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
+	{ 0xfe12, KEY_NEXTSONG },	/* Skip */
+	{ 0xfe42, KEY_ENTER	 },	/* Windows/Start */
+	{ 0xfe15, KEY_VOLUMEUP },
+	{ 0xfe05, KEY_VOLUMEDOWN },
+	{ 0xfe11, KEY_CHANNELUP },
+	{ 0xfe09, KEY_CHANNELDOWN },
+	{ 0xfe52, KEY_CAMERA },
+	{ 0xfe5a, KEY_TUNER },	/* Live */
+	{ 0xfe19, KEY_OPEN },
+	{ 0xfe0b, KEY_1 },
+	{ 0xfe17, KEY_2 },
+	{ 0xfe1b, KEY_3 },
+	{ 0xfe07, KEY_4 },
+	{ 0xfe50, KEY_5 },
+	{ 0xfe54, KEY_6 },
+	{ 0xfe48, KEY_7 },
+	{ 0xfe4c, KEY_8 },
+	{ 0xfe58, KEY_9 },
+	{ 0xfe13, KEY_ANGLE },	/* Aspect */
+	{ 0xfe03, KEY_0 },
+	{ 0xfe1f, KEY_ZOOM },
+	{ 0xfe43, KEY_REWIND },
+	{ 0xfe47, KEY_PLAYPAUSE },
+	{ 0xfe4f, KEY_FASTFORWARD },
+	{ 0xfe57, KEY_MUTE },
+	{ 0xfe0d, KEY_STOP },
+	{ 0xfe01, KEY_RECORD },
+	{ 0xfe4e, KEY_POWER },
+};
+
+static struct rc_map_list dvico_mce_map = {
+	.map = {
+		.scan    = rc_map_dvico_mce_table,
+		.size    = ARRAY_SIZE(rc_map_dvico_mce_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_DVICO_MCE,
+	}
+};
+
+static int __init init_rc_map_dvico_mce(void)
+{
+	return rc_map_register(&dvico_mce_map);
+}
+
+static void __exit exit_rc_map_dvico_mce(void)
+{
+	rc_map_unregister(&dvico_mce_map);
+}
+
+module_init(init_rc_map_dvico_mce)
+module_exit(exit_rc_map_dvico_mce)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/rc/keymaps/rc-dvico-portable.c b/drivers/media/rc/keymaps/rc-dvico-portable.c
new file mode 100644
index 0000000..94ceeee
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-dvico-portable.c
@@ -0,0 +1,76 @@
+/*
+ * keymap imported from cxusb.c
+ *
+ * Copyright (C) 2016 Sean Young
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2.
+ */
+
+#include <media/rc-map.h>
+#include <linux/module.h>
+
+static struct rc_map_table rc_map_dvico_portable_table[] = {
+	{ 0xfc02, KEY_SETUP },       /* Profile */
+	{ 0xfc43, KEY_POWER2 },
+	{ 0xfc06, KEY_EPG },
+	{ 0xfc5a, KEY_BACK },
+	{ 0xfc05, KEY_MENU },
+	{ 0xfc47, KEY_INFO },
+	{ 0xfc01, KEY_TAB },
+	{ 0xfc42, KEY_PREVIOUSSONG },/* Replay */
+	{ 0xfc49, KEY_VOLUMEUP },
+	{ 0xfc09, KEY_VOLUMEDOWN },
+	{ 0xfc54, KEY_CHANNELUP },
+	{ 0xfc0b, KEY_CHANNELDOWN },
+	{ 0xfc16, KEY_CAMERA },
+	{ 0xfc40, KEY_TUNER },	/* ATV/DTV */
+	{ 0xfc45, KEY_OPEN },
+	{ 0xfc19, KEY_1 },
+	{ 0xfc18, KEY_2 },
+	{ 0xfc1b, KEY_3 },
+	{ 0xfc1a, KEY_4 },
+	{ 0xfc58, KEY_5 },
+	{ 0xfc59, KEY_6 },
+	{ 0xfc15, KEY_7 },
+	{ 0xfc14, KEY_8 },
+	{ 0xfc17, KEY_9 },
+	{ 0xfc44, KEY_ANGLE },	/* Aspect */
+	{ 0xfc55, KEY_0 },
+	{ 0xfc07, KEY_ZOOM },
+	{ 0xfc0a, KEY_REWIND },
+	{ 0xfc08, KEY_PLAYPAUSE },
+	{ 0xfc4b, KEY_FASTFORWARD },
+	{ 0xfc5b, KEY_MUTE },
+	{ 0xfc04, KEY_STOP },
+	{ 0xfc56, KEY_RECORD },
+	{ 0xfc57, KEY_POWER },
+	{ 0xfc41, KEY_UNKNOWN },    /* INPUT */
+	{ 0xfc00, KEY_UNKNOWN },    /* HD */
+};
+
+static struct rc_map_list dvico_portable_map = {
+	.map = {
+		.scan    = rc_map_dvico_portable_table,
+		.size    = ARRAY_SIZE(rc_map_dvico_portable_table),
+		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.name    = RC_MAP_DVICO_PORTABLE,
+	}
+};
+
+static int __init init_rc_map_dvico_portable(void)
+{
+	return rc_map_register(&dvico_portable_map);
+}
+
+static void __exit exit_rc_map_dvico_portable(void)
+{
+	rc_map_unregister(&dvico_portable_map);
+}
+
+module_init(init_rc_map_dvico_portable)
+module_exit(exit_rc_map_dvico_portable)
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mauro Carvalho Chehab");
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index 9b8771e..34e5fb8 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -450,209 +450,46 @@ static int cxusb_d680_dmb_streaming_ctrl(
 	}
 }
 
-static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int cxusb_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[4];
-	int i;
 
 	cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
 
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
-
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[2] &&
-		    rc5_data(&keymap[i]) == ircode[3]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	if (ircode[2] || ircode[3])
+		rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[2], ircode[3]), 0);
 	return 0;
 }
 
-static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event,
-				    int *state)
+static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[4];
-	int i;
 	struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD,
 			       .buf = ircode, .len = 4 };
 
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
-
 	if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1)
 		return 0;
 
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[1] &&
-		    rc5_data(&keymap[i]) == ircode[2]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	if (ircode[1] || ircode[2])
+		rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[1], ircode[2]), 0);
 	return 0;
 }
 
-static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event,
-		int *state)
+static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d)
 {
-	struct rc_map_table *keymap = d->props.rc.legacy.rc_map_table;
 	u8 ircode[2];
-	int i;
-
-	*event = 0;
-	*state = REMOTE_NO_KEY_PRESSED;
 
 	if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0)
 		return 0;
 
-	for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) {
-		if (rc5_custom(&keymap[i]) == ircode[0] &&
-		    rc5_data(&keymap[i]) == ircode[1]) {
-			*event = keymap[i].keycode;
-			*state = REMOTE_KEY_PRESSED;
-
-			return 0;
-		}
-	}
-
+	if (ircode[0] || ircode[1])
+		rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
+				RC_SCANCODE_RC5(ircode[0], ircode[1]), 0);
 	return 0;
 }
 
-static struct rc_map_table rc_map_dvico_mce_table[] = {
-	{ 0xfe02, KEY_TV },
-	{ 0xfe0e, KEY_MP3 },
-	{ 0xfe1a, KEY_DVD },
-	{ 0xfe1e, KEY_FAVORITES },
-	{ 0xfe16, KEY_SETUP },
-	{ 0xfe46, KEY_POWER2 },
-	{ 0xfe0a, KEY_EPG },
-	{ 0xfe49, KEY_BACK },
-	{ 0xfe4d, KEY_MENU },
-	{ 0xfe51, KEY_UP },
-	{ 0xfe5b, KEY_LEFT },
-	{ 0xfe5f, KEY_RIGHT },
-	{ 0xfe53, KEY_DOWN },
-	{ 0xfe5e, KEY_OK },
-	{ 0xfe59, KEY_INFO },
-	{ 0xfe55, KEY_TAB },
-	{ 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfe12, KEY_NEXTSONG },	/* Skip */
-	{ 0xfe42, KEY_ENTER	 },	/* Windows/Start */
-	{ 0xfe15, KEY_VOLUMEUP },
-	{ 0xfe05, KEY_VOLUMEDOWN },
-	{ 0xfe11, KEY_CHANNELUP },
-	{ 0xfe09, KEY_CHANNELDOWN },
-	{ 0xfe52, KEY_CAMERA },
-	{ 0xfe5a, KEY_TUNER },	/* Live */
-	{ 0xfe19, KEY_OPEN },
-	{ 0xfe0b, KEY_1 },
-	{ 0xfe17, KEY_2 },
-	{ 0xfe1b, KEY_3 },
-	{ 0xfe07, KEY_4 },
-	{ 0xfe50, KEY_5 },
-	{ 0xfe54, KEY_6 },
-	{ 0xfe48, KEY_7 },
-	{ 0xfe4c, KEY_8 },
-	{ 0xfe58, KEY_9 },
-	{ 0xfe13, KEY_ANGLE },	/* Aspect */
-	{ 0xfe03, KEY_0 },
-	{ 0xfe1f, KEY_ZOOM },
-	{ 0xfe43, KEY_REWIND },
-	{ 0xfe47, KEY_PLAYPAUSE },
-	{ 0xfe4f, KEY_FASTFORWARD },
-	{ 0xfe57, KEY_MUTE },
-	{ 0xfe0d, KEY_STOP },
-	{ 0xfe01, KEY_RECORD },
-	{ 0xfe4e, KEY_POWER },
-};
-
-static struct rc_map_table rc_map_dvico_portable_table[] = {
-	{ 0xfc02, KEY_SETUP },       /* Profile */
-	{ 0xfc43, KEY_POWER2 },
-	{ 0xfc06, KEY_EPG },
-	{ 0xfc5a, KEY_BACK },
-	{ 0xfc05, KEY_MENU },
-	{ 0xfc47, KEY_INFO },
-	{ 0xfc01, KEY_TAB },
-	{ 0xfc42, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfc49, KEY_VOLUMEUP },
-	{ 0xfc09, KEY_VOLUMEDOWN },
-	{ 0xfc54, KEY_CHANNELUP },
-	{ 0xfc0b, KEY_CHANNELDOWN },
-	{ 0xfc16, KEY_CAMERA },
-	{ 0xfc40, KEY_TUNER },	/* ATV/DTV */
-	{ 0xfc45, KEY_OPEN },
-	{ 0xfc19, KEY_1 },
-	{ 0xfc18, KEY_2 },
-	{ 0xfc1b, KEY_3 },
-	{ 0xfc1a, KEY_4 },
-	{ 0xfc58, KEY_5 },
-	{ 0xfc59, KEY_6 },
-	{ 0xfc15, KEY_7 },
-	{ 0xfc14, KEY_8 },
-	{ 0xfc17, KEY_9 },
-	{ 0xfc44, KEY_ANGLE },	/* Aspect */
-	{ 0xfc55, KEY_0 },
-	{ 0xfc07, KEY_ZOOM },
-	{ 0xfc0a, KEY_REWIND },
-	{ 0xfc08, KEY_PLAYPAUSE },
-	{ 0xfc4b, KEY_FASTFORWARD },
-	{ 0xfc5b, KEY_MUTE },
-	{ 0xfc04, KEY_STOP },
-	{ 0xfc56, KEY_RECORD },
-	{ 0xfc57, KEY_POWER },
-	{ 0xfc41, KEY_UNKNOWN },    /* INPUT */
-	{ 0xfc00, KEY_UNKNOWN },    /* HD */
-};
-
-static struct rc_map_table rc_map_d680_dmb_table[] = {
-	{ 0x0038, KEY_UNKNOWN },	/* TV/AV */
-	{ 0x080c, KEY_ZOOM },
-	{ 0x0800, KEY_0 },
-	{ 0x0001, KEY_1 },
-	{ 0x0802, KEY_2 },
-	{ 0x0003, KEY_3 },
-	{ 0x0804, KEY_4 },
-	{ 0x0005, KEY_5 },
-	{ 0x0806, KEY_6 },
-	{ 0x0007, KEY_7 },
-	{ 0x0808, KEY_8 },
-	{ 0x0009, KEY_9 },
-	{ 0x000a, KEY_MUTE },
-	{ 0x0829, KEY_BACK },
-	{ 0x0012, KEY_CHANNELUP },
-	{ 0x0813, KEY_CHANNELDOWN },
-	{ 0x002b, KEY_VOLUMEUP },
-	{ 0x082c, KEY_VOLUMEDOWN },
-	{ 0x0020, KEY_UP },
-	{ 0x0821, KEY_DOWN },
-	{ 0x0011, KEY_LEFT },
-	{ 0x0810, KEY_RIGHT },
-	{ 0x000d, KEY_OK },
-	{ 0x081f, KEY_RECORD },
-	{ 0x0017, KEY_PLAYPAUSE },
-	{ 0x0816, KEY_PLAYPAUSE },
-	{ 0x000b, KEY_STOP },
-	{ 0x0827, KEY_FASTFORWARD },
-	{ 0x0026, KEY_REWIND },
-	{ 0x081e, KEY_UNKNOWN },    /* Time Shift */
-	{ 0x000e, KEY_UNKNOWN },    /* Snapshot */
-	{ 0x082d, KEY_UNKNOWN },    /* Mouse Cursor */
-	{ 0x000f, KEY_UNKNOWN },    /* Minimize/Maximize */
-	{ 0x0814, KEY_UNKNOWN },    /* Shuffle */
-	{ 0x0025, KEY_POWER },
-};
-
 static int cxusb_dee1601_demod_init(struct dvb_frontend* fe)
 {
 	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x28 };
@@ -1000,7 +837,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
 		return -EIO;
 
 	/* try to determine if there is no IR decoder on the I2C bus */
-	for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) {
+	for (i = 0; adap->dev->props.rc.core.rc_codes != NULL && i < 5; i++) {
 		msleep(20);
 		if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1)
 			goto no_IR;
@@ -1008,7 +845,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap)
 			continue;
 		if (ircode[2] + ircode[3] != 0xff) {
 no_IR:
-			adap->dev->props.rc.legacy.rc_map_table = NULL;
+			adap->dev->props.rc.core.rc_codes = NULL;
 			info("No IR receiver detected on this device.");
 			break;
 		}
@@ -1720,11 +1557,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1776,11 +1614,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 150,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1840,11 +1679,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1895,11 +1735,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
 
 	.i2c_algo         = &cxusb_i2c_algo,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1949,11 +1790,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_bluebird2_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_bluebird2_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2002,11 +1844,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_bluebird2_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query       = cxusb_bluebird2_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2057,11 +1900,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_portable_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_PORTABLE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2155,11 +1999,12 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_dvico_mce_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_query         = cxusb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_DVICO_MCE,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query	= cxusb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2208,11 +2053,12 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2262,11 +2108,12 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
@@ -2315,11 +2162,12 @@ static struct dvb_usb_device_properties cxusb_mygica_t230_properties = {
 
 	.generic_bulk_ctrl_endpoint = 0x01,
 
-	.rc.legacy = {
-		.rc_interval      = 100,
-		.rc_map_table     = rc_map_d680_dmb_table,
-		.rc_map_size      = ARRAY_SIZE(rc_map_d680_dmb_table),
-		.rc_query         = cxusb_d680_dmb_rc_query,
+	.rc.core = {
+		.rc_interval	= 100,
+		.rc_codes	= RC_MAP_D680_DMB,
+		.module_name	= KBUILD_MODNAME,
+		.rc_query       = cxusb_d680_dmb_rc_query,
+		.allowed_protos = RC_BIT_UNKNOWN,
 	},
 
 	.num_device_descs = 1,
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e1cc14c..82feb2d 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -198,6 +198,7 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_CEC                       "rc-cec"
 #define RC_MAP_CINERGY_1400              "rc-cinergy-1400"
 #define RC_MAP_CINERGY                   "rc-cinergy"
+#define RC_MAP_D680_DMB                  "rc-d680-dmb"
 #define RC_MAP_DELOCK_61959              "rc-delock-61959"
 #define RC_MAP_DIB0700_NEC_TABLE         "rc-dib0700-nec"
 #define RC_MAP_DIB0700_RC5_TABLE         "rc-dib0700-rc5"
@@ -208,6 +209,8 @@ struct rc_map *rc_map_get(const char *name);
 #define RC_MAP_DNTV_LIVE_DVB_T           "rc-dntv-live-dvb-t"
 #define RC_MAP_DTT200U                   "rc-dtt200u"
 #define RC_MAP_DVBSKY                    "rc-dvbsky"
+#define RC_MAP_DVICO_MCE		 "rc-dvico-mce"
+#define RC_MAP_DVICO_PORTABLE		 "rc-dvico-portable"
 #define RC_MAP_EMPTY                     "rc-empty"
 #define RC_MAP_EM_TERRATEC               "rc-em-terratec"
 #define RC_MAP_ENCORE_ENLTV2             "rc-encore-enltv2"
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-23 22:34                 ` Sean Young
@ 2016-11-24 12:12                   ` Vincent McIntyre
  2016-11-24 13:34                     ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-24 12:12 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Wed, Nov 23, 2016 at 10:34:19PM +0000, Sean Young wrote:
> > Not sure why Driver is (null), dvb_usb_cxusb is loaded.
> 
> That's a mistake, I've fixed that now.

Ah. I see the added module_name struct members.

> > I tried -t and it generated events constantly, before I could press
> > any keys.
> > # ir-keytable -s rc1 -t
> > Testing events. Please, press CTRL-C to abort.
> > 1479903007.535509: event type EV_MSC(0x04): scancode = 0x00
> > 1479903007.535509: event type EV_SYN(0x00).
> > 1479903007.635521: event type EV_MSC(0x04): scancode = 0x00
> 
> That's also been fixed.
> 

yep, works nicely.

Things are looking much better!
As shown below I am able to clear a keytable and put in a fresh one.
Having a bit of trouble with key remapping.
I guess we still have to work out the protocol in use.

Test details:
# ir-keytable -v
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc0/input8/
Event sysfs node is /sys/class/rc/rc0/input8/event5/
Parsing uevent /sys/class/rc/rc0/input8/event5/uevent
/sys/class/rc/rc0/input8/event5/uevent uevent MAJOR=13
/sys/class/rc/rc0/input8/event5/uevent uevent MINOR=69
/sys/class/rc/rc0/input8/event5/uevent uevent DEVNAME=input/event5
Parsing uevent /sys/class/rc/rc0/uevent
/sys/class/rc/rc0/uevent uevent NAME=rc-imon-mce
/sys/class/rc/rc0/uevent uevent DRV_NAME=imon
input device is /dev/input/event5
/sys/class/rc/rc0/protocols protocol rc-6 (enabled)
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
	Driver imon, table rc-imon-mce
	Supported protocols: rc-6 
	Enabled protocols: rc-6 
	Name: iMON Remote (15c2:ffdc)
	bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
	Driver dvb_usb_cxusb, table rc-dvico-mce
	Supported protocols: unknown 
	Enabled protocols: 
	Name: IR-receiver inside an USB DVB re
	bus: 3, vendor/product: 0fe9:db78, version: 0x827b
Input sysfs node is /sys/class/rc/rc2/input19/
Event sysfs node is /sys/class/rc/rc2/input19/event16/
Parsing uevent /sys/class/rc/rc2/input19/event16/uevent
/sys/class/rc/rc2/input19/event16/uevent uevent MAJOR=13
/sys/class/rc/rc2/input19/event16/uevent uevent MINOR=80
/sys/class/rc/rc2/input19/event16/uevent uevent DEVNAME=input/event16
Parsing uevent /sys/class/rc/rc2/uevent
/sys/class/rc/rc2/uevent uevent NAME=rc-empty
/sys/class/rc/rc2/uevent uevent DRV_NAME=dvb_usb_af9035
input device is /dev/input/event16
/sys/class/rc/rc2/protocols protocol nec (disabled)
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
	Driver dvb_usb_af9035, table rc-empty
	Supported protocols: nec 
	Enabled protocols: 
	Name: Leadtek WinFast DTV Dongle Dual
	bus: 3, vendor/product: 0413:6a05, version: 0x0200
	Repeat delay = 500 ms, repeat period = 125 ms
	Repeat delay = 500 ms, repeat period = 125 ms
	Repeat delay = 500 ms, repeat period = 125 ms

# ir-keytable -r -v -s rc1
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
Enabled protocols: 
scancode 0xfe01 = KEY_RECORD (0xa7)
scancode 0xfe02 = KEY_TV (0x179)
scancode 0xfe03 = KEY_0 (0x0b)
scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
scancode 0xfe07 = KEY_4 (0x05)
scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
scancode 0xfe0a = KEY_EPG (0x16d)
scancode 0xfe0b = KEY_1 (0x02)
scancode 0xfe0d = KEY_STOP (0x80)
scancode 0xfe0e = KEY_MP3 (0x187)
scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
scancode 0xfe11 = KEY_CHANNELUP (0x192)
scancode 0xfe12 = KEY_NEXTSONG (0xa3)
scancode 0xfe13 = KEY_ANGLE (0x173)
scancode 0xfe15 = KEY_VOLUMEUP (0x73)
scancode 0xfe16 = KEY_SETUP (0x8d)
scancode 0xfe17 = KEY_2 (0x03)
scancode 0xfe19 = KEY_OPEN (0x86)
scancode 0xfe1a = KEY_DVD (0x185)
scancode 0xfe1b = KEY_3 (0x04)
scancode 0xfe1e = KEY_FAVORITES (0x16c)
scancode 0xfe1f = KEY_ZOOM (0x174)
scancode 0xfe42 = KEY_ENTER (0x1c)
scancode 0xfe43 = KEY_REWIND (0xa8)
scancode 0xfe46 = KEY_POWER2 (0x164)
scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
scancode 0xfe48 = KEY_7 (0x08)
scancode 0xfe49 = KEY_BACK (0x9e)
scancode 0xfe4c = KEY_8 (0x09)
scancode 0xfe4d = KEY_MENU (0x8b)
scancode 0xfe4e = KEY_POWER (0x74)
scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
scancode 0xfe50 = KEY_5 (0x06)
scancode 0xfe51 = KEY_UP (0x67)
scancode 0xfe52 = KEY_CAMERA (0xd4)
scancode 0xfe53 = KEY_DOWN (0x6c)
scancode 0xfe54 = KEY_6 (0x07)
scancode 0xfe55 = KEY_TAB (0x0f)
scancode 0xfe57 = KEY_MUTE (0x71)
scancode 0xfe58 = KEY_9 (0x0a)
scancode 0xfe59 = KEY_INFO (0x166)
scancode 0xfe5a = KEY_TUNER (0x182)
scancode 0xfe5b = KEY_LEFT (0x69)
scancode 0xfe5e = KEY_OK (0x160)
scancode 0xfe5f = KEY_RIGHT (0x6a)

# ir-keytable -s rc1 -t
Testing events. Please, press CTRL-C to abort.
1479985656.760267: event type EV_MSC(0x04): scancode = 0xfe47
1479985656.760267: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
1479985656.760267: event type EV_SYN(0x00).
1479985657.011045: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
1479985657.011045: event type EV_SYN(0x00).
1479985671.812267: event type EV_MSC(0x04): scancode = 0xfe53
1479985671.812267: event type EV_KEY(0x01) key_down: KEY_DOWN(0x006c)
1479985671.812267: event type EV_SYN(0x00).
1479985672.063048: event type EV_KEY(0x01) key_up: KEY_DOWN(0x006c)
1479985672.063048: event type EV_SYN(0x00).
1479985674.520279: event type EV_MSC(0x04): scancode = 0xfe52
1479985674.520279: event type EV_KEY(0x01) key_down: KEY_CAMERA(0x00d4)
1479985674.520279: event type EV_SYN(0x00).
1479985674.771044: event type EV_KEY(0x01) key_up: KEY_CAMERA(0x00d4)
1479985674.771044: event type EV_SYN(0x00).
1479985675.628312: event type EV_MSC(0x04): scancode = 0xfe4d
1479985675.628312: event type EV_KEY(0x01) key_down: KEY_MENU(0x008b)
1479985675.628312: event type EV_SYN(0x00).
1479985675.879045: event type EV_KEY(0x01) key_up: KEY_MENU(0x008b)
1479985675.879045: event type EV_SYN(0x00).
1479985677.732236: event type EV_MSC(0x04): scancode = 0xfe49
1479985677.732236: event type EV_KEY(0x01) key_down: KEY_BACK(0x009e)
1479985677.732236: event type EV_SYN(0x00).
1479985677.983043: event type EV_KEY(0x01) key_up: KEY_BACK(0x009e)
1479985677.983043: event type EV_SYN(0x00).
1479985687.464239: event type EV_MSC(0x04): scancode = 0xfe5e
1479985687.464239: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
1479985687.464239: event type EV_SYN(0x00).
1479985687.715043: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
1479985687.715043: event type EV_SYN(0x00).
1479985696.396382: event type EV_MSC(0x04): scancode = 0xfe42
1479985696.396382: event type EV_KEY(0x01) key_down: KEY_ENTER(0x001c)
1479985696.396382: event type EV_SYN(0x00).
1479985696.647049: event type EV_KEY(0x01) key_up: KEY_ENTER(0x001c)
1479985696.647049: event type EV_SYN(0x00).
1479985701.220194: event type EV_MSC(0x04): scancode = 0xfe0d
1479985701.220194: event type EV_KEY(0x01) key_down: KEY_STOP(0x0080)
1479985701.220194: event type EV_SYN(0x00).
1479985701.471047: event type EV_KEY(0x01) key_up: KEY_STOP(0x0080)
1479985701.471047: event type EV_SYN(0x00).
^C

# diff  dvice_mce dvico_mce_new
--- dvico_mce   2016-11-24 22:18:48.000000000 +1100
+++ dvico_mce_new   2016-11-24 22:11:02.000000000 +1100
@@ -12,7 +12,7 @@
 0xfe5b KEY_LEFT
 0xfe5f KEY_RIGHT
 0xfe53 KEY_DOWN
-0xfe5e KEY_OK
+0xfe5e KEY_ENTER
 0xfe59 KEY_INFO
 0xfe55 KEY_TAB
 0xfe0f KEY_PREVIOUSSONG

# ir-keyable -v -s rc1 -c
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
Deleting entry 1
Deleting entry 2
Deleting entry 3
Deleting entry 4
Deleting entry 5
Deleting entry 6
Deleting entry 7
Deleting entry 8
Deleting entry 9
Deleting entry 10
Deleting entry 11
Deleting entry 12
Deleting entry 13
Deleting entry 14
Deleting entry 15
Deleting entry 16
Deleting entry 17
Deleting entry 18
Deleting entry 19
Deleting entry 20
Deleting entry 21
Deleting entry 22
Deleting entry 23
Deleting entry 24
Deleting entry 25
Deleting entry 26
Deleting entry 27
Deleting entry 28
Deleting entry 29
Deleting entry 30
Deleting entry 31
Deleting entry 32
Deleting entry 33
Deleting entry 34
Deleting entry 35
Deleting entry 36
Deleting entry 37
Deleting entry 38
Deleting entry 39
Deleting entry 40
Deleting entry 41
Deleting entry 42
Deleting entry 43
Deleting entry 44
Deleting entry 45
Deleting entry 46
Old keytable cleared

# ir-keyable -v -s rc1 -w dvico-mce-new
Parsing ./dvico_mce_new keycode file
parsing 0xfe02=KEY_TV:	value=377
parsing 0xfe0e=KEY_MP3:	value=391
parsing 0xfe1a=KEY_DVD:	value=389
parsing 0xfe1e=KEY_FAVORITES:	value=364
parsing 0xfe16=KEY_SETUP:	value=141
parsing 0xfe46=KEY_POWER2:	value=356
parsing 0xfe0a=KEY_EPG:	value=365
parsing 0xfe49=KEY_BACK:	value=158
parsing 0xfe4d=KEY_MENU:	value=139
parsing 0xfe51=KEY_UP:	value=103
parsing 0xfe5b=KEY_LEFT:	value=105
parsing 0xfe5f=KEY_RIGHT:	value=106
parsing 0xfe53=KEY_DOWN:	value=108
parsing 0xfe5e=KEY_ENTER:	value=28
parsing 0xfe59=KEY_INFO:	value=358
parsing 0xfe55=KEY_TAB:	value=15
parsing 0xfe0f=KEY_PREVIOUSSONG:	value=165
parsing 0xfe12=KEY_NEXTSONG:	value=163
parsing 0xfe42=KEY_ENTER:	value=28
parsing 0xfe15=KEY_VOLUMEUP:	value=115
parsing 0xfe05=KEY_VOLUMEDOWN:	value=114
parsing 0xfe11=KEY_CHANNELUP:	value=402
parsing 0xfe09=KEY_CHANNELDOWN:	value=403
parsing 0xfe52=KEY_CAMERA:	value=212
parsing 0xfe5a=KEY_TUNER:	value=386
parsing 0xfe19=KEY_OPEN:	value=134
parsing 0xfe0b=KEY_1:	value=2
parsing 0xfe17=KEY_2:	value=3
parsing 0xfe1b=KEY_3:	value=4
parsing 0xfe07=KEY_4:	value=5
parsing 0xfe50=KEY_5:	value=6
parsing 0xfe54=KEY_6:	value=7
parsing 0xfe48=KEY_7:	value=8
parsing 0xfe4c=KEY_8:	value=9
parsing 0xfe58=KEY_9:	value=10
parsing 0xfe13=KEY_ANGLE:	value=371
parsing 0xfe03=KEY_0:	value=11
parsing 0xfe1f=KEY_ZOOM:	value=372
parsing 0xfe43=KEY_REWIND:	value=168
parsing 0xfe47=KEY_PLAYPAUSE:	value=164
parsing 0xfe4f=KEY_FASTFORWARD:	value=208
parsing 0xfe57=KEY_MUTE:	value=113
parsing 0xfe0d=KEY_STOP:	value=128
parsing 0xfe01=KEY_RECORD:	value=167
parsing 0xfe4e=KEY_POWER:	value=116
Read dvico_mce table
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
	fe4e=0074
	fe01=00a7
	fe0d=0080
	fe57=0071
	fe4f=00d0
	fe47=00a4
	fe43=00a8
	fe1f=0174
	fe03=000b
	fe13=0173
	fe58=000a
	fe4c=0009
	fe48=0008
	fe54=0007
	fe50=0006
	fe07=0005
	fe1b=0004
	fe17=0003
	fe0b=0002
	fe19=0086
	fe5a=0182
	fe52=00d4
	fe09=0193
	fe11=0192
	fe05=0072
	fe15=0073
	fe42=001c
	fe12=00a3
	fe0f=00a5
	fe55=000f
	fe59=0166
	fe5e=001c
	fe53=006c
	fe5f=006a
	fe5b=0069
	fe51=0067
	fe4d=008b
	fe49=009e
	fe0a=016d
	fe46=0164
	fe16=008d
	fe1e=016c
	fe1a=0185
	fe0e=0187
	fe02=0179
Wrote 45 keycode(s) to driver
/sys/class/rc/rc1//protocols: Invalid argument
Couldn't change the IR protocols

# ir-keyable -v -s rc1 -r
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Opening /dev/input/event15
Input Protocol version: 0x00010001
Enabled protocols: 
scancode 0xfe01 = KEY_RECORD (0xa7)
scancode 0xfe02 = KEY_TV (0x179)
scancode 0xfe03 = KEY_0 (0x0b)
scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
scancode 0xfe07 = KEY_4 (0x05)
scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
scancode 0xfe0a = KEY_EPG (0x16d)
scancode 0xfe0b = KEY_1 (0x02)
scancode 0xfe0d = KEY_STOP (0x80)
scancode 0xfe0e = KEY_MP3 (0x187)
scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
scancode 0xfe11 = KEY_CHANNELUP (0x192)
scancode 0xfe12 = KEY_NEXTSONG (0xa3)
scancode 0xfe13 = KEY_ANGLE (0x173)
scancode 0xfe15 = KEY_VOLUMEUP (0x73)
scancode 0xfe16 = KEY_SETUP (0x8d)
scancode 0xfe17 = KEY_2 (0x03)
scancode 0xfe19 = KEY_OPEN (0x86)
scancode 0xfe1a = KEY_DVD (0x185)
scancode 0xfe1b = KEY_3 (0x04)
scancode 0xfe1e = KEY_FAVORITES (0x16c)
scancode 0xfe1f = KEY_ZOOM (0x174)
scancode 0xfe42 = KEY_ENTER (0x1c)
scancode 0xfe43 = KEY_REWIND (0xa8)
scancode 0xfe46 = KEY_POWER2 (0x164)
scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
scancode 0xfe48 = KEY_7 (0x08)
scancode 0xfe49 = KEY_BACK (0x9e)
scancode 0xfe4c = KEY_8 (0x09)
scancode 0xfe4d = KEY_MENU (0x8b)
scancode 0xfe4e = KEY_POWER (0x74)
scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
scancode 0xfe50 = KEY_5 (0x06)
scancode 0xfe51 = KEY_UP (0x67)
scancode 0xfe52 = KEY_CAMERA (0xd4)
scancode 0xfe53 = KEY_DOWN (0x6c)
scancode 0xfe54 = KEY_6 (0x07)
scancode 0xfe55 = KEY_TAB (0x0f)
scancode 0xfe57 = KEY_MUTE (0x71)
scancode 0xfe58 = KEY_9 (0x0a)
scancode 0xfe59 = KEY_INFO (0x166)
scancode 0xfe5a = KEY_TUNER (0x182)
scancode 0xfe5b = KEY_LEFT (0x69)
scancode 0xfe5e = KEY_ENTER (0x1c)    ##NB
scancode 0xfe5f = KEY_RIGHT (0x6a)

# cat /sys/class/rc/rc1/protocols
unknown

Mapping KEY_OK to KEY_ENTER worked (ie the behaviour when the
OK key was pressed changed), but others did not. For example
I mapped KEY_BACK (0x9e, decimal 158) to KEY_ESC (001)
and KEY_PLAYPAUSE (0xa4, 164) to KEY_PAUSE (119).
But I did not observe any change in behaviour for these two.
ir-keytable -t did show the correct KEY_foo and descimal code, eg.
# ir-keytable -s rc1 -t
Testing events. Please, press CTRL-C to abort.
1479989250.528206: event type EV_MSC(0x04): scancode = 0xfe47
1479989250.528206: event type EV_KEY(0x01) key_down: KEY_PAUSE(0x0077)
1479989250.528206: event type EV_SYN(0x00).
1479989250.779044: event type EV_KEY(0x01) key_up: KEY_PAUSE(0x0077)
1479989250.779044: event type EV_SYN(0x00).
^C

I notice that KEY_ENTER existed in the original keymap but _PAUSE
and _ESC don't, but I don't understand the significance of that.

Vince


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-24 12:12                   ` Vincent McIntyre
@ 2016-11-24 13:34                     ` Sean Young
  2016-11-25  8:59                       ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2016-11-24 13:34 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Thu, Nov 24, 2016 at 11:12:57PM +1100, Vincent McIntyre wrote:
> On Wed, Nov 23, 2016 at 10:34:19PM +0000, Sean Young wrote:
> > > Not sure why Driver is (null), dvb_usb_cxusb is loaded.
> > 
> > That's a mistake, I've fixed that now.
> 
> Ah. I see the added module_name struct members.
> 
> > > I tried -t and it generated events constantly, before I could press
> > > any keys.
> > > # ir-keytable -s rc1 -t
> > > Testing events. Please, press CTRL-C to abort.
> > > 1479903007.535509: event type EV_MSC(0x04): scancode = 0x00
> > > 1479903007.535509: event type EV_SYN(0x00).
> > > 1479903007.635521: event type EV_MSC(0x04): scancode = 0x00
> > 
> > That's also been fixed.
> > 
> 
> yep, works nicely.
> 
> Things are looking much better!
> As shown below I am able to clear a keytable and put in a fresh one.
> Having a bit of trouble with key remapping.
> I guess we still have to work out the protocol in use.
> 
> Test details:
> # ir-keytable -v
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc0/input8/
> Event sysfs node is /sys/class/rc/rc0/input8/event5/
> Parsing uevent /sys/class/rc/rc0/input8/event5/uevent
> /sys/class/rc/rc0/input8/event5/uevent uevent MAJOR=13
> /sys/class/rc/rc0/input8/event5/uevent uevent MINOR=69
> /sys/class/rc/rc0/input8/event5/uevent uevent DEVNAME=input/event5
> Parsing uevent /sys/class/rc/rc0/uevent
> /sys/class/rc/rc0/uevent uevent NAME=rc-imon-mce
> /sys/class/rc/rc0/uevent uevent DRV_NAME=imon
> input device is /dev/input/event5
> /sys/class/rc/rc0/protocols protocol rc-6 (enabled)
> Found /sys/class/rc/rc0/ (/dev/input/event5) with:
> 	Driver imon, table rc-imon-mce
> 	Supported protocols: rc-6 
> 	Enabled protocols: rc-6 
> 	Name: iMON Remote (15c2:ffdc)
> 	bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Found /sys/class/rc/rc1/ (/dev/input/event15) with:
> 	Driver dvb_usb_cxusb, table rc-dvico-mce
> 	Supported protocols: unknown 
> 	Enabled protocols: 
> 	Name: IR-receiver inside an USB DVB re
> 	bus: 3, vendor/product: 0fe9:db78, version: 0x827b
> Input sysfs node is /sys/class/rc/rc2/input19/
> Event sysfs node is /sys/class/rc/rc2/input19/event16/
> Parsing uevent /sys/class/rc/rc2/input19/event16/uevent
> /sys/class/rc/rc2/input19/event16/uevent uevent MAJOR=13
> /sys/class/rc/rc2/input19/event16/uevent uevent MINOR=80
> /sys/class/rc/rc2/input19/event16/uevent uevent DEVNAME=input/event16
> Parsing uevent /sys/class/rc/rc2/uevent
> /sys/class/rc/rc2/uevent uevent NAME=rc-empty
> /sys/class/rc/rc2/uevent uevent DRV_NAME=dvb_usb_af9035
> input device is /dev/input/event16
> /sys/class/rc/rc2/protocols protocol nec (disabled)
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
> 	Driver dvb_usb_af9035, table rc-empty
> 	Supported protocols: nec 
> 	Enabled protocols: 
> 	Name: Leadtek WinFast DTV Dongle Dual
> 	bus: 3, vendor/product: 0413:6a05, version: 0x0200
> 	Repeat delay = 500 ms, repeat period = 125 ms
> 	Repeat delay = 500 ms, repeat period = 125 ms
> 	Repeat delay = 500 ms, repeat period = 125 ms
> 
> # ir-keytable -r -v -s rc1
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
> Enabled protocols: 
> scancode 0xfe01 = KEY_RECORD (0xa7)
> scancode 0xfe02 = KEY_TV (0x179)
> scancode 0xfe03 = KEY_0 (0x0b)
> scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
> scancode 0xfe07 = KEY_4 (0x05)
> scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
> scancode 0xfe0a = KEY_EPG (0x16d)
> scancode 0xfe0b = KEY_1 (0x02)
> scancode 0xfe0d = KEY_STOP (0x80)
> scancode 0xfe0e = KEY_MP3 (0x187)
> scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
> scancode 0xfe11 = KEY_CHANNELUP (0x192)
> scancode 0xfe12 = KEY_NEXTSONG (0xa3)
> scancode 0xfe13 = KEY_ANGLE (0x173)
> scancode 0xfe15 = KEY_VOLUMEUP (0x73)
> scancode 0xfe16 = KEY_SETUP (0x8d)
> scancode 0xfe17 = KEY_2 (0x03)
> scancode 0xfe19 = KEY_OPEN (0x86)
> scancode 0xfe1a = KEY_DVD (0x185)
> scancode 0xfe1b = KEY_3 (0x04)
> scancode 0xfe1e = KEY_FAVORITES (0x16c)
> scancode 0xfe1f = KEY_ZOOM (0x174)
> scancode 0xfe42 = KEY_ENTER (0x1c)
> scancode 0xfe43 = KEY_REWIND (0xa8)
> scancode 0xfe46 = KEY_POWER2 (0x164)
> scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
> scancode 0xfe48 = KEY_7 (0x08)
> scancode 0xfe49 = KEY_BACK (0x9e)
> scancode 0xfe4c = KEY_8 (0x09)
> scancode 0xfe4d = KEY_MENU (0x8b)
> scancode 0xfe4e = KEY_POWER (0x74)
> scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
> scancode 0xfe50 = KEY_5 (0x06)
> scancode 0xfe51 = KEY_UP (0x67)
> scancode 0xfe52 = KEY_CAMERA (0xd4)
> scancode 0xfe53 = KEY_DOWN (0x6c)
> scancode 0xfe54 = KEY_6 (0x07)
> scancode 0xfe55 = KEY_TAB (0x0f)
> scancode 0xfe57 = KEY_MUTE (0x71)
> scancode 0xfe58 = KEY_9 (0x0a)
> scancode 0xfe59 = KEY_INFO (0x166)
> scancode 0xfe5a = KEY_TUNER (0x182)
> scancode 0xfe5b = KEY_LEFT (0x69)
> scancode 0xfe5e = KEY_OK (0x160)
> scancode 0xfe5f = KEY_RIGHT (0x6a)
> 
> # ir-keytable -s rc1 -t
> Testing events. Please, press CTRL-C to abort.
> 1479985656.760267: event type EV_MSC(0x04): scancode = 0xfe47
> 1479985656.760267: event type EV_KEY(0x01) key_down: KEY_PLAYPAUSE(0x00a4)
> 1479985656.760267: event type EV_SYN(0x00).
> 1479985657.011045: event type EV_KEY(0x01) key_up: KEY_PLAYPAUSE(0x00a4)
> 1479985657.011045: event type EV_SYN(0x00).
> 1479985671.812267: event type EV_MSC(0x04): scancode = 0xfe53
> 1479985671.812267: event type EV_KEY(0x01) key_down: KEY_DOWN(0x006c)
> 1479985671.812267: event type EV_SYN(0x00).
> 1479985672.063048: event type EV_KEY(0x01) key_up: KEY_DOWN(0x006c)
> 1479985672.063048: event type EV_SYN(0x00).
> 1479985674.520279: event type EV_MSC(0x04): scancode = 0xfe52
> 1479985674.520279: event type EV_KEY(0x01) key_down: KEY_CAMERA(0x00d4)
> 1479985674.520279: event type EV_SYN(0x00).
> 1479985674.771044: event type EV_KEY(0x01) key_up: KEY_CAMERA(0x00d4)
> 1479985674.771044: event type EV_SYN(0x00).
> 1479985675.628312: event type EV_MSC(0x04): scancode = 0xfe4d
> 1479985675.628312: event type EV_KEY(0x01) key_down: KEY_MENU(0x008b)
> 1479985675.628312: event type EV_SYN(0x00).
> 1479985675.879045: event type EV_KEY(0x01) key_up: KEY_MENU(0x008b)
> 1479985675.879045: event type EV_SYN(0x00).
> 1479985677.732236: event type EV_MSC(0x04): scancode = 0xfe49
> 1479985677.732236: event type EV_KEY(0x01) key_down: KEY_BACK(0x009e)
> 1479985677.732236: event type EV_SYN(0x00).
> 1479985677.983043: event type EV_KEY(0x01) key_up: KEY_BACK(0x009e)
> 1479985677.983043: event type EV_SYN(0x00).
> 1479985687.464239: event type EV_MSC(0x04): scancode = 0xfe5e
> 1479985687.464239: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
> 1479985687.464239: event type EV_SYN(0x00).
> 1479985687.715043: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
> 1479985687.715043: event type EV_SYN(0x00).
> 1479985696.396382: event type EV_MSC(0x04): scancode = 0xfe42
> 1479985696.396382: event type EV_KEY(0x01) key_down: KEY_ENTER(0x001c)
> 1479985696.396382: event type EV_SYN(0x00).
> 1479985696.647049: event type EV_KEY(0x01) key_up: KEY_ENTER(0x001c)
> 1479985696.647049: event type EV_SYN(0x00).
> 1479985701.220194: event type EV_MSC(0x04): scancode = 0xfe0d
> 1479985701.220194: event type EV_KEY(0x01) key_down: KEY_STOP(0x0080)
> 1479985701.220194: event type EV_SYN(0x00).
> 1479985701.471047: event type EV_KEY(0x01) key_up: KEY_STOP(0x0080)
> 1479985701.471047: event type EV_SYN(0x00).
> ^C
> 
> # diff  dvice_mce dvico_mce_new
> --- dvico_mce   2016-11-24 22:18:48.000000000 +1100
> +++ dvico_mce_new   2016-11-24 22:11:02.000000000 +1100
> @@ -12,7 +12,7 @@
>  0xfe5b KEY_LEFT
>  0xfe5f KEY_RIGHT
>  0xfe53 KEY_DOWN
> -0xfe5e KEY_OK
> +0xfe5e KEY_ENTER
>  0xfe59 KEY_INFO
>  0xfe55 KEY_TAB
>  0xfe0f KEY_PREVIOUSSONG
> 
> # ir-keyable -v -s rc1 -c
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
> Deleting entry 1
> Deleting entry 2
> Deleting entry 3
> Deleting entry 4
> Deleting entry 5
> Deleting entry 6
> Deleting entry 7
> Deleting entry 8
> Deleting entry 9
> Deleting entry 10
> Deleting entry 11
> Deleting entry 12
> Deleting entry 13
> Deleting entry 14
> Deleting entry 15
> Deleting entry 16
> Deleting entry 17
> Deleting entry 18
> Deleting entry 19
> Deleting entry 20
> Deleting entry 21
> Deleting entry 22
> Deleting entry 23
> Deleting entry 24
> Deleting entry 25
> Deleting entry 26
> Deleting entry 27
> Deleting entry 28
> Deleting entry 29
> Deleting entry 30
> Deleting entry 31
> Deleting entry 32
> Deleting entry 33
> Deleting entry 34
> Deleting entry 35
> Deleting entry 36
> Deleting entry 37
> Deleting entry 38
> Deleting entry 39
> Deleting entry 40
> Deleting entry 41
> Deleting entry 42
> Deleting entry 43
> Deleting entry 44
> Deleting entry 45
> Deleting entry 46
> Old keytable cleared
> 
> # ir-keyable -v -s rc1 -w dvico-mce-new
> Parsing ./dvico_mce_new keycode file
> parsing 0xfe02=KEY_TV:	value=377
> parsing 0xfe0e=KEY_MP3:	value=391
> parsing 0xfe1a=KEY_DVD:	value=389
> parsing 0xfe1e=KEY_FAVORITES:	value=364
> parsing 0xfe16=KEY_SETUP:	value=141
> parsing 0xfe46=KEY_POWER2:	value=356
> parsing 0xfe0a=KEY_EPG:	value=365
> parsing 0xfe49=KEY_BACK:	value=158
> parsing 0xfe4d=KEY_MENU:	value=139
> parsing 0xfe51=KEY_UP:	value=103
> parsing 0xfe5b=KEY_LEFT:	value=105
> parsing 0xfe5f=KEY_RIGHT:	value=106
> parsing 0xfe53=KEY_DOWN:	value=108
> parsing 0xfe5e=KEY_ENTER:	value=28
> parsing 0xfe59=KEY_INFO:	value=358
> parsing 0xfe55=KEY_TAB:	value=15
> parsing 0xfe0f=KEY_PREVIOUSSONG:	value=165
> parsing 0xfe12=KEY_NEXTSONG:	value=163
> parsing 0xfe42=KEY_ENTER:	value=28
> parsing 0xfe15=KEY_VOLUMEUP:	value=115
> parsing 0xfe05=KEY_VOLUMEDOWN:	value=114
> parsing 0xfe11=KEY_CHANNELUP:	value=402
> parsing 0xfe09=KEY_CHANNELDOWN:	value=403
> parsing 0xfe52=KEY_CAMERA:	value=212
> parsing 0xfe5a=KEY_TUNER:	value=386
> parsing 0xfe19=KEY_OPEN:	value=134
> parsing 0xfe0b=KEY_1:	value=2
> parsing 0xfe17=KEY_2:	value=3
> parsing 0xfe1b=KEY_3:	value=4
> parsing 0xfe07=KEY_4:	value=5
> parsing 0xfe50=KEY_5:	value=6
> parsing 0xfe54=KEY_6:	value=7
> parsing 0xfe48=KEY_7:	value=8
> parsing 0xfe4c=KEY_8:	value=9
> parsing 0xfe58=KEY_9:	value=10
> parsing 0xfe13=KEY_ANGLE:	value=371
> parsing 0xfe03=KEY_0:	value=11
> parsing 0xfe1f=KEY_ZOOM:	value=372
> parsing 0xfe43=KEY_REWIND:	value=168
> parsing 0xfe47=KEY_PLAYPAUSE:	value=164
> parsing 0xfe4f=KEY_FASTFORWARD:	value=208
> parsing 0xfe57=KEY_MUTE:	value=113
> parsing 0xfe0d=KEY_STOP:	value=128
> parsing 0xfe01=KEY_RECORD:	value=167
> parsing 0xfe4e=KEY_POWER:	value=116
> Read dvico_mce table
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
> 	fe4e=0074
> 	fe01=00a7
> 	fe0d=0080
> 	fe57=0071
> 	fe4f=00d0
> 	fe47=00a4
> 	fe43=00a8
> 	fe1f=0174
> 	fe03=000b
> 	fe13=0173
> 	fe58=000a
> 	fe4c=0009
> 	fe48=0008
> 	fe54=0007
> 	fe50=0006
> 	fe07=0005
> 	fe1b=0004
> 	fe17=0003
> 	fe0b=0002
> 	fe19=0086
> 	fe5a=0182
> 	fe52=00d4
> 	fe09=0193
> 	fe11=0192
> 	fe05=0072
> 	fe15=0073
> 	fe42=001c
> 	fe12=00a3
> 	fe0f=00a5
> 	fe55=000f
> 	fe59=0166
> 	fe5e=001c
> 	fe53=006c
> 	fe5f=006a
> 	fe5b=0069
> 	fe51=0067
> 	fe4d=008b
> 	fe49=009e
> 	fe0a=016d
> 	fe46=0164
> 	fe16=008d
> 	fe1e=016c
> 	fe1a=0185
> 	fe0e=0187
> 	fe02=0179
> Wrote 45 keycode(s) to driver
> /sys/class/rc/rc1//protocols: Invalid argument
> Couldn't change the IR protocols
> 
> # ir-keyable -v -s rc1 -r
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input18/
> Event sysfs node is /sys/class/rc/rc1/input18/event15/
> Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
> /sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
> /sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event15
> /sys/class/rc/rc1/protocols protocol unknown (disabled)
> Opening /dev/input/event15
> Input Protocol version: 0x00010001
> Enabled protocols: 
> scancode 0xfe01 = KEY_RECORD (0xa7)
> scancode 0xfe02 = KEY_TV (0x179)
> scancode 0xfe03 = KEY_0 (0x0b)
> scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
> scancode 0xfe07 = KEY_4 (0x05)
> scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
> scancode 0xfe0a = KEY_EPG (0x16d)
> scancode 0xfe0b = KEY_1 (0x02)
> scancode 0xfe0d = KEY_STOP (0x80)
> scancode 0xfe0e = KEY_MP3 (0x187)
> scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
> scancode 0xfe11 = KEY_CHANNELUP (0x192)
> scancode 0xfe12 = KEY_NEXTSONG (0xa3)
> scancode 0xfe13 = KEY_ANGLE (0x173)
> scancode 0xfe15 = KEY_VOLUMEUP (0x73)
> scancode 0xfe16 = KEY_SETUP (0x8d)
> scancode 0xfe17 = KEY_2 (0x03)
> scancode 0xfe19 = KEY_OPEN (0x86)
> scancode 0xfe1a = KEY_DVD (0x185)
> scancode 0xfe1b = KEY_3 (0x04)
> scancode 0xfe1e = KEY_FAVORITES (0x16c)
> scancode 0xfe1f = KEY_ZOOM (0x174)
> scancode 0xfe42 = KEY_ENTER (0x1c)
> scancode 0xfe43 = KEY_REWIND (0xa8)
> scancode 0xfe46 = KEY_POWER2 (0x164)
> scancode 0xfe47 = KEY_PLAYPAUSE (0xa4)
> scancode 0xfe48 = KEY_7 (0x08)
> scancode 0xfe49 = KEY_BACK (0x9e)
> scancode 0xfe4c = KEY_8 (0x09)
> scancode 0xfe4d = KEY_MENU (0x8b)
> scancode 0xfe4e = KEY_POWER (0x74)
> scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
> scancode 0xfe50 = KEY_5 (0x06)
> scancode 0xfe51 = KEY_UP (0x67)
> scancode 0xfe52 = KEY_CAMERA (0xd4)
> scancode 0xfe53 = KEY_DOWN (0x6c)
> scancode 0xfe54 = KEY_6 (0x07)
> scancode 0xfe55 = KEY_TAB (0x0f)
> scancode 0xfe57 = KEY_MUTE (0x71)
> scancode 0xfe58 = KEY_9 (0x0a)
> scancode 0xfe59 = KEY_INFO (0x166)
> scancode 0xfe5a = KEY_TUNER (0x182)
> scancode 0xfe5b = KEY_LEFT (0x69)
> scancode 0xfe5e = KEY_ENTER (0x1c)    ##NB
> scancode 0xfe5f = KEY_RIGHT (0x6a)
> 
> # cat /sys/class/rc/rc1/protocols
> unknown

That all looks fine.

> Mapping KEY_OK to KEY_ENTER worked (ie the behaviour when the
> OK key was pressed changed), but others did not. For example
> I mapped KEY_BACK (0x9e, decimal 158) to KEY_ESC (001)
> and KEY_PLAYPAUSE (0xa4, 164) to KEY_PAUSE (119).
> But I did not observe any change in behaviour for these two.
> ir-keytable -t did show the correct KEY_foo and descimal code, eg.
> # ir-keytable -s rc1 -t
> Testing events. Please, press CTRL-C to abort.
> 1479989250.528206: event type EV_MSC(0x04): scancode = 0xfe47
> 1479989250.528206: event type EV_KEY(0x01) key_down: KEY_PAUSE(0x0077)
> 1479989250.528206: event type EV_SYN(0x00).
> 1479989250.779044: event type EV_KEY(0x01) key_up: KEY_PAUSE(0x0077)
> 1479989250.779044: event type EV_SYN(0x00).
> ^C

So if I understand you correctly, if you change the keymap, like you
changed 0xfe47 to KEY_PAUSE, then "ir-keytable -s rc1 -t" show you the
correct (new) key? So as far as ir-keytable is concerned, everything
works?

However when you try to use the new mapping in some application then
it does not work?

> I notice that KEY_ENTER existed in the original keymap but _PAUSE
> and _ESC don't, but I don't understand the significance of that.

I don't know how that should matter.

Thanks
Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-24 13:34                     ` Sean Young
@ 2016-11-25  8:59                       ` Vincent McIntyre
  2016-11-27  0:39                         ` Vincent McIntyre
  2016-11-27 19:35                         ` Sean Young
  0 siblings, 2 replies; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-25  8:59 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On 11/25/16, Sean Young <sean@mess.org> wrote:
>
> So if I understand you correctly, if you change the keymap, like you
> changed 0xfe47 to KEY_PAUSE, then "ir-keytable -s rc1 -t" show you the
> correct (new) key? So as far as ir-keytable is concerned, everything
> works?
>
> However when you try to use the new mapping in some application then
> it does not work?

That's correct. ir-keytable seems to be doing the right thing, mapping
the scancode to the input-event-codes.h key code I asked it to.

The application I am trying to use it with is the mythtv frontend.  I
am doing the keycode munging from an SSH session while myth is still
running on the main screen. I didn't think this would matter (since it
worked for KEY_OK->KEY_ENTER) but perhaps it does. Obviously
ir-keytable -t intercepts the scancodes when it is running, but when I
kill it myth responds normally to some keys, but not all.



I wanted to mention that the IR protocol is still showing as unknown.
Is there anything that can be done to sort that out?

Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-25  8:59                       ` Vincent McIntyre
@ 2016-11-27  0:39                         ` Vincent McIntyre
  2016-11-27 19:35                         ` Sean Young
  1 sibling, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-27  0:39 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

>>
>> However when you try to use the new mapping in some application then
>> it does not work?
>
> That's correct. ir-keytable seems to be doing the right thing, mapping
> the scancode to the input-event-codes.h key code I asked it to.
>
> The application I am trying to use it with is the mythtv frontend.  I
> am doing the keycode munging from an SSH session while myth is still
> running on the main screen. I didn't think this would matter (since it
> worked for KEY_OK->KEY_ENTER) but perhaps it does. Obviously
> ir-keytable -t intercepts the scancodes when it is running, but when I
> kill it myth responds normally to some keys, but not all.

It turned out that that I had to restart X to make it notice the updated keymap.
After that, the modfied keymap I set up is mostly working.

There is still a bit of a mystery. As I understand it, X should notice
key codes less than 255 (0xff). But it seems to be ignoring KEY_STOP
(code 128, 0x80) and any key codes higher than that but less than 255.
ir-keytable -t shows the right codes.

Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-25  8:59                       ` Vincent McIntyre
  2016-11-27  0:39                         ` Vincent McIntyre
@ 2016-11-27 19:35                         ` Sean Young
  2016-11-28  8:35                           ` Vincent McIntyre
  2016-11-30  9:02                           ` Vincent McIntyre
  1 sibling, 2 replies; 30+ messages in thread
From: Sean Young @ 2016-11-27 19:35 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Fri, Nov 25, 2016 at 07:59:21PM +1100, Vincent McIntyre wrote:
> On 11/25/16, Sean Young <sean@mess.org> wrote:
> >
> > So if I understand you correctly, if you change the keymap, like you
> > changed 0xfe47 to KEY_PAUSE, then "ir-keytable -s rc1 -t" show you the
> > correct (new) key? So as far as ir-keytable is concerned, everything
> > works?
> >
> > However when you try to use the new mapping in some application then
> > it does not work?
> 
> That's correct. ir-keytable seems to be doing the right thing, mapping
> the scancode to the input-event-codes.h key code I asked it to.

ir-keytable reads from the input layer, so that's the key being sent. The
problem is elsewhere.

> The application I am trying to use it with is the mythtv frontend.  I
> am doing the keycode munging from an SSH session while myth is still
> running on the main screen. I didn't think this would matter (since it
> worked for KEY_OK->KEY_ENTER) but perhaps it does. Obviously
> ir-keytable -t intercepts the scancodes when it is running, but when I
> kill it myth responds normally to some keys, but not all.

X and keycodes is a bit messy. You might need xmodmap mappings. You
can check them xev. I don't know much about this, I'm afraid. What
linux distribution, version and keyboard layout are you using? I could
try and see if I can reproduce/fix this.
 
> I wanted to mention that the IR protocol is still showing as unknown.
> Is there anything that can be done to sort that out?

It would be nice if that could be sorted out, although that would be 
a separate patch.

So all we know right now is what scancode the IR receiver hardware
produces but we have no idea what IR protocol is being used. In order to
figure this out we need a recording of the IR the remote sends, for which
a different IR receiver is needed. Neither your imon nor your 
dvb_usb_af9035 can do this, something like a mce usb IR receiver would
be best. Do you have access to one? One with an IR emitter would be
best.

So with that we can have a recording of the IR the remote sends, and
with the emitter we can see which IR protocols the IR receiver 
understands.


Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-27 19:35                         ` Sean Young
@ 2016-11-28  8:35                           ` Vincent McIntyre
  2016-11-30  9:02                           ` Vincent McIntyre
  1 sibling, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-28  8:35 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Sun, Nov 27, 2016 at 07:35:10PM +0000, Sean Young wrote:
> > The application I am trying to use it with is the mythtv frontend.  I
> > am doing the keycode munging from an SSH session while myth is still
> > running on the main screen. I didn't think this would matter (since it
> > worked for KEY_OK->KEY_ENTER) but perhaps it does. Obviously
> > ir-keytable -t intercepts the scancodes when it is running, but when I
> > kill it myth responds normally to some keys, but not all.
> 
> X and keycodes is a bit messy. You might need xmodmap mappings. You
> can check them xev. I don't know much about this, I'm afraid. What
> linux distribution, version and keyboard layout are you using? I could
> try and see if I can reproduce/fix this.

I mostly figured this out but something weird happens with the most
significant bit (see my follow-on email). FWIW, this is on ubuntu 16.04
with their standard kernel (4.4) and a bog-standard US english layout.


> > I wanted to mention that the IR protocol is still showing as unknown.
> > Is there anything that can be done to sort that out?
> 
> It would be nice if that could be sorted out, although that would be 
> a separate patch.

That's fine. For the current patch, please feel free to add my
Tested-By: vincent.mcintyre@gmail.com

> So all we know right now is what scancode the IR receiver hardware
> produces but we have no idea what IR protocol is being used. In
> order to figure this out we need a recording of the IR the remote
> sends, for which a different IR receiver is needed. Neither your
> imon nor your dvb_usb_af9035 can do this, something like a mce usb
> IR receiver would be best. Do you have access to one? One with an IR
> emitter would be best.
> 
> So with that we can have a recording of the IR the remote sends, and
> with the emitter we can see which IR protocols the IR receiver
> understands.
> 

I'll poke around to see if I can find something, will take a few days.
Thanks again for your interest in this.
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-27 19:35                         ` Sean Young
  2016-11-28  8:35                           ` Vincent McIntyre
@ 2016-11-30  9:02                           ` Vincent McIntyre
  2017-02-02 11:18                             ` Vincent McIntyre
  1 sibling, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2016-11-30  9:02 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On Sun, Nov 27, 2016 at 07:35:10PM +0000, Sean Young wrote:
>  
> > I wanted to mention that the IR protocol is still showing as unknown.
> > Is there anything that can be done to sort that out?
> 
> It would be nice if that could be sorted out, although that would be 
> a separate patch.
> 
> So all we know right now is what scancode the IR receiver hardware
> produces but we have no idea what IR protocol is being used. In order to
> figure this out we need a recording of the IR the remote sends, for which
> a different IR receiver is needed. Neither your imon nor your 
> dvb_usb_af9035 can do this, something like a mce usb IR receiver would
> be best. Do you have access to one? One with an IR emitter would be
> best.
> 
> So with that we can have a recording of the IR the remote sends, and
> with the emitter we can see which IR protocols the IR receiver 
> understands.

Haven't been able to find anything suitable. I would order something
but I won't be able to follow up for several weeks.
I'll ask on the myth list to see if anyone is up for trying this.

Thanks again for your help with this
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2016-11-30  9:02                           ` Vincent McIntyre
@ 2017-02-02 11:18                             ` Vincent McIntyre
  2017-02-02 23:35                               ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-02 11:18 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

Hey there

On 11/30/16, Vincent McIntyre <vincent.mcintyre@gmail.com> wrote:
> On Sun, Nov 27, 2016 at 07:35:10PM +0000, Sean Young wrote:
>>
>> > I wanted to mention that the IR protocol is still showing as unknown.
>> > Is there anything that can be done to sort that out?
>>
>> It would be nice if that could be sorted out, although that would be
>> a separate patch.
>>
>> So all we know right now is what scancode the IR receiver hardware
>> produces but we have no idea what IR protocol is being used. In order to
>> figure this out we need a recording of the IR the remote sends, for which
>> a different IR receiver is needed. Neither your imon nor your
>> dvb_usb_af9035 can do this, something like a mce usb IR receiver would
>> be best. Do you have access to one? One with an IR emitter would be
>> best.
>>
>> So with that we can have a recording of the IR the remote sends, and
>> with the emitter we can see which IR protocols the IR receiver
>> understands.
>
> Haven't been able to find anything suitable. I would order something
> but I won't be able to follow up for several weeks.
> I'll ask on the myth list to see if anyone is up for trying this.
>

I bought one of these, but I am not sure how to make the recording:

# lsusb -d 1934:5168 -v

Bus 008 Device 003: ID 1934:5168 Feature Integration Technology Inc.
(Fintek) F71610A or F71612A Consumer Infrared Receiver/Transceiver
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        16
  idVendor           0x1934 Feature Integration Technology Inc. (Fintek)
  idProduct          0x5168 F71610A or F71612A Consumer Infrared
Receiver/Transceiver
  bcdDevice            0.01
  iManufacturer           1 FINTEK
  iProduct                2 eHome Infrared Transceiver
  iSerial                 3 88636562727801
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)


# ir-keytable -v
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Found device /sys/class/rc/rc3/                          <---- the new device
Input sysfs node is /sys/class/rc/rc0/input8/
Event sysfs node is /sys/class/rc/rc0/input8/event5/
Parsing uevent /sys/class/rc/rc0/input8/event5/uevent
/sys/class/rc/rc0/input8/event5/uevent uevent MAJOR=13
/sys/class/rc/rc0/input8/event5/uevent uevent MINOR=69
/sys/class/rc/rc0/input8/event5/uevent uevent DEVNAME=input/event5
Parsing uevent /sys/class/rc/rc0/uevent
/sys/class/rc/rc0/uevent uevent NAME=rc-imon-mce
/sys/class/rc/rc0/uevent uevent DRV_NAME=imon
input device is /dev/input/event5
/sys/class/rc/rc0/protocols protocol rc-6 (enabled)
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
	Driver imon, table rc-imon-mce
	Supported protocols: rc-6
	Enabled protocols: rc-6
	Name: iMON Remote (15c2:ffdc)
	bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
	Repeat delay = 500 ms, repeat period = 125 ms
Input sysfs node is /sys/class/rc/rc1/input18/
Event sysfs node is /sys/class/rc/rc1/input18/event15/
Parsing uevent /sys/class/rc/rc1/input18/event15/uevent
/sys/class/rc/rc1/input18/event15/uevent uevent MAJOR=13
/sys/class/rc/rc1/input18/event15/uevent uevent MINOR=79
/sys/class/rc/rc1/input18/event15/uevent uevent DEVNAME=input/event15
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event15
/sys/class/rc/rc1/protocols protocol unknown (disabled)
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
	Driver dvb_usb_cxusb, table rc-dvico-mce
	Supported protocols: unknown
	Enabled protocols:
	Name: IR-receiver inside an USB DVB re
	bus: 3, vendor/product: 0fe9:db78, version: 0x827b
	Repeat delay = 500 ms, repeat period = 125 ms
Input sysfs node is /sys/class/rc/rc2/input19/
Event sysfs node is /sys/class/rc/rc2/input19/event16/
Parsing uevent /sys/class/rc/rc2/input19/event16/uevent
/sys/class/rc/rc2/input19/event16/uevent uevent MAJOR=13
/sys/class/rc/rc2/input19/event16/uevent uevent MINOR=80
/sys/class/rc/rc2/input19/event16/uevent uevent DEVNAME=input/event16
Parsing uevent /sys/class/rc/rc2/uevent
/sys/class/rc/rc2/uevent uevent NAME=rc-empty
/sys/class/rc/rc2/uevent uevent DRV_NAME=dvb_usb_af9035
input device is /dev/input/event16
/sys/class/rc/rc2/protocols protocol nec (disabled)
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
	Driver dvb_usb_af9035, table rc-empty
	Supported protocols: nec
	Enabled protocols:
	Name: Leadtek WinFast DTV Dongle Dual
	bus: 3, vendor/product: 0413:6a05, version: 0x0200
	Repeat delay = 500 ms, repeat period = 125 ms
Input sysfs node is /sys/class/rc/rc3/input20/
 <---- new device
Event sysfs node is /sys/class/rc/rc3/input20/event2/
Parsing uevent /sys/class/rc/rc3/input20/event2/uevent
/sys/class/rc/rc3/input20/event2/uevent uevent MAJOR=13
/sys/class/rc/rc3/input20/event2/uevent uevent MINOR=66
/sys/class/rc/rc3/input20/event2/uevent uevent DEVNAME=input/event2
Parsing uevent /sys/class/rc/rc3/uevent
/sys/class/rc/rc3/uevent uevent NAME=rc-rc6-mce
/sys/class/rc/rc3/uevent uevent DRV_NAME=mceusb
input device is /dev/input/event2
/sys/class/rc/rc3/protocols protocol other (disabled)
/sys/class/rc/rc3/protocols protocol unknown (disabled)
/sys/class/rc/rc3/protocols protocol rc-5 (disabled)
/sys/class/rc/rc3/protocols protocol nec (disabled)
/sys/class/rc/rc3/protocols protocol rc-6 (enabled)
/sys/class/rc/rc3/protocols protocol jvc (disabled)
/sys/class/rc/rc3/protocols protocol sony (disabled)
/sys/class/rc/rc3/protocols protocol rc-5-sz (disabled)
/sys/class/rc/rc3/protocols protocol sanyo (disabled)
/sys/class/rc/rc3/protocols protocol sharp (disabled)
/sys/class/rc/rc3/protocols protocol mce_kbd (disabled)
/sys/class/rc/rc3/protocols protocol xmp (disabled)
/sys/class/rc/rc3/protocols protocol cec (disabled)
/sys/class/rc/rc3/protocols protocol lirc (enabled)
Found /sys/class/rc/rc3/ (/dev/input/event2) with:
	Driver mceusb, table rc-rc6-mce
	Supported protocols: unknown other lirc rc-5 jvc sony nec sanyo
mce-kbd rc-6 sharp xmp
	Enabled protocols: lirc rc-6
	Name: Media Center Ed. eHome Infrared
	bus: 3, vendor/product: 1934:5168, version: 0x0001
	Repeat delay = 500 ms, repeat period = 125 ms


When I plugged it in, I got this in dmesg:

usb 8-1: new full-speed USB device number 3 using uhci_hcd
usb 8-1: New USB device found, idVendor=1934, idProduct=5168
usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 8-1: Product: eHome Infrared Transceiver
usb 8-1: Manufacturer: FINTEK
usb 8-1: SerialNumber: 88636562727801
Registered IR keymap rc-rc6-mce
input: Media Center Ed. eHome Infrared Remote Transceiver (1934:5168)
as /devices/pci0000:00/0000:00:1d.1/usb8/8-1/8-1:1.0/rc/rc3/input20
rc rc3: Media Center Ed. eHome Infrared Remote Transceiver (1934:5168)
as /devices/pci0000:00/0000:00:1d.1/usb8/8-1/8-1:1.0/rc/rc3
lirc_dev: IR Remote Control driver registered, major 241
rc rc3: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0
IR LIRC bridge handler initialized
mceusb 8-1:1.0: Registered FINTEK eHome Infrared Transceiver with mce
emulator interface version 2
mceusb 8-1:1.0: 0 tx ports (0x0 cabled) and 2 rx sensors (0x1 active)
usbcore: registered new interface driver mceusb
IR RC6 protocol handler initialized

Poking around I see lirc has an irrecord program. Is that what I need?

Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-02 11:18                             ` Vincent McIntyre
@ 2017-02-02 23:35                               ` Sean Young
       [not found]                                 ` <CAEsFdVMhbxb3d=_ugYjfYSCRZsQMhtt=kmsqX81x-6UjTYc-bg@mail.gmail.com>
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2017-02-02 23:35 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

Hi Vincent,

On Thu, Feb 02, 2017 at 10:18:52PM +1100, Vincent McIntyre wrote:
> On 11/30/16, Vincent McIntyre <vincent.mcintyre@gmail.com> wrote:
> > On Sun, Nov 27, 2016 at 07:35:10PM +0000, Sean Young wrote:
> >>
> >> > I wanted to mention that the IR protocol is still showing as unknown.
> >> > Is there anything that can be done to sort that out?
> >>
> >> It would be nice if that could be sorted out, although that would be
> >> a separate patch.
> >>
> >> So all we know right now is what scancode the IR receiver hardware
> >> produces but we have no idea what IR protocol is being used. In order to
> >> figure this out we need a recording of the IR the remote sends, for which
> >> a different IR receiver is needed. Neither your imon nor your
> >> dvb_usb_af9035 can do this, something like a mce usb IR receiver would
> >> be best. Do you have access to one? One with an IR emitter would be
> >> best.
> >>
> >> So with that we can have a recording of the IR the remote sends, and
> >> with the emitter we can see which IR protocols the IR receiver
> >> understands.
> >
> > Haven't been able to find anything suitable. I would order something
> > but I won't be able to follow up for several weeks.
> > I'll ask on the myth list to see if anyone is up for trying this.
> >
> 
> I bought one of these, but I am not sure how to make the recording:
> 
> # lsusb -d 1934:5168 -v
> 
> Bus 008 Device 003: ID 1934:5168 Feature Integration Technology Inc.
> (Fintek) F71610A or F71612A Consumer Infrared Receiver/Transceiver
-snip-
> Poking around I see lirc has an irrecord program. Is that what I need?

That's great. There are a couple of ways of doing this, and none of them
is straightforward. It's a bit of reading tea leaves (that's one of the
motivations for my lirc-scancodes patches, but I digress).

Method 1:
echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +xmp" > /sys/class/rc/rc3/protocols
echo 1 > /sys/module/rc_core/parameters/debug
journal -f -k 
# press button on remote

Now look for "scancode" somewhere in there.

Method 2:
Either use lirc's mode2 or "ir-ctl -r -d /dev/lircX" (from v4l-utils 1.12),
and post the output here.

Thanks!

Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
       [not found]                                     ` <CAEsFdVM14VngTM5X=qWTitgwox+4yD8heUqjULe8C=3z2P+h3Q@mail.gmail.com>
@ 2017-02-07 12:33                                       ` Vincent McIntyre
  2017-02-16 13:05                                         ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-07 12:33 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

I tried your patch, after disabling the custom keymap file I had put
in. Unfortunately the remote isn't working at all. When the relevant
modules get loaded I see this in dmesg


[    7.838223] media: Linux media interface: v0.10
[    7.840484] WARNING: You are using an experimental version of the
media stack.
                As the driver is backported to an older kernel, it doesn't offer
                enough quality for its usage in production.
                Use it with care.
               Latest git patches (needed if you report a bug to
linux-media@vger.kernel.org):
                47b037a0512d9f8675ec2693bed46c8ea6a884ab [media]
v4l2-async: failing functions shouldn't have side effects
                79a2eda80c6dab79790c308d9f50ecd2e5021ba3 [media]
mantis_dvb: fix some error codes in mantis_dvb_init()
                c2987aaf0c9c2bcb0d4c5902d61473d9aa018a3d [media]
exynos-gsc: Avoid spamming the log on VIDIOC_TRY_FMT
[    7.843667] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_rw
[    7.843669] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_rw (err -22)
[    7.843692] dvb_usb_cxusb: disagrees about version of symbol rc_keydown
[    7.843693] dvb_usb_cxusb: Unknown symbol rc_keydown (err -22)
[    7.843701] dvb_usb_cxusb: disagrees about version of symbol
dib0070_wbd_offset
[    7.843702] dvb_usb_cxusb: Unknown symbol dib0070_wbd_offset (err -22)
[    7.843707] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_device_init
[    7.843708] dvb_usb_cxusb: Unknown symbol dvb_usb_device_init (err -22)
[    7.843712] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_write
[    7.843713] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_write (err -22)
[    8.089033] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_rw
[    8.089035] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_rw (err -22)
[    8.089068] dvb_usb_cxusb: disagrees about version of symbol rc_keydown
[    8.089070] dvb_usb_cxusb: Unknown symbol rc_keydown (err -22)
[    8.089079] dvb_usb_cxusb: disagrees about version of symbol
dib0070_wbd_offset
[    8.089080] dvb_usb_cxusb: Unknown symbol dib0070_wbd_offset (err -22)
[    8.089085] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_device_init
[    8.089086] dvb_usb_cxusb: Unknown symbol dvb_usb_device_init (err -22)
[    8.089090] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_write
[    8.089091] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_write (err -22)

A manual modprobe gives this:

# modprobe -v dvb_usb_cxusb
insmod /lib/modules/4.4.0-59-generic/kernel/drivers/media/usb/dvb-usb/dvb-usb-cxusb.ko
modprobe: ERROR: could not insert 'dvb_usb_cxusb': Invalid argument
# dmesg
....
[  547.365417] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_rw
[  547.365422] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_rw (err -22)
[  547.365461] dvb_usb_cxusb: disagrees about version of symbol rc_keydown
[  547.365463] dvb_usb_cxusb: Unknown symbol rc_keydown (err -22)
[  547.365475] dvb_usb_cxusb: disagrees about version of symbol
dib0070_wbd_offset
[  547.365477] dvb_usb_cxusb: Unknown symbol dib0070_wbd_offset (err -22)
[  547.365484] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_device_init
[  547.365486] dvb_usb_cxusb: Unknown symbol dvb_usb_device_init (err -22)
[  547.365493] dvb_usb_cxusb: disagrees about version of symbol
dvb_usb_generic_write
[  547.365495] dvb_usb_cxusb: Unknown symbol dvb_usb_generic_write (err -22)

I was able to modprobe the rc-dvico-mce module, there was nothing in
dmesg afterward though.

Cheers
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-07 12:33                                       ` Vincent McIntyre
@ 2017-02-16 13:05                                         ` Vincent McIntyre
  2017-02-16 13:07                                           ` Vincent McIntyre
  2017-02-20 17:13                                           ` Sean Young
  0 siblings, 2 replies; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-16 13:05 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

Hi again

after you kindly fixed media_build for me I applied the nec protocol
patch and tried again.

$ sudo ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event11) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

$ sudo ir-keytable -v --sysdev rc1
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc0/input8/
Event sysfs node is /sys/class/rc/rc0/input8/event5/
Parsing uevent /sys/class/rc/rc0/input8/event5/uevent
/sys/class/rc/rc0/input8/event5/uevent uevent MAJOR=13
/sys/class/rc/rc0/input8/event5/uevent uevent MINOR=69
/sys/class/rc/rc0/input8/event5/uevent uevent DEVNAME=input/event5
Parsing uevent /sys/class/rc/rc0/uevent
/sys/class/rc/rc0/uevent uevent NAME=rc-imon-mce
/sys/class/rc/rc0/uevent uevent DRV_NAME=imon
input device is /dev/input/event5
/sys/class/rc/rc0/protocols protocol rc-6 (enabled)
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Input sysfs node is /sys/class/rc/rc1/input17/
Event sysfs node is /sys/class/rc/rc1/input17/event11/
Parsing uevent /sys/class/rc/rc1/input17/event11/uevent
/sys/class/rc/rc1/input17/event11/uevent uevent MAJOR=13
/sys/class/rc/rc1/input17/event11/uevent uevent MINOR=75
/sys/class/rc/rc1/input17/event11/uevent uevent DEVNAME=input/event11
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event11
/sys/class/rc/rc1/protocols protocol nec (disabled)
Found /sys/class/rc/rc1/ (/dev/input/event11) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Input sysfs node is /sys/class/rc/rc2/input19/
Event sysfs node is /sys/class/rc/rc2/input19/event16/
Parsing uevent /sys/class/rc/rc2/input19/event16/uevent
/sys/class/rc/rc2/input19/event16/uevent uevent MAJOR=13
/sys/class/rc/rc2/input19/event16/uevent uevent MINOR=80
/sys/class/rc/rc2/input19/event16/uevent uevent DEVNAME=input/event16
Parsing uevent /sys/class/rc/rc2/uevent
/sys/class/rc/rc2/uevent uevent NAME=rc-empty
/sys/class/rc/rc2/uevent uevent DRV_NAME=dvb_usb_af9035
input device is /dev/input/event16
/sys/class/rc/rc2/protocols protocol nec (disabled)
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

So only rc0 has any protocols enabled. Let's try to enable nec on rc1

$ sudo /usr/bin/ir-keytable -s rc1 -c
Old keytable cleared
$ sudo /usr/bin/ir-keytable -s rc1 -w /etc/rc_keymaps/dvico-remote
Read dvico_mce table
Wrote 45 keycode(s) to driver
Invalid protocols selected
Couldn't change the IR protocols
$ sudo /usr/bin/ir-keytable -s rc1 -p nec -v
Found device /sys/class/rc/rc0/
Found device /sys/class/rc/rc1/
Found device /sys/class/rc/rc2/
Input sysfs node is /sys/class/rc/rc1/input17/
Event sysfs node is /sys/class/rc/rc1/input17/event11/
Parsing uevent /sys/class/rc/rc1/input17/event11/uevent
/sys/class/rc/rc1/input17/event11/uevent uevent MAJOR=13
/sys/class/rc/rc1/input17/event11/uevent uevent MINOR=75
/sys/class/rc/rc1/input17/event11/uevent uevent DEVNAME=input/event11
Parsing uevent /sys/class/rc/rc1/uevent
/sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
/sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
input device is /dev/input/event11
/sys/class/rc/rc1/protocols protocol nec (disabled)
Opening /dev/input/event11
Input Protocol version: 0x00010001
/sys/class/rc/rc1//protocols: Invalid argument
Couldn't change the IR protocols

$ sudo cat /sys/class/rc/rc1/protocols
nec
$ sudo sh
# echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +xmp" >
/sys/class/rc/rc1/protocols
bash: echo: write error: Invalid argument
# cat  /sys/class/rc/rc1/protocols
nec
In kern.log I got:
kernel: [ 2293.491534] rc_core: Normal protocol change requested
kernel: [ 2293.491538] rc_core: Protocol switching not supported

# echo "+nec" > /sys/class/rc/rc1/protocols
bash: echo: write error: Invalid argument
kernel: [ 2390.832476] rc_core: Normal protocol change requested
kernel: [ 2390.832481] rc_core: Protocol switching not supported

dmesg during bootup is attached.
Cheers
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-16 13:05                                         ` Vincent McIntyre
@ 2017-02-16 13:07                                           ` Vincent McIntyre
  2017-02-20 17:13                                           ` Sean Young
  1 sibling, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-16 13:07 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

[-- Attachment #1: Type: text/plain, Size: 13 bytes --]

The dmesg...

[-- Attachment #2: dmesg.txt.gz --]
[-- Type: application/x-gzip, Size: 20951 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-16 13:05                                         ` Vincent McIntyre
  2017-02-16 13:07                                           ` Vincent McIntyre
@ 2017-02-20 17:13                                           ` Sean Young
  2017-02-21 13:07                                             ` Vincent McIntyre
  1 sibling, 1 reply; 30+ messages in thread
From: Sean Young @ 2017-02-20 17:13 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

Hi Vincent,

Thanks for testing this.

On Fri, Feb 17, 2017 at 12:05:50AM +1100, Vincent McIntyre wrote:
> Hi again
> 
> after you kindly fixed media_build for me I applied the nec protocol
> patch and tried again.
> 
> $ sudo ir-keytable
> Found /sys/class/rc/rc0/ (/dev/input/event5) with:
>         Driver imon, table rc-imon-mce
>         Supported protocols: rc-6
>         Enabled protocols: rc-6
>         Name: iMON Remote (15c2:ffdc)
>         bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc1/ (/dev/input/event11) with:
>         Driver dvb_usb_cxusb, table rc-dvico-mce
>         Supported protocols: nec
>         Enabled protocols:
>         Name: IR-receiver inside an USB DVB re
>         bus: 3, vendor/product: 0fe9:db78, version: 0x827b
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
>         Driver dvb_usb_af9035, table rc-empty
>         Supported protocols: nec
>         Enabled protocols:
>         Name: Leadtek WinFast DTV Dongle Dual
>         bus: 3, vendor/product: 0413:6a05, version: 0x0200
>         Repeat delay = 500 ms, repeat period = 125 ms
> 
> $ sudo ir-keytable -v --sysdev rc1
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc0/input8/
> Event sysfs node is /sys/class/rc/rc0/input8/event5/
> Parsing uevent /sys/class/rc/rc0/input8/event5/uevent
> /sys/class/rc/rc0/input8/event5/uevent uevent MAJOR=13
> /sys/class/rc/rc0/input8/event5/uevent uevent MINOR=69
> /sys/class/rc/rc0/input8/event5/uevent uevent DEVNAME=input/event5
> Parsing uevent /sys/class/rc/rc0/uevent
> /sys/class/rc/rc0/uevent uevent NAME=rc-imon-mce
> /sys/class/rc/rc0/uevent uevent DRV_NAME=imon
> input device is /dev/input/event5
> /sys/class/rc/rc0/protocols protocol rc-6 (enabled)
> Found /sys/class/rc/rc0/ (/dev/input/event5) with:
>         Driver imon, table rc-imon-mce
>         Supported protocols: rc-6
>         Enabled protocols: rc-6
>         Name: iMON Remote (15c2:ffdc)
>         bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>         Repeat delay = 500 ms, repeat period = 125 ms
> Input sysfs node is /sys/class/rc/rc1/input17/
> Event sysfs node is /sys/class/rc/rc1/input17/event11/
> Parsing uevent /sys/class/rc/rc1/input17/event11/uevent
> /sys/class/rc/rc1/input17/event11/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input17/event11/uevent uevent MINOR=75
> /sys/class/rc/rc1/input17/event11/uevent uevent DEVNAME=input/event11
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event11
> /sys/class/rc/rc1/protocols protocol nec (disabled)
> Found /sys/class/rc/rc1/ (/dev/input/event11) with:
>         Driver dvb_usb_cxusb, table rc-dvico-mce
>         Supported protocols: nec
>         Enabled protocols:
>         Name: IR-receiver inside an USB DVB re
>         bus: 3, vendor/product: 0fe9:db78, version: 0x827b
>         Repeat delay = 500 ms, repeat period = 125 ms
> Input sysfs node is /sys/class/rc/rc2/input19/
> Event sysfs node is /sys/class/rc/rc2/input19/event16/
> Parsing uevent /sys/class/rc/rc2/input19/event16/uevent
> /sys/class/rc/rc2/input19/event16/uevent uevent MAJOR=13
> /sys/class/rc/rc2/input19/event16/uevent uevent MINOR=80
> /sys/class/rc/rc2/input19/event16/uevent uevent DEVNAME=input/event16
> Parsing uevent /sys/class/rc/rc2/uevent
> /sys/class/rc/rc2/uevent uevent NAME=rc-empty
> /sys/class/rc/rc2/uevent uevent DRV_NAME=dvb_usb_af9035
> input device is /dev/input/event16
> /sys/class/rc/rc2/protocols protocol nec (disabled)
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
>         Driver dvb_usb_af9035, table rc-empty
>         Supported protocols: nec
>         Enabled protocols:
>         Name: Leadtek WinFast DTV Dongle Dual
>         bus: 3, vendor/product: 0413:6a05, version: 0x0200
>         Repeat delay = 500 ms, repeat period = 125 ms
> 
> So only rc0 has any protocols enabled. Let's try to enable nec on rc1
> 
> $ sudo /usr/bin/ir-keytable -s rc1 -c
> Old keytable cleared
> $ sudo /usr/bin/ir-keytable -s rc1 -w /etc/rc_keymaps/dvico-remote
> Read dvico_mce table
> Wrote 45 keycode(s) to driver
> Invalid protocols selected
> Couldn't change the IR protocols
> $ sudo /usr/bin/ir-keytable -s rc1 -p nec -v
> Found device /sys/class/rc/rc0/
> Found device /sys/class/rc/rc1/
> Found device /sys/class/rc/rc2/
> Input sysfs node is /sys/class/rc/rc1/input17/
> Event sysfs node is /sys/class/rc/rc1/input17/event11/
> Parsing uevent /sys/class/rc/rc1/input17/event11/uevent
> /sys/class/rc/rc1/input17/event11/uevent uevent MAJOR=13
> /sys/class/rc/rc1/input17/event11/uevent uevent MINOR=75
> /sys/class/rc/rc1/input17/event11/uevent uevent DEVNAME=input/event11
> Parsing uevent /sys/class/rc/rc1/uevent
> /sys/class/rc/rc1/uevent uevent NAME=rc-dvico-mce
> /sys/class/rc/rc1/uevent uevent DRV_NAME=dvb_usb_cxusb
> input device is /dev/input/event11
> /sys/class/rc/rc1/protocols protocol nec (disabled)
> Opening /dev/input/event11
> Input Protocol version: 0x00010001
> /sys/class/rc/rc1//protocols: Invalid argument
> Couldn't change the IR protocols

On the cxusb the protocol is now nec, and that is the only protocol it
supports, you can't change it.

> $ sudo cat /sys/class/rc/rc1/protocols
> nec
> $ sudo sh
> # echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +xmp" >
> /sys/class/rc/rc1/protocols
> bash: echo: write error: Invalid argument
> # cat  /sys/class/rc/rc1/protocols
> nec
> In kern.log I got:
> kernel: [ 2293.491534] rc_core: Normal protocol change requested
> kernel: [ 2293.491538] rc_core: Protocol switching not supported
> 
> # echo "+nec" > /sys/class/rc/rc1/protocols
> bash: echo: write error: Invalid argument
> kernel: [ 2390.832476] rc_core: Normal protocol change requested
> kernel: [ 2390.832481] rc_core: Protocol switching not supported

That is expected. Does the the keymap actually work? 

ir-keytable -r -t

Thanks,

Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-20 17:13                                           ` Sean Young
@ 2017-02-21 13:07                                             ` Vincent McIntyre
  2017-02-21 18:32                                               ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-21 13:07 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On 2/21/17, Sean Young <sean@mess.org> wrote:
> Hi Vincent,
>
...
>
> On the cxusb the protocol is now nec, and that is the only protocol it
> supports, you can't change it.
>

doh! ok well that's all good then.

>> $ sudo cat /sys/class/rc/rc1/protocols
>> nec
>> $ sudo sh
>> # echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +xmp" >
>> /sys/class/rc/rc1/protocols
>> bash: echo: write error: Invalid argument
>> # cat  /sys/class/rc/rc1/protocols
>> nec
>> In kern.log I got:
>> kernel: [ 2293.491534] rc_core: Normal protocol change requested
>> kernel: [ 2293.491538] rc_core: Protocol switching not supported
>>
>> # echo "+nec" > /sys/class/rc/rc1/protocols
>> bash: echo: write error: Invalid argument
>> kernel: [ 2390.832476] rc_core: Normal protocol change requested
>> kernel: [ 2390.832481] rc_core: Protocol switching not supported
>
> That is expected. Does the the keymap actually work?
>
> ir-keytable -r -t

Kind of important information, yes. Answer: not sure. I can see it
receiving something but none of the keys I pressed caused any reaction
on the application (mythtv)

# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event11) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

# ir-keytable -r -t -d /dev/input/event11
scancode 0xfe01 = KEY_R (0x13)
scancode 0xfe02 = KEY_TV (0x179)
scancode 0xfe03 = KEY_0 (0x0b)
scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
scancode 0xfe07 = KEY_4 (0x05)
scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
scancode 0xfe0a = KEY_EPG (0x16d)
scancode 0xfe0b = KEY_1 (0x02)
scancode 0xfe0d = KEY_ESC (0x01)
scancode 0xfe0e = KEY_MP3 (0x187)
scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
scancode 0xfe11 = KEY_CHANNELUP (0x192)
scancode 0xfe12 = KEY_NEXTSONG (0xa3)
scancode 0xfe13 = KEY_ANGLE (0x173)
scancode 0xfe15 = KEY_VOLUMEUP (0x73)
scancode 0xfe16 = KEY_SETUP (0x8d)
scancode 0xfe17 = KEY_2 (0x03)
scancode 0xfe19 = KEY_OPEN (0x86)
scancode 0xfe1a = KEY_DVD (0x185)
scancode 0xfe1b = KEY_3 (0x04)
scancode 0xfe1e = KEY_FAVORITES (0x16c)
scancode 0xfe1f = KEY_ZOOM (0x174)
scancode 0xfe42 = KEY_ENTER (0x1c)
scancode 0xfe43 = KEY_REWIND (0xa8)
scancode 0xfe46 = KEY_POWER2 (0x164)
scancode 0xfe47 = KEY_P (0x19)
scancode 0xfe48 = KEY_7 (0x08)
scancode 0xfe49 = KEY_ESC (0x01)
scancode 0xfe4c = KEY_8 (0x09)
scancode 0xfe4d = KEY_M (0x32)
scancode 0xfe4e = KEY_POWER (0x74)
scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
scancode 0xfe50 = KEY_5 (0x06)
scancode 0xfe51 = KEY_UP (0x67)
scancode 0xfe52 = KEY_CAMERA (0xd4)
scancode 0xfe53 = KEY_DOWN (0x6c)
scancode 0xfe54 = KEY_6 (0x07)
scancode 0xfe55 = KEY_TAB (0x0f)
scancode 0xfe57 = KEY_MUTE (0x71)
scancode 0xfe58 = KEY_9 (0x0a)
scancode 0xfe59 = KEY_INFO (0x166)
scancode 0xfe5a = KEY_TUNER (0x182)
scancode 0xfe5b = KEY_LEFT (0x69)
scancode 0xfe5e = KEY_ENTER (0x1c)
scancode 0xfe5f = KEY_RIGHT (0x6a)
Enabled protocols: other sony nec sanyo mce-kbd rc-6 sharp xmp
Testing events. Please, press CTRL-C to abort.
  # pressed '1' key
1487676458.742329: event type EV_MSC(0x04): scancode = 0xffff010b
1487676458.742329: event type EV_SYN(0x00).
  # '2'
1487676481.742284: event type EV_MSC(0x04): scancode = 0xffff0117
1487676481.742284: event type EV_SYN(0x00).
  # '8'
1487676504.842250: event type EV_MSC(0x04): scancode = 0xffff014c
1487676504.842250: event type EV_SYN(0x00).
  # '9'
1487676506.542243: event type EV_MSC(0x04): scancode = 0xffff0158
1487676506.542243: event type EV_SYN(0x00).
  # right-arrow
1487676551.942312: event type EV_MSC(0x04): scancode = 0xffff015f
1487676551.942312: event type EV_SYN(0x00).
  # vol down
1487676637.746348: event type EV_MSC(0x04): scancode = 0xffff0105
1487676637.746348: event type EV_SYN(0x00).
  # vol up
1487676642.746321: event type EV_MSC(0x04): scancode = 0xffff0115
1487676642.746321: event type EV_SYN(0x00).

# cat /sys/class/rc/rc1/protocols
nec

All the above was done with the system booted with this in /etc/rc.local
/usr/bin/ir-keytable -s rc1 -c
/usr/bin/ir-keytable -s rc1 -w /etc/rc_keymaps/dvico-remote

After I disabled the rc.local script and rebooted:
# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event10) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

# ir-keytable -r -t -d /dev/input/event15
scancode 0x0101 = KEY_RECORD (0xa7)
scancode 0x0102 = KEY_TV (0x179)
scancode 0x0103 = KEY_0 (0x0b)
scancode 0x0105 = KEY_VOLUMEDOWN (0x72)
scancode 0x0107 = KEY_4 (0x05)
scancode 0x0109 = KEY_CHANNELDOWN (0x193)
scancode 0x010a = KEY_EPG (0x16d)
scancode 0x010b = KEY_1 (0x02)
scancode 0x010d = KEY_STOP (0x80)
scancode 0x010e = KEY_MP3 (0x187)
scancode 0x010f = KEY_PREVIOUSSONG (0xa5)
scancode 0x0111 = KEY_CHANNELUP (0x192)
scancode 0x0112 = KEY_NEXTSONG (0xa3)
scancode 0x0113 = KEY_ANGLE (0x173)
scancode 0x0115 = KEY_VOLUMEUP (0x73)
scancode 0x0116 = KEY_SETUP (0x8d)
scancode 0x0117 = KEY_2 (0x03)
scancode 0x0119 = KEY_OPEN (0x86)
scancode 0x011a = KEY_DVD (0x185)
scancode 0x011b = KEY_3 (0x04)
scancode 0x011e = KEY_FAVORITES (0x16c)
scancode 0x011f = KEY_ZOOM (0x174)
scancode 0x0142 = KEY_ENTER (0x1c)
scancode 0x0143 = KEY_REWIND (0xa8)
scancode 0x0146 = KEY_POWER2 (0x164)
scancode 0x0147 = KEY_PLAYPAUSE (0xa4)
scancode 0x0148 = KEY_7 (0x08)
scancode 0x0149 = KEY_BACK (0x9e)
scancode 0x014c = KEY_8 (0x09)
scancode 0x014d = KEY_MENU (0x8b)
scancode 0x014e = KEY_POWER (0x74)
scancode 0x014f = KEY_FASTFORWARD (0xd0)
scancode 0x0150 = KEY_5 (0x06)
scancode 0x0151 = KEY_UP (0x67)
scancode 0x0152 = KEY_CAMERA (0xd4)
scancode 0x0153 = KEY_DOWN (0x6c)
scancode 0x0154 = KEY_6 (0x07)
scancode 0x0155 = KEY_TAB (0x0f)
scancode 0x0157 = KEY_MUTE (0x71)
scancode 0x0158 = KEY_9 (0x0a)
scancode 0x0159 = KEY_INFO (0x166)
scancode 0x015a = KEY_TUNER (0x182)
scancode 0x015b = KEY_LEFT (0x69)
scancode 0x015e = KEY_OK (0x160)
scancode 0x015f = KEY_RIGHT (0x6a)
Enabled protocols: other jvc sanyo mce-kbd rc-6 sharp xmp
Testing events. Please, press CTRL-C to abort.

 # '1'
1487682068.360565: event type EV_MSC(0x04): scancode = 0xffff010b
1487682068.360565: event type EV_SYN(0x00).
 # '2'
1487682091.293030: event type EV_MSC(0x04): scancode = 0xffff0117
1487682091.293030: event type EV_SYN(0x00).
 # '8'
1487682105.276940: event type EV_MSC(0x04): scancode = 0xffff014c
1487682105.276940: event type EV_SYN(0x00).
 # '9'
1487682121.489049: event type EV_MSC(0x04): scancode = 0xffff0158
1487682121.489049: event type EV_SYN(0x00).
 # vol_down
1487682143.577013: event type EV_MSC(0x04): scancode = 0xffff0105
1487682143.577013: event type EV_SYN(0x00).
 # vol_up
1487682155.736905: event type EV_MSC(0x04): scancode = 0xffff0115
1487682155.736905: event type EV_SYN(0x00).
 # down arrow
1487682175.924965: event type EV_MSC(0x04): scancode = 0xffff0153
1487682175.924965: event type EV_SYN(0x00).

# cat /sys/class/rc/rc1/protocols
nec

When I try to enable the nec protocol I get this:
# ir-keytable  -d /dev/input/event15 -p nec -t -r
Invalid protocols selected
Couldn't change the IR protocols

Hopefully all this stumbling in the dark is somewhat informative...
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-21 13:07                                             ` Vincent McIntyre
@ 2017-02-21 18:32                                               ` Sean Young
  2017-02-24 15:08                                                 ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2017-02-21 18:32 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

[-- Attachment #1: Type: text/plain, Size: 14491 bytes --]

On Wed, Feb 22, 2017 at 12:07:07AM +1100, Vincent McIntyre wrote:
> On 2/21/17, Sean Young <sean@mess.org> wrote:
> >> $ sudo cat /sys/class/rc/rc1/protocols
> >> nec
> >> $ sudo sh
> >> # echo "+rc-5 +nec +rc-6 +jvc +sony +rc-5-sz +sanyo +sharp +xmp" >
> >> /sys/class/rc/rc1/protocols
> >> bash: echo: write error: Invalid argument
> >> # cat  /sys/class/rc/rc1/protocols
> >> nec
> >> In kern.log I got:
> >> kernel: [ 2293.491534] rc_core: Normal protocol change requested
> >> kernel: [ 2293.491538] rc_core: Protocol switching not supported
> >>
> >> # echo "+nec" > /sys/class/rc/rc1/protocols
> >> bash: echo: write error: Invalid argument
> >> kernel: [ 2390.832476] rc_core: Normal protocol change requested
> >> kernel: [ 2390.832481] rc_core: Protocol switching not supported
> >
> > That is expected. Does the the keymap actually work?
> >
> > ir-keytable -r -t
> 
> Kind of important information, yes. Answer: not sure. I can see it
> receiving something but none of the keys I pressed caused any reaction
> on the application (mythtv)
> 
> # ir-keytable
> Found /sys/class/rc/rc0/ (/dev/input/event5) with:
>         Driver imon, table rc-imon-mce
>         Supported protocols: rc-6
>         Enabled protocols: rc-6
>         Name: iMON Remote (15c2:ffdc)
>         bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc1/ (/dev/input/event11) with:
>         Driver dvb_usb_cxusb, table rc-dvico-mce
>         Supported protocols: nec
>         Enabled protocols:
>         Name: IR-receiver inside an USB DVB re
>         bus: 3, vendor/product: 0fe9:db78, version: 0x827b
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
>         Driver dvb_usb_af9035, table rc-empty
>         Supported protocols: nec
>         Enabled protocols:
>         Name: Leadtek WinFast DTV Dongle Dual
>         bus: 3, vendor/product: 0413:6a05, version: 0x0200
>         Repeat delay = 500 ms, repeat period = 125 ms
> 
> # ir-keytable -r -t -d /dev/input/event11
> scancode 0xfe01 = KEY_R (0x13)
> scancode 0xfe02 = KEY_TV (0x179)
> scancode 0xfe03 = KEY_0 (0x0b)
> scancode 0xfe05 = KEY_VOLUMEDOWN (0x72)
> scancode 0xfe07 = KEY_4 (0x05)
> scancode 0xfe09 = KEY_CHANNELDOWN (0x193)
> scancode 0xfe0a = KEY_EPG (0x16d)
> scancode 0xfe0b = KEY_1 (0x02)
> scancode 0xfe0d = KEY_ESC (0x01)
> scancode 0xfe0e = KEY_MP3 (0x187)
> scancode 0xfe0f = KEY_PREVIOUSSONG (0xa5)
> scancode 0xfe11 = KEY_CHANNELUP (0x192)
> scancode 0xfe12 = KEY_NEXTSONG (0xa3)
> scancode 0xfe13 = KEY_ANGLE (0x173)
> scancode 0xfe15 = KEY_VOLUMEUP (0x73)
> scancode 0xfe16 = KEY_SETUP (0x8d)
> scancode 0xfe17 = KEY_2 (0x03)
> scancode 0xfe19 = KEY_OPEN (0x86)
> scancode 0xfe1a = KEY_DVD (0x185)
> scancode 0xfe1b = KEY_3 (0x04)
> scancode 0xfe1e = KEY_FAVORITES (0x16c)
> scancode 0xfe1f = KEY_ZOOM (0x174)
> scancode 0xfe42 = KEY_ENTER (0x1c)
> scancode 0xfe43 = KEY_REWIND (0xa8)
> scancode 0xfe46 = KEY_POWER2 (0x164)
> scancode 0xfe47 = KEY_P (0x19)
> scancode 0xfe48 = KEY_7 (0x08)
> scancode 0xfe49 = KEY_ESC (0x01)
> scancode 0xfe4c = KEY_8 (0x09)
> scancode 0xfe4d = KEY_M (0x32)
> scancode 0xfe4e = KEY_POWER (0x74)
> scancode 0xfe4f = KEY_FASTFORWARD (0xd0)
> scancode 0xfe50 = KEY_5 (0x06)
> scancode 0xfe51 = KEY_UP (0x67)
> scancode 0xfe52 = KEY_CAMERA (0xd4)
> scancode 0xfe53 = KEY_DOWN (0x6c)
> scancode 0xfe54 = KEY_6 (0x07)
> scancode 0xfe55 = KEY_TAB (0x0f)
> scancode 0xfe57 = KEY_MUTE (0x71)
> scancode 0xfe58 = KEY_9 (0x0a)
> scancode 0xfe59 = KEY_INFO (0x166)
> scancode 0xfe5a = KEY_TUNER (0x182)
> scancode 0xfe5b = KEY_LEFT (0x69)
> scancode 0xfe5e = KEY_ENTER (0x1c)
> scancode 0xfe5f = KEY_RIGHT (0x6a)

So it's still using the old keymap. I've attached a new one.

> Enabled protocols: other sony nec sanyo mce-kbd rc-6 sharp xmp
> Testing events. Please, press CTRL-C to abort.
>   # pressed '1' key
> 1487676458.742329: event type EV_MSC(0x04): scancode = 0xffff010b
> 1487676458.742329: event type EV_SYN(0x00).
>   # '2'
> 1487676481.742284: event type EV_MSC(0x04): scancode = 0xffff0117
> 1487676481.742284: event type EV_SYN(0x00).
>   # '8'
> 1487676504.842250: event type EV_MSC(0x04): scancode = 0xffff014c
> 1487676504.842250: event type EV_SYN(0x00).
>   # '9'
> 1487676506.542243: event type EV_MSC(0x04): scancode = 0xffff0158
> 1487676506.542243: event type EV_SYN(0x00).
>   # right-arrow
> 1487676551.942312: event type EV_MSC(0x04): scancode = 0xffff015f
> 1487676551.942312: event type EV_SYN(0x00).
>   # vol down
> 1487676637.746348: event type EV_MSC(0x04): scancode = 0xffff0105
> 1487676637.746348: event type EV_SYN(0x00).
>   # vol up
> 1487676642.746321: event type EV_MSC(0x04): scancode = 0xffff0115
> 1487676642.746321: event type EV_SYN(0x00).

Oops, that's a bug. 0xffff should be 0x0000. I've attached a new version of the
patch which should fix that.


Sean

From: Sean Young <sean@mess.org>
Subject: [PATCH] [media] cxusb: dvico remotes are nec

Adjust the keymap to use the correct nec scancodes, and adjust the
rc driver to output the correct nec scancodes.

Now the keymap can be used with any nec receiver, and the rc device
should work with any nec keymap.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/keymaps/rc-dvico-mce.c      | 92 ++++++++++++++--------------
 drivers/media/rc/keymaps/rc-dvico-portable.c | 74 +++++++++++-----------
 drivers/media/usb/dvb-usb/cxusb.c            | 24 ++++----
 3 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/drivers/media/rc/keymaps/rc-dvico-mce.c b/drivers/media/rc/keymaps/rc-dvico-mce.c
index e5f098c..d1e861f 100644
--- a/drivers/media/rc/keymaps/rc-dvico-mce.c
+++ b/drivers/media/rc/keymaps/rc-dvico-mce.c
@@ -12,58 +12,58 @@
 #include <linux/module.h>
 
 static struct rc_map_table rc_map_dvico_mce_table[] = {
-	{ 0xfe02, KEY_TV },
-	{ 0xfe0e, KEY_MP3 },
-	{ 0xfe1a, KEY_DVD },
-	{ 0xfe1e, KEY_FAVORITES },
-	{ 0xfe16, KEY_SETUP },
-	{ 0xfe46, KEY_POWER2 },
-	{ 0xfe0a, KEY_EPG },
-	{ 0xfe49, KEY_BACK },
-	{ 0xfe4d, KEY_MENU },
-	{ 0xfe51, KEY_UP },
-	{ 0xfe5b, KEY_LEFT },
-	{ 0xfe5f, KEY_RIGHT },
-	{ 0xfe53, KEY_DOWN },
-	{ 0xfe5e, KEY_OK },
-	{ 0xfe59, KEY_INFO },
-	{ 0xfe55, KEY_TAB },
-	{ 0xfe0f, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfe12, KEY_NEXTSONG },	/* Skip */
-	{ 0xfe42, KEY_ENTER	 },	/* Windows/Start */
-	{ 0xfe15, KEY_VOLUMEUP },
-	{ 0xfe05, KEY_VOLUMEDOWN },
-	{ 0xfe11, KEY_CHANNELUP },
-	{ 0xfe09, KEY_CHANNELDOWN },
-	{ 0xfe52, KEY_CAMERA },
-	{ 0xfe5a, KEY_TUNER },	/* Live */
-	{ 0xfe19, KEY_OPEN },
-	{ 0xfe0b, KEY_1 },
-	{ 0xfe17, KEY_2 },
-	{ 0xfe1b, KEY_3 },
-	{ 0xfe07, KEY_4 },
-	{ 0xfe50, KEY_5 },
-	{ 0xfe54, KEY_6 },
-	{ 0xfe48, KEY_7 },
-	{ 0xfe4c, KEY_8 },
-	{ 0xfe58, KEY_9 },
-	{ 0xfe13, KEY_ANGLE },	/* Aspect */
-	{ 0xfe03, KEY_0 },
-	{ 0xfe1f, KEY_ZOOM },
-	{ 0xfe43, KEY_REWIND },
-	{ 0xfe47, KEY_PLAYPAUSE },
-	{ 0xfe4f, KEY_FASTFORWARD },
-	{ 0xfe57, KEY_MUTE },
-	{ 0xfe0d, KEY_STOP },
-	{ 0xfe01, KEY_RECORD },
-	{ 0xfe4e, KEY_POWER },
+	{ 0x0102, KEY_TV },
+	{ 0x010e, KEY_MP3 },
+	{ 0x011a, KEY_DVD },
+	{ 0x011e, KEY_FAVORITES },
+	{ 0x0116, KEY_SETUP },
+	{ 0x0146, KEY_POWER2 },
+	{ 0x010a, KEY_EPG },
+	{ 0x0149, KEY_BACK },
+	{ 0x014d, KEY_MENU },
+	{ 0x0151, KEY_UP },
+	{ 0x015b, KEY_LEFT },
+	{ 0x015f, KEY_RIGHT },
+	{ 0x0153, KEY_DOWN },
+	{ 0x015e, KEY_OK },
+	{ 0x0159, KEY_INFO },
+	{ 0x0155, KEY_TAB },
+	{ 0x010f, KEY_PREVIOUSSONG },/* Replay */
+	{ 0x0112, KEY_NEXTSONG },	/* Skip */
+	{ 0x0142, KEY_ENTER	 },	/* Windows/Start */
+	{ 0x0115, KEY_VOLUMEUP },
+	{ 0x0105, KEY_VOLUMEDOWN },
+	{ 0x0111, KEY_CHANNELUP },
+	{ 0x0109, KEY_CHANNELDOWN },
+	{ 0x0152, KEY_CAMERA },
+	{ 0x015a, KEY_TUNER },	/* Live */
+	{ 0x0119, KEY_OPEN },
+	{ 0x010b, KEY_1 },
+	{ 0x0117, KEY_2 },
+	{ 0x011b, KEY_3 },
+	{ 0x0107, KEY_4 },
+	{ 0x0150, KEY_5 },
+	{ 0x0154, KEY_6 },
+	{ 0x0148, KEY_7 },
+	{ 0x014c, KEY_8 },
+	{ 0x0158, KEY_9 },
+	{ 0x0113, KEY_ANGLE },	/* Aspect */
+	{ 0x0103, KEY_0 },
+	{ 0x011f, KEY_ZOOM },
+	{ 0x0143, KEY_REWIND },
+	{ 0x0147, KEY_PLAYPAUSE },
+	{ 0x014f, KEY_FASTFORWARD },
+	{ 0x0157, KEY_MUTE },
+	{ 0x010d, KEY_STOP },
+	{ 0x0101, KEY_RECORD },
+	{ 0x014e, KEY_POWER },
 };
 
 static struct rc_map_list dvico_mce_map = {
 	.map = {
 		.scan    = rc_map_dvico_mce_table,
 		.size    = ARRAY_SIZE(rc_map_dvico_mce_table),
-		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.rc_type = RC_TYPE_NEC,
 		.name    = RC_MAP_DVICO_MCE,
 	}
 };
diff --git a/drivers/media/rc/keymaps/rc-dvico-portable.c b/drivers/media/rc/keymaps/rc-dvico-portable.c
index 94ceeee..ac4cb51 100644
--- a/drivers/media/rc/keymaps/rc-dvico-portable.c
+++ b/drivers/media/rc/keymaps/rc-dvico-portable.c
@@ -12,49 +12,49 @@
 #include <linux/module.h>
 
 static struct rc_map_table rc_map_dvico_portable_table[] = {
-	{ 0xfc02, KEY_SETUP },       /* Profile */
-	{ 0xfc43, KEY_POWER2 },
-	{ 0xfc06, KEY_EPG },
-	{ 0xfc5a, KEY_BACK },
-	{ 0xfc05, KEY_MENU },
-	{ 0xfc47, KEY_INFO },
-	{ 0xfc01, KEY_TAB },
-	{ 0xfc42, KEY_PREVIOUSSONG },/* Replay */
-	{ 0xfc49, KEY_VOLUMEUP },
-	{ 0xfc09, KEY_VOLUMEDOWN },
-	{ 0xfc54, KEY_CHANNELUP },
-	{ 0xfc0b, KEY_CHANNELDOWN },
-	{ 0xfc16, KEY_CAMERA },
-	{ 0xfc40, KEY_TUNER },	/* ATV/DTV */
-	{ 0xfc45, KEY_OPEN },
-	{ 0xfc19, KEY_1 },
-	{ 0xfc18, KEY_2 },
-	{ 0xfc1b, KEY_3 },
-	{ 0xfc1a, KEY_4 },
-	{ 0xfc58, KEY_5 },
-	{ 0xfc59, KEY_6 },
-	{ 0xfc15, KEY_7 },
-	{ 0xfc14, KEY_8 },
-	{ 0xfc17, KEY_9 },
-	{ 0xfc44, KEY_ANGLE },	/* Aspect */
-	{ 0xfc55, KEY_0 },
-	{ 0xfc07, KEY_ZOOM },
-	{ 0xfc0a, KEY_REWIND },
-	{ 0xfc08, KEY_PLAYPAUSE },
-	{ 0xfc4b, KEY_FASTFORWARD },
-	{ 0xfc5b, KEY_MUTE },
-	{ 0xfc04, KEY_STOP },
-	{ 0xfc56, KEY_RECORD },
-	{ 0xfc57, KEY_POWER },
-	{ 0xfc41, KEY_UNKNOWN },    /* INPUT */
-	{ 0xfc00, KEY_UNKNOWN },    /* HD */
+	{ 0x0302, KEY_SETUP },       /* Profile */
+	{ 0x0343, KEY_POWER2 },
+	{ 0x0306, KEY_EPG },
+	{ 0x035a, KEY_BACK },
+	{ 0x0305, KEY_MENU },
+	{ 0x0347, KEY_INFO },
+	{ 0x0301, KEY_TAB },
+	{ 0x0342, KEY_PREVIOUSSONG },/* Replay */
+	{ 0x0349, KEY_VOLUMEUP },
+	{ 0x0309, KEY_VOLUMEDOWN },
+	{ 0x0354, KEY_CHANNELUP },
+	{ 0x030b, KEY_CHANNELDOWN },
+	{ 0x0316, KEY_CAMERA },
+	{ 0x0340, KEY_TUNER },	/* ATV/DTV */
+	{ 0x0345, KEY_OPEN },
+	{ 0x0319, KEY_1 },
+	{ 0x0318, KEY_2 },
+	{ 0x031b, KEY_3 },
+	{ 0x031a, KEY_4 },
+	{ 0x0358, KEY_5 },
+	{ 0x0359, KEY_6 },
+	{ 0x0315, KEY_7 },
+	{ 0x0314, KEY_8 },
+	{ 0x0317, KEY_9 },
+	{ 0x0344, KEY_ANGLE },	/* Aspect */
+	{ 0x0355, KEY_0 },
+	{ 0x0307, KEY_ZOOM },
+	{ 0x030a, KEY_REWIND },
+	{ 0x0308, KEY_PLAYPAUSE },
+	{ 0x034b, KEY_FASTFORWARD },
+	{ 0x035b, KEY_MUTE },
+	{ 0x0304, KEY_STOP },
+	{ 0x0356, KEY_RECORD },
+	{ 0x0357, KEY_POWER },
+	{ 0x0341, KEY_UNKNOWN },    /* INPUT */
+	{ 0x0300, KEY_UNKNOWN },    /* HD */
 };
 
 static struct rc_map_list dvico_portable_map = {
 	.map = {
 		.scan    = rc_map_dvico_portable_table,
 		.size    = ARRAY_SIZE(rc_map_dvico_portable_table),
-		.rc_type = RC_TYPE_UNKNOWN,	/* Legacy IR type */
+		.rc_type = RC_TYPE_NEC,
 		.name    = RC_MAP_DVICO_PORTABLE,
 	}
 };
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index 5d7b4ea..d4a80fc 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -457,8 +457,8 @@ static int cxusb_rc_query(struct dvb_usb_device *d)
 	cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4);
 
 	if (ircode[2] || ircode[3])
-		rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
-			   RC_SCANCODE_RC5(ircode[2], ircode[3]), 0);
+		rc_keydown(d->rc_dev, RC_TYPE_NEC,
+			   RC_SCANCODE_NEC(~ircode[2] & 0xff, ircode[3]), 0);
 	return 0;
 }
 
@@ -472,8 +472,8 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d)
 		return 0;
 
 	if (ircode[1] || ircode[2])
-		rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN,
-			   RC_SCANCODE_RC5(ircode[1], ircode[2]), 0);
+		rc_keydown(d->rc_dev, RC_TYPE_NEC,
+			   RC_SCANCODE_NEC(~ircode[1] & 0xff, ircode[2]), 0);
 	return 0;
 }
 
@@ -1562,7 +1562,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
 		.rc_codes	= RC_MAP_DVICO_PORTABLE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1619,7 +1619,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
 		.rc_codes	= RC_MAP_DVICO_MCE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1684,7 +1684,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
 		.rc_codes	= RC_MAP_DVICO_PORTABLE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1740,7 +1740,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
 		.rc_codes	= RC_MAP_DVICO_PORTABLE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.generic_bulk_ctrl_endpoint = 0x01,
@@ -1795,7 +1795,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = {
 		.rc_codes	= RC_MAP_DVICO_MCE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_bluebird2_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.num_device_descs = 1,
@@ -1849,7 +1849,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = {
 		.rc_codes	= RC_MAP_DVICO_PORTABLE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query       = cxusb_bluebird2_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.num_device_descs = 1,
@@ -1905,7 +1905,7 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope
 		.rc_codes	= RC_MAP_DVICO_PORTABLE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.num_device_descs = 1,
@@ -2004,7 +2004,7 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = {
 		.rc_codes	= RC_MAP_DVICO_MCE,
 		.module_name	= KBUILD_MODNAME,
 		.rc_query	= cxusb_rc_query,
-		.allowed_protos = RC_BIT_UNKNOWN,
+		.allowed_protos = RC_BIT_NEC,
 	},
 
 	.num_device_descs = 1,
-- 
2.9.3


[-- Attachment #2: dvico_mce --]
[-- Type: text/plain, Size: 774 bytes --]

# table dvico_mce, type: NEC
0x0102 KEY_TV
0x010e KEY_MP3
0x011a KEY_DVD
0x011e KEY_FAVORITES
0x0116 KEY_SETUP
0x0146 KEY_POWER2
0x010a KEY_EPG
0x0149 KEY_BACK
0x014d KEY_MENU
0x0151 KEY_UP
0x015b KEY_LEFT
0x015f KEY_RIGHT
0x0153 KEY_DOWN
0x015e KEY_OK
0x0159 KEY_INFO
0x0155 KEY_TAB
0x010f KEY_PREVIOUSSONG
0x0112 KEY_NEXTSONG
0x0142 KEY_ENTER
0x0115 KEY_VOLUMEUP
0x0105 KEY_VOLUMEDOWN
0x0111 KEY_CHANNELUP
0x0109 KEY_CHANNELDOWN
0x0152 KEY_CAMERA
0x015a KEY_TUNER
0x0119 KEY_OPEN
0x010b KEY_1
0x0117 KEY_2
0x011b KEY_3
0x0107 KEY_4
0x0150 KEY_5
0x0154 KEY_6
0x0148 KEY_7
0x014c KEY_8
0x0158 KEY_9
0x0113 KEY_ANGLE
0x0103 KEY_0
0x011f KEY_ZOOM
0x0143 KEY_REWIND
0x0147 KEY_PLAYPAUSE
0x014f KEY_FASTFORWARD
0x0157 KEY_MUTE
0x010d KEY_STOP
0x0101 KEY_RECORD
0x014e KEY_POWER

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-21 18:32                                               ` Sean Young
@ 2017-02-24 15:08                                                 ` Vincent McIntyre
  2017-02-28 22:15                                                   ` Sean Young
  0 siblings, 1 reply; 30+ messages in thread
From: Vincent McIntyre @ 2017-02-24 15:08 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On 2/22/17, Sean Young <sean@mess.org> wrote:

> So it's still using the old keymap. I've attached a new one.

That works, thanks.

>>   # vol down
>> 1487676637.746348: event type EV_MSC(0x04): scancode = 0xffff0105
>> 1487676637.746348: event type EV_SYN(0x00).
>>   # vol up
>> 1487676642.746321: event type EV_MSC(0x04): scancode = 0xffff0115
>> 1487676642.746321: event type EV_SYN(0x00).
>
> Oops, that's a bug. 0xffff should be 0x0000. I've attached a new version of
> the patch which should fix that.
>

I am still getting the high bits set. I checked the code and the patch
was correctly applied,
I see where you are applying a 0xff mask to the ircode values.


Test run:
# Found /sys/class/rc/rc0/ (/dev/input/event5) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

#  ir-keytable -r -t -d /dev/input/event15
scancode 0x0101 = KEY_RECORD (0xa7)
scancode 0x0102 = KEY_TV (0x179)
scancode 0x0103 = KEY_0 (0x0b)
scancode 0x0105 = KEY_VOLUMEDOWN (0x72)
scancode 0x0107 = KEY_4 (0x05)
scancode 0x0109 = KEY_CHANNELDOWN (0x193)
scancode 0x010a = KEY_EPG (0x16d)
scancode 0x010b = KEY_1 (0x02)
scancode 0x010d = KEY_STOP (0x80)
scancode 0x010e = KEY_MP3 (0x187)
scancode 0x010f = KEY_PREVIOUSSONG (0xa5)
scancode 0x0111 = KEY_CHANNELUP (0x192)
scancode 0x0112 = KEY_NEXTSONG (0xa3)
scancode 0x0113 = KEY_ANGLE (0x173)
scancode 0x0115 = KEY_VOLUMEUP (0x73)
scancode 0x0116 = KEY_SETUP (0x8d)
scancode 0x0117 = KEY_2 (0x03)
scancode 0x0119 = KEY_OPEN (0x86)
scancode 0x011a = KEY_DVD (0x185)
scancode 0x011b = KEY_3 (0x04)
scancode 0x011e = KEY_FAVORITES (0x16c)
scancode 0x011f = KEY_ZOOM (0x174)
scancode 0x0142 = KEY_ENTER (0x1c)
scancode 0x0143 = KEY_REWIND (0xa8)
scancode 0x0146 = KEY_POWER2 (0x164)
scancode 0x0147 = KEY_PLAYPAUSE (0xa4)
scancode 0x0148 = KEY_7 (0x08)
scancode 0x0149 = KEY_BACK (0x9e)
scancode 0x014c = KEY_8 (0x09)
scancode 0x014d = KEY_MENU (0x8b)
scancode 0x014e = KEY_POWER (0x74)
scancode 0x014f = KEY_FASTFORWARD (0xd0)
scancode 0x0150 = KEY_5 (0x06)
scancode 0x0151 = KEY_UP (0x67)
scancode 0x0152 = KEY_CAMERA (0xd4)
scancode 0x0153 = KEY_DOWN (0x6c)
scancode 0x0154 = KEY_6 (0x07)
scancode 0x0155 = KEY_TAB (0x0f)
scancode 0x0157 = KEY_MUTE (0x71)
scancode 0x0158 = KEY_9 (0x0a)
scancode 0x0159 = KEY_INFO (0x166)
scancode 0x015a = KEY_TUNER (0x182)
scancode 0x015b = KEY_LEFT (0x69)
scancode 0x015e = KEY_OK (0x160)
scancode 0x015f = KEY_RIGHT (0x6a)
Enabled protocols: other jvc sony nec sanyo mce-kbd rc-6 sharp xmp
Testing events. Please, press CTRL-C to abort.
 # '1'
1487948112.709532: event type EV_MSC(0x04): scancode = 0xffff010b
1487948112.709532: event type EV_SYN(0x00).
 # '2'
1487948137.229455: event type EV_MSC(0x04): scancode = 0xffff0117
1487948137.229455: event type EV_SYN(0x00).
 # '8'
1487948233.341489: event type EV_MSC(0x04): scancode = 0xffff014c
1487948233.341489: event type EV_SYN(0x00).
 # '9'
1487948248.417547: event type EV_MSC(0x04): scancode = 0xffff0158
1487948248.417547: event type EV_SYN(0x00).
 # volume_down
1487948270.537497: event type EV_MSC(0x04): scancode = 0xffff0105
1487948270.537497: event type EV_SYN(0x00).
 # volume_up
1487948464.425435: event type EV_MSC(0x04): scancode = 0xffff0115
1487948464.425435: event type EV_SYN(0x00).

Cheers
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-24 15:08                                                 ` Vincent McIntyre
@ 2017-02-28 22:15                                                   ` Sean Young
  2017-03-02 13:48                                                     ` Vincent McIntyre
  0 siblings, 1 reply; 30+ messages in thread
From: Sean Young @ 2017-02-28 22:15 UTC (permalink / raw)
  To: Vincent McIntyre; +Cc: linux-media

On Sat, Feb 25, 2017 at 02:08:39AM +1100, Vincent McIntyre wrote:
> On 2/22/17, Sean Young <sean@mess.org> wrote:
> 
> > So it's still using the old keymap. I've attached a new one.
> 
> That works, thanks.
> 
> >>   # vol down
> >> 1487676637.746348: event type EV_MSC(0x04): scancode = 0xffff0105
> >> 1487676637.746348: event type EV_SYN(0x00).
> >>   # vol up
> >> 1487676642.746321: event type EV_MSC(0x04): scancode = 0xffff0115
> >> 1487676642.746321: event type EV_SYN(0x00).
> >
> > Oops, that's a bug. 0xffff should be 0x0000. I've attached a new version of
> > the patch which should fix that.
> >
> 
> I am still getting the high bits set. I checked the code and the patch
> was correctly applied,
> I see where you are applying a 0xff mask to the ircode values.
> 
> 
> Test run:
> # Found /sys/class/rc/rc0/ (/dev/input/event5) with:
>         Driver imon, table rc-imon-mce
>         Supported protocols: rc-6
>         Enabled protocols: rc-6
>         Name: iMON Remote (15c2:ffdc)
>         bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc1/ (/dev/input/event15) with:
>         Driver dvb_usb_cxusb, table rc-dvico-mce
>         Supported protocols: nec
>         Enabled protocols:
>         Name: IR-receiver inside an USB DVB re
>         bus: 3, vendor/product: 0fe9:db78, version: 0x827b
>         Repeat delay = 500 ms, repeat period = 125 ms
> Found /sys/class/rc/rc2/ (/dev/input/event16) with:
>         Driver dvb_usb_af9035, table rc-empty
>         Supported protocols: nec
>         Enabled protocols:
>         Name: Leadtek WinFast DTV Dongle Dual
>         bus: 3, vendor/product: 0413:6a05, version: 0x0200
>         Repeat delay = 500 ms, repeat period = 125 ms
> 
> #  ir-keytable -r -t -d /dev/input/event15
> scancode 0x0101 = KEY_RECORD (0xa7)
> scancode 0x0102 = KEY_TV (0x179)
> scancode 0x0103 = KEY_0 (0x0b)
> scancode 0x0105 = KEY_VOLUMEDOWN (0x72)
> scancode 0x0107 = KEY_4 (0x05)
> scancode 0x0109 = KEY_CHANNELDOWN (0x193)
> scancode 0x010a = KEY_EPG (0x16d)
> scancode 0x010b = KEY_1 (0x02)
> scancode 0x010d = KEY_STOP (0x80)
> scancode 0x010e = KEY_MP3 (0x187)
> scancode 0x010f = KEY_PREVIOUSSONG (0xa5)
> scancode 0x0111 = KEY_CHANNELUP (0x192)
> scancode 0x0112 = KEY_NEXTSONG (0xa3)
> scancode 0x0113 = KEY_ANGLE (0x173)
> scancode 0x0115 = KEY_VOLUMEUP (0x73)
> scancode 0x0116 = KEY_SETUP (0x8d)
> scancode 0x0117 = KEY_2 (0x03)
> scancode 0x0119 = KEY_OPEN (0x86)
> scancode 0x011a = KEY_DVD (0x185)
> scancode 0x011b = KEY_3 (0x04)
> scancode 0x011e = KEY_FAVORITES (0x16c)
> scancode 0x011f = KEY_ZOOM (0x174)
> scancode 0x0142 = KEY_ENTER (0x1c)
> scancode 0x0143 = KEY_REWIND (0xa8)
> scancode 0x0146 = KEY_POWER2 (0x164)
> scancode 0x0147 = KEY_PLAYPAUSE (0xa4)
> scancode 0x0148 = KEY_7 (0x08)
> scancode 0x0149 = KEY_BACK (0x9e)
> scancode 0x014c = KEY_8 (0x09)
> scancode 0x014d = KEY_MENU (0x8b)
> scancode 0x014e = KEY_POWER (0x74)
> scancode 0x014f = KEY_FASTFORWARD (0xd0)
> scancode 0x0150 = KEY_5 (0x06)
> scancode 0x0151 = KEY_UP (0x67)
> scancode 0x0152 = KEY_CAMERA (0xd4)
> scancode 0x0153 = KEY_DOWN (0x6c)
> scancode 0x0154 = KEY_6 (0x07)
> scancode 0x0155 = KEY_TAB (0x0f)
> scancode 0x0157 = KEY_MUTE (0x71)
> scancode 0x0158 = KEY_9 (0x0a)
> scancode 0x0159 = KEY_INFO (0x166)
> scancode 0x015a = KEY_TUNER (0x182)
> scancode 0x015b = KEY_LEFT (0x69)
> scancode 0x015e = KEY_OK (0x160)
> scancode 0x015f = KEY_RIGHT (0x6a)
> Enabled protocols: other jvc sony nec sanyo mce-kbd rc-6 sharp xmp
> Testing events. Please, press CTRL-C to abort.
>  # '1'
> 1487948112.709532: event type EV_MSC(0x04): scancode = 0xffff010b
> 1487948112.709532: event type EV_SYN(0x00).
>  # '2'
> 1487948137.229455: event type EV_MSC(0x04): scancode = 0xffff0117
> 1487948137.229455: event type EV_SYN(0x00).
>  # '8'
> 1487948233.341489: event type EV_MSC(0x04): scancode = 0xffff014c
> 1487948233.341489: event type EV_SYN(0x00).
>  # '9'
> 1487948248.417547: event type EV_MSC(0x04): scancode = 0xffff0158
> 1487948248.417547: event type EV_SYN(0x00).
>  # volume_down
> 1487948270.537497: event type EV_MSC(0x04): scancode = 0xffff0105
> 1487948270.537497: event type EV_SYN(0x00).
>  # volume_up
> 1487948464.425435: event type EV_MSC(0x04): scancode = 0xffff0115
> 1487948464.425435: event type EV_SYN(0x00).

Sorry Vincent, but are you sure you're running the patch with the
& 0xff mask? That should have solved it.


Sean

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: ir-keytable: infinite loops, segfaults
  2017-02-28 22:15                                                   ` Sean Young
@ 2017-03-02 13:48                                                     ` Vincent McIntyre
  0 siblings, 0 replies; 30+ messages in thread
From: Vincent McIntyre @ 2017-03-02 13:48 UTC (permalink / raw)
  To: Sean Young; +Cc: linux-media

On 3/1/17, Sean Young <sean@mess.org> wrote:
>
> Sorry Vincent, but are you sure you're running the patch with the
> & 0xff mask? That should have solved it.
>

er, no. Some kind of build issue. Once I applied your media_build
patch and then the latest kernel patch you sent, this is what the test
run looks like.

# ir-keytable
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
        Driver imon, table rc-imon-mce
        Supported protocols: rc-6
        Enabled protocols: rc-6
        Name: iMON Remote (15c2:ffdc)
        bus: 3, vendor/product: 15c2:ffdc, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc1/ (/dev/input/event15) with:
        Driver dvb_usb_cxusb, table rc-dvico-mce
        Supported protocols: nec
        Enabled protocols:
        Name: IR-receiver inside an USB DVB re
        bus: 3, vendor/product: 0fe9:db78, version: 0x827b
        Repeat delay = 500 ms, repeat period = 125 ms
Found /sys/class/rc/rc2/ (/dev/input/event16) with:
        Driver dvb_usb_af9035, table rc-empty
        Supported protocols: nec
        Enabled protocols:
        Name: Leadtek WinFast DTV Dongle Dual
        bus: 3, vendor/product: 0413:6a05, version: 0x0200
        Repeat delay = 500 ms, repeat period = 125 ms

# ir-keytable -r -t -d /dev/input/event15
scancode 0x0101 = KEY_RECORD (0xa7)
scancode 0x0102 = KEY_TV (0x179)
scancode 0x0103 = KEY_0 (0x0b)
scancode 0x0105 = KEY_VOLUMEDOWN (0x72)
scancode 0x0107 = KEY_4 (0x05)
scancode 0x0109 = KEY_CHANNELDOWN (0x193)
scancode 0x010a = KEY_EPG (0x16d)
scancode 0x010b = KEY_1 (0x02)
scancode 0x010d = KEY_STOP (0x80)
scancode 0x010e = KEY_MP3 (0x187)
scancode 0x010f = KEY_PREVIOUSSONG (0xa5)
scancode 0x0111 = KEY_CHANNELUP (0x192)
scancode 0x0112 = KEY_NEXTSONG (0xa3)
scancode 0x0113 = KEY_ANGLE (0x173)
scancode 0x0115 = KEY_VOLUMEUP (0x73)
scancode 0x0116 = KEY_SETUP (0x8d)
scancode 0x0117 = KEY_2 (0x03)
scancode 0x0119 = KEY_OPEN (0x86)
scancode 0x011a = KEY_DVD (0x185)
scancode 0x011b = KEY_3 (0x04)
scancode 0x011e = KEY_FAVORITES (0x16c)
scancode 0x011f = KEY_ZOOM (0x174)
scancode 0x0142 = KEY_ENTER (0x1c)
scancode 0x0143 = KEY_REWIND (0xa8)
scancode 0x0146 = KEY_POWER2 (0x164)
scancode 0x0147 = KEY_PLAYPAUSE (0xa4)
scancode 0x0148 = KEY_7 (0x08)
scancode 0x0149 = KEY_BACK (0x9e)
scancode 0x014c = KEY_8 (0x09)
scancode 0x014d = KEY_MENU (0x8b)
scancode 0x014e = KEY_POWER (0x74)
scancode 0x014f = KEY_FASTFORWARD (0xd0)
scancode 0x0150 = KEY_5 (0x06)
scancode 0x0151 = KEY_UP (0x67)
scancode 0x0152 = KEY_CAMERA (0xd4)
scancode 0x0153 = KEY_DOWN (0x6c)
scancode 0x0154 = KEY_6 (0x07)
scancode 0x0155 = KEY_TAB (0x0f)
scancode 0x0157 = KEY_MUTE (0x71)
scancode 0x0158 = KEY_9 (0x0a)
scancode 0x0159 = KEY_INFO (0x166)
scancode 0x015a = KEY_TUNER (0x182)
scancode 0x015b = KEY_LEFT (0x69)
scancode 0x015e = KEY_OK (0x160)
scancode 0x015f = KEY_RIGHT (0x6a)
Enabled protocols: unknown other rc-5 sanyo mce-kbd rc-6 sharp xmp
Testing events. Please, press CTRL-C to abort.
 # 1
1488461383.614660: event type EV_MSC(0x04): scancode = 0x10b
1488461383.614660: event type EV_KEY(0x01) key_down: KEY_1(0x0002)
1488461383.614660: event type EV_SYN(0x00).
1488461383.865435: event type EV_KEY(0x01) key_up: KEY_1(0x0002)
1488461383.865435: event type EV_SYN(0x00).
 # 2
1488461394.150608: event type EV_MSC(0x04): scancode = 0x117
1488461394.150608: event type EV_KEY(0x01) key_down: KEY_2(0x0003)
1488461394.150608: event type EV_SYN(0x00).
1488461394.401431: event type EV_KEY(0x01) key_up: KEY_2(0x0003)
1488461394.401431: event type EV_SYN(0x00).
 # 8
1488461400.870636: event type EV_MSC(0x04): scancode = 0x14c
1488461400.870636: event type EV_KEY(0x01) key_down: KEY_8(0x0009)
1488461400.870636: event type EV_SYN(0x00).
1488461401.121430: event type EV_KEY(0x01) key_up: KEY_8(0x0009)
1488461401.121430: event type EV_SYN(0x00).
 # 9
1488461409.598593: event type EV_MSC(0x04): scancode = 0x158
1488461409.598593: event type EV_KEY(0x01) key_down: KEY_9(0x000a)
1488461409.598593: event type EV_SYN(0x00).
1488461409.849430: event type EV_KEY(0x01) key_up: KEY_9(0x000a)
1488461409.849430: event type EV_SYN(0x00).
 # vol_dn
1488461418.530615: event type EV_MSC(0x04): scancode = 0x105
1488461418.530615: event type EV_KEY(0x01) key_down: KEY_VOLUMEDOWN(0x0072)
1488461418.530615: event type EV_SYN(0x00).
1488461418.781443: event type EV_KEY(0x01) key_up: KEY_VOLUMEDOWN(0x0072)
1488461418.781443: event type EV_SYN(0x00).
 # vol_up
1488461428.490659: event type EV_MSC(0x04): scancode = 0x115
1488461428.490659: event type EV_KEY(0x01) key_down: KEY_VOLUMEUP(0x0073)
1488461428.490659: event type EV_SYN(0x00).
1488461428.741432: event type EV_KEY(0x01) key_up: KEY_VOLUMEUP(0x0073)
1488461428.741432: event type EV_SYN(0x00).
 # down arrow
1488461441.650689: event type EV_MSC(0x04): scancode = 0x153
1488461441.650689: event type EV_KEY(0x01) key_down: KEY_DOWN(0x006c)
1488461441.650689: event type EV_SYN(0x00).
1488461441.901433: event type EV_KEY(0x01) key_up: KEY_DOWN(0x006c)
1488461441.901433: event type EV_SYN(0x00).

So it's working, although ir-keytable seems a little confused about
the protocol being used.

I explored other keys and found that higher keycodes are still being
ignored by mythtv, e.g.

  KEY_BACK(0x009e) scancode 0x149
  KEY_MENU(0x008b) scancode 0x14d
  KEY_STOP(0x0080) scancode 0x10d

The boundary seems to be 0x0080, all the keycodes below that seem to work.
I have not explored messing about with keytable remapping.

But for this patch at least: Tested-By: vincent.mcintyre@gmail.com
And thanks!
Vince

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2017-03-02 13:48 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 10:52 ir-keytable: infinite loops, segfaults Vincent McIntyre
2016-11-17 13:45 ` Sean Young
2016-11-18 12:14   ` Vincent McIntyre
2016-11-18 17:40     ` Sean Young
2016-11-18 22:01       ` Vincent McIntyre
2016-11-20 13:29         ` Sean Young
2016-11-22  7:25           ` Vincent McIntyre
2016-11-22  9:20             ` Sean Young
2016-11-23 12:39               ` Vincent McIntyre
2016-11-23 22:34                 ` Sean Young
2016-11-24 12:12                   ` Vincent McIntyre
2016-11-24 13:34                     ` Sean Young
2016-11-25  8:59                       ` Vincent McIntyre
2016-11-27  0:39                         ` Vincent McIntyre
2016-11-27 19:35                         ` Sean Young
2016-11-28  8:35                           ` Vincent McIntyre
2016-11-30  9:02                           ` Vincent McIntyre
2017-02-02 11:18                             ` Vincent McIntyre
2017-02-02 23:35                               ` Sean Young
     [not found]                                 ` <CAEsFdVMhbxb3d=_ugYjfYSCRZsQMhtt=kmsqX81x-6UjTYc-bg@mail.gmail.com>
     [not found]                                   ` <20170204191050.GA31779@gofer.mess.org>
     [not found]                                     ` <CAEsFdVM14VngTM5X=qWTitgwox+4yD8heUqjULe8C=3z2P+h3Q@mail.gmail.com>
2017-02-07 12:33                                       ` Vincent McIntyre
2017-02-16 13:05                                         ` Vincent McIntyre
2017-02-16 13:07                                           ` Vincent McIntyre
2017-02-20 17:13                                           ` Sean Young
2017-02-21 13:07                                             ` Vincent McIntyre
2017-02-21 18:32                                               ` Sean Young
2017-02-24 15:08                                                 ` Vincent McIntyre
2017-02-28 22:15                                                   ` Sean Young
2017-03-02 13:48                                                     ` Vincent McIntyre
2016-11-18 22:49       ` Vincent McIntyre
2016-11-18 23:57       ` Vincent McIntyre

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.