OK, now that I've had a chance to look and play with the code, I see a lot clearer, and here's my plan for masquerading HDMI-CEC codes as IR ones. The major disappointments of course are that:
- Realtek didn't use inputdev for IR, as they should, so their IR input method is far from being friendly for external apps. If it's dealing with user input, use inputdev!
- Even worse, their venus_ir driver is read-only, so if you want to fake IR input you have to get quite creative.
Gouzhuang did an awesome job with the shadow driver (and of course
Sekator500 too!), but the thing that bothers me is that you must to install the shadow driver module before DvdPlayer starts, which may be a hurdle for regular users, and also, the
only thing I really need from the shadow driver is the ability to write data to the IR fifo, so using shadow would be a bit of an overkill.
Therefore, what I'm going to do is:
- write my own driver (which won't actually be part of the cecd project) to hijack the venus IR fifo and add provide write operations to it, but without touching the existing driver => such a driver will be installable/removable on a running system even when DvdPlayer is running. This would be a separate driver from /dev/venus_irrp which I'll probably call /dev/venus_irwo (for write only)
- use the cecd.conf to translate HDMI-CEC keys to IR fifo data and just write those to /dev/venus_irwo
Now thanks to the good sources provided, I'm already well under way with the Venus IR FIFO hijack. I have an alpha version (called /dev/ugha, for "UGly HAck"
) that I can use to write IR codes straight into the existing FIFO, and fool the system into thinking that the data came from the remote. This requires some disputable retrieval of the venus_ir_fifo and venus_ir_read_wait addresses from the existing IR driver (through rudimentary "disassembly" of the running driver in the kernel), so this method is probably not as bulletproof as the shadow driver. But since the means of getting write access to an IR driver in order to fake RC codes on a specific system,is really something that falls outside of scope of cecd, that'll be good enough for me. And of course, the main advantage is that it can be installed/removed on the fly, even when DvdPlayer is running...
Once I have finalized venus_irwo, I'll publish the source and binary. But I don't think this new driver will be of much use for the problem of handling of different RCs. The translation of HDMI-CEC codes as IR codes, and the support of different RCs are two fundamentally different problems, that I think are better left separate...