On 11/07/2017 21:50, Sean Young wrote: > On Mon, Jul 10, 2017 at 11:44:08AM +0200, Mason wrote: > >> How does one know which decoder to use, out of >> the dozen protocols available? > > Well, that depends on the protocol the remote uses to send. Is there a way to "guess" the protocol used, just by looking at the raw bitstream? >> Hmmm, I'm missing a step for going from >> 00000000 a9 07 00 00 2e 72 0e 00 04 00 04 00 41 cb 04 00 |.....r......A...| >> 00000010 a9 07 00 00 2e 72 0e 00 00 00 00 00 00 00 00 00 |.....r..........| >> to >> 2589.901611: event type EV_MSC(0x04): scancode = 0x4cb41 >> 2589.901611: event type EV_SYN(0x00). >> (not the same IR frame, BTW) > > The first is a hexdump of struct input_event, the second is a pretty > print of it. http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/input.h#L25 struct input_event { struct timeval time; __u16 type; __u16 code; __s32 value; }; Gotcha. >> Once we have a scancode, there is another translation pass, >> to the higher-level concept of an actual key, such as "1", >> which all applications can agree on. > > Yep, that's what the keymaps in drivers/media/rc/keymaps/ are for. Suppose I wrote a keymap "driver" for my remote control, Does loading a kernel keymap change what is output on /dev/input/event0 ? I mean, does the output changes from 'struct input_event' to input-event-codes? (so 4-byte int?) Or is that sent on a different dev node? http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/input-event-codes.h >> Back on topic: it seems to me that Linux supports many protocol >> decoders, including the 3 supported by block A. I am also assuming >> that IR signals are pretty low bandwidth? Thus, it would appear >> to make sense to only use block B, to have the widest support. > > Absolutely right. That's what the winbond-cir driver does too. However, > for wakeup from suspend the winbond-cir uses the hardware decoder. I was later told that the "universal" HW block had not received extensive testing; and everyone just uses the NEC/RC5/RC6 block. So I guess I'll forget about the UIR block for now. Regards.