On 27/02/13 15:09, Daniel James wrote:
> In article <kgj5kf$rku$
1...@dont-email.me>, Jim Price wrote:
>> Yep, it's setting the protocol that is going to be used to decode
>> the button presses. If that is set to something which has a protocol
>> unrelated to the remote you're using, you won't get much out of it.
>
> Setting the *protocol*?
In this case the protocol being RC-6.
> I had assumed that the button definitions with different "remote ="
> lines were for different physical remotes (and I guess I assumed they
> would all use the same protocol) ... and that there would be a setting
> somewhere to specify the actual remote in use.
A given remote will use a particular protocol. There is a certain amount
of standardisation, and the Philips eHome RC-6 is the one in theory you
might be able to use more than one remote via the same receiver, but in
practice that can be a can of worms if the two remotes you are trying to
use each use a different protocol. Basically what happens is the remote
flashes on and off, where on is a brief duration of several tens of kHz
flashes, and off is just off. The duration of those flashes is what
mode2 shows you. The protocol is what gets you from the flashing data to
a byte or two of stuff you can use as data. This sort of stuff is
unbelievably poorly documented on the internet, possibly because it is
proprietary in a lot of cases.
> So ... what's the point of having button definitions using different
> protocols in the same lircrc file -- can a single remote use different
> protocols for different buttons?
In general, no. The exception is universal remotes, which can emulate
more than one remote and assign buttons to produce output which can be
of a different protocol for a different key on the remote.
> I've been trying to read up on this stuff, but useful information is
> hard to find.
As I said above, that's because it largely isn't there. I did a fair bit
of stuff with re-programming the One-For-All remotes a few years ago,
based on the JP1 software from here:
http://www.hifi-remote.com/forums/
Their IR protocol page is the best source of low level remote info on
the net, if a little bit cryptic for the beginner:
http://www.hifi-remote.com/johnsfine/DecodeIR.html
e.g. RC-6 is casually defined as:
{36k,444,msb}<-1,1|1,-1>(6,-2,1:1,0:3,<-2,2|2,-2>(T:1),D:8,F:8,^107m)+
>> As far as I can tell, the "private" way is just taking stuff from
>> the virtual keyboard driver and assigning actions to that.
>
> "virtual keyboard driver" ... another piece of the jigsaw.
That's just the kernel putting together all the physical keyboards
together, as seen when you do xinput list.
>> Hence when the remote is one which has been subsumed into the
>> virtual keyboard way of doing things, it is just sending codes
>> which correspond to what are effectively the keyboard shortcuts
>> in MythTV. That's fine when it works, but perplexedly different
>> when it doesn't.
>
> I'd assumed -- perhaps entirely incorrectly -- that the "private" way
> involved MythTV (mythfrontend?) reading data from the hardware driver
> directly and mapping the data received straight onto MythTV commands,
> while the "public" way used lirc to generate input events of other
> kinds (keypresses, etc) that could be fed to the relevant applications.
> In this case Myth would still work, but would be unaware that it wasn't
> being directed by a normal keyboard.
That's pretty much it. Myth needs to know which remote you are using so
it knows what to do in the case of lirc data, but in the case of kernel
supported remotes it does seem to be a case of just having the virtual
keyboard input understand what is likely to come its way. Your remote is
going to have to go via lirc because of the receiver, and use a
buttonmap something like that implied by mceusb, but the old version
which hadn't been ported to the kernel.
> However, the fact that when the mythbuntu control centre configures an
> IR device it actually writes /etc/lirc/hardware.conf and creates the
> lircrc file sorta suggests that more of lirc is involved even in the
> "private" case (if that is the "private" case).
I'm not sure whether the buttonmap MythTV needs in order to use your
remote actually exists in quite the format MythTV expects for mceusb
devices.
> I do note that the "No Additional Remote Support" option in the control
> centre says "If you don't have a remote right now, or it's supported
> natively". I'd overlooked that ... perhaps I should play with the
> "supported natively" option?
Worth a try I suppose. However, the supported natively means via the
virtual keyboard method, whereas your remote is going to have to go via
lirc. The test for this is one you've already done - do the number keys
produce numbers in a terminal.
> Oh dear: "The application Mythbuntu Control Centre has closed
> unexpectedly". It's not the first time I've seen that!
Which version of MythTV are you running? 0.25 is what you get by default
in 12.04, but there is an upgrade to 0.26 available with relatively
little hassle in 12.04.
>>> I didn't build my own ADSL router either!
>>
>> I did built my first ADSL router. My, that seems like a long time
>> ago. It expired in 2006.
>
> Well, I keep saying I'll build my next one ... but I expect someone
> will produce a commercial one with decent IPv6 support before I get
> around to it, and I won't need to.
My current router does support IPv6 - rather a lot better than my ISP
supports it, but I'm looking at changing ISP in the near future to one
which does (A+A have a new Home::1 tariff, which looks good).
> I moved the box, and now it doesn't pick up random background (I think
> it was pointing too nearly towards an LCD monitor and picking up IR
> from the backlight). It now gives much less erratic-looking values for
> pulse and space:
>
> pulse 2725
> space 815
> pulse 520
> space 364
> pulse 546
> space 338
> ..
>
> I can also get a bunch of possibly helpful numbers by doing:
>
> hexdump -C /dev/lirc0
>
> (about 256 bytes per button press ... but not a constant amount (or is
> it that it's just over 256 bytes and being buffered by hexdump?))
Not sure about that.
> However:
>
> irw /dev/lirc0
>
> gives:
>
> connect: Connection refused
>
> which surprised me. I had expected that mode2 and irw would read the
> same IR input but that mode2 would simply report it while irw would try
> to interpret the raw data and report keystrokes. Clearly I still don't
> understand quite how this jigsaw fits together!
irw uses the current lirc daemon config file for its protocol
information, and if that is not correct, it won't give any (sensible)
output.
>> Somehow we need to work out what protocol that remote is using, so
>> you can stick the appropriate shim in there to get from raw
>> on-off timings to something which lirc can use to control MythTV.
>
> Makes sense.
>
>> In theory if it is MCE compatible, the protocol should be RC-6.
>> I'm going to have another read of that XBMC article with that in
>> mind to see if there's a clue what it is.
> ..
>> I'd say the worst case has now shifted to having to use irrecord to
>> generate a keymap, the best case is being able to identify a
>> pre-existing setup which works.
>
> I wondered whether irrecord would be the way to go ... I rather hope
> not as there are 30 buttons to record, and the qwerty keypad on the
> back has another 37 keys! It could take a while ...
Well, at least it only needs doing once.
>> ... mode2 (nice helpful, meaningful, name that has!)
>>
>> I'm not sure I can think of a meaningful name which isn't rather a
>> lot longer.
>
> <smile> ... well, something with "ir" in it, maybe, and something less
> superficially similar to "mode3"!
ir2 it is then. I'm not going to write the bug report though.
>>> I can see I have more fun ahead <smile>!
>>
>> Only if we end up having to reverse engineer the protocol. I'm
>> reasonably optimistic we won't.
>
> It's nice of you to say "we" -- you've been a great help already.
Thanks. You are doing all the actual work though. Thankfully you seem to
have enough of a clue to keep things moving in the right general direction.
ite-cir replaces lirc_it87, and yes it is newer.
That's RC-6. It's a bit longer than I get from my remotes, so it could
be RC-6-20. Timing is about 458. 444 is the standard, but my Sky remotes
are 433 and work fine, so it's close enough for rock and roll.
The alternating 7B and FB may be because of the toggle bit - which is
supposed to help debounce things, but isn't always used. CE is the
actual key code, but according to my
/usr/share/lirc/remotes/mceusb/lircd.conf.mceusb, the code for stop
should be E6. My inference from that is that your remote does not have
the standard mceusb keymap. That's not good for being able to get things
tied into MythTV using a standard config file, unless we can identify
which config file it is.
> If I copy that file to /etc/lirc/lircd.conf and restart lirc I can then
> run irw and get:
>
> daniel@galette:~$ irw
> 000000037f917ba7 00 KEY_UP myremote
> 000000037f917ba7 01 KEY_UP myremote
> 000000037f917ba7 02 KEY_UP myremote
> 000000037f91fba4 00 KEY_RIGHT myremote
> 000000037f91fba4 01 KEY_RIGHT myremote
> 000000037f91fba4 02 KEY_RIGHT myremote
> 000000037f91fb6c 00 KEY_PLAY myremote
> 000000037f917bce 00 KEY_STOP myremote
> 000000037f917bce 01 KEY_STOP myremote
> 000000037f917bce 02 KEY_STOP myremote
> 000000037f917bce 03 KEY_STOP myremote
> ^C
> daniel@galette:~$
>
> *BINGO*!
We have ignition.
> I seem to have to hold each button down for quite some time (only a
> fraction of a second, but more than a rapid push) before I get any
> response, and then I tend to get multiple lines echoed by irw ... but I
> suppose that gets debounced somewhere along the line?
I'm guessing at this stage that the toggle bit setting might not be
right. I think the way that is supposed to work is that it is changed
every keypress, so you can distinguish between a constant keypress and
multiple individual keypresses. My remotes don't use it, so I'm not
sure, but there is a setting in the config file to try playing with.
There is also the mask, which can be set to ignore the byte of data
which may be causing that. In general remotes only actually send one of
256 codes, so only the one byte is actually needed. Lets worry about
that after we've got the keymap sorted though.
> I've regenerated lircrc and got something plausible-looking including
> same the keys as in lirc.conf ... however, those keys aren't doing
> anything in mythfrontend.
>
> I feel I'm getting close ...
There is certainly light at the end of the tunnel now. I'm not sure how
to find out whether there is already a keymap for your remote - looking
on the lirc site is the obvious check, but I couldn't find anything
which sounded like your remote on there. The complete absence of any
manufacturer or model info is a bit of a problem. There aren't any clues
inside the battery compartment are there, or any other text on the
thing? If we can't find that, we're left with creating the button map
with irrecord and possibly using the button names from the mceusb config
to make sure they get passed to MythTV in a way which makes sense to it.
At least we do now know enough to get the thing working.
--
╔═╦═╦═════╦═══╗
║ ║ ║ ║ ║
╔═╝ ║ ║ ║ ║ ║ ╔═╝
╚═══╩═╩═╩═╩═╩═╝ -- JimP.