[ir] Web-based Remote Control

I assigned the unused soundtrack and subtitle buttons as block volume down and block volume up (for compensating for the increased volume on iPlayer), but really you can't do anything very sophisticated because of the dead reckoning. Macros are best reserved for simple button reassignment.
 
I've managed to record one which works. When I play a film with wider screen than 16/9 I make the adjustments using the remote. At the end it allows me to use my macro returning my T2 to original 16/9 screen because the initial adjustments leave it always in the same state. I was able to replicate it so I think it works.

Wondering whether after a cold boot all the menus are reset to some original condition or they stay the same as when last used?
 
I've come across what appears to be a bug in the 'ir' program.

The 'delay' facility works OK when used in a WebIf macro and from the telnet CLI, but doesn't when used in a macro in the ir3.map file. The
commands prior to a delay ('f' + hex code) are actioned as expected, but the macro doesn't do the delay or the key presses following it.

Using the example shown in the Wiki 'WebIf Remote Controller' page, here's the relevant bit from /var/log/humaxtv.log -

Code:
Initialising IR3 v1.07
IR3 debug: 1
IR3 Mode:  (0x1000)
IR3 Options: 0x8
IR3 - Loading custom keymap.
Read 184 bytes from map file.
IR3 map line: [0e:43:MENU -> INFO]
Parsed [0e] [43]
Mapping [e] -> [43]
IR3 map line: [1f::VOL+ disabled]
Parsed [1f] []
Mapping [1f] -> [fe]
IR3 map line: [40::VOL- disabled]
Parsed [40] []
Mapping [40] -> [fe]
IR3 map line: [4d:43:LIST becomes INFO]
Parsed [4d] [43]
Mapping [4d] -> [43]
IR3 map line: [43:4d:INFO becomes LIST]
Parsed [43] [4d]
Mapping [43] -> [4d]
IR3 map line: [46:40,40,40,f2,c,3,a:Subtitle button = VOL-, VOL-, VOL-, WAIT 2 seconds, 0, 1, 8]
Parsed [46] [40,40,40,f2,c,3,a]
macro extract [40] [Term: 44]
macro extract [40] [Term: 44]
macro extract [40] [Term: 44]
Finished extracting macro (3 terms).
Macro for 46: 40 40 40

When the Subtitle button on the remote is pressed, the volume is reduced OK, but nothing else happens.

The Customised Firmware, WebIf and everything else are all up to date.
 
Yep - definitely a bug. I have a fix prepared so will release it once I've had a chance to test it.
 
Fixed in ir 1.08, now available in the repository. Thanks for the report and detailed information!

Code:
IR3 map line: [46:40,40,40,f2,c,3,a:Subtitle button = VOL-, VOL-, VOL-, WAIT 2 seconds, 0, 1, 8]
Parsed [46] [40,40,40,f2,c,3,a]
Finished extracting macro (7 terms).
Macro for 46: 40 40 40 f2 c 3 a
 
Thank you for version 1.08, which has fixed the problem.

Unfortunately, there appears to be another bug - the various key presses seem to be sent more than once.

Here's the first part of the IR debug info, showing the map file. I've simplified the macro and changed it slightly to reduce the number of key presses (only one VOL-) -

Code:
Initialising IR3 v1.08
IR3 debug: 1
IR3 Mode:  (0x1000)
IR3 Options: 0x8
IR3 - Loading custom keymap.
Read 63 bytes from map file.
IR3 map line: [46:40,f2,c,3,7:Subtitle button = VOL-, WAIT 2 seconds, 0, 1, 5]
Parsed [46] [40,f2,c,3,7]
macro extract [40] [Term: 44]
macro extract [f2] [Term: 44]
macro extract [c] [Term: 44]
macro extract [3] [Term: 44]
macro extract [7] [Term: 0]
Finished extracting macro (5 terms).
Macro for 46: 40 f2 c 3 7

The last part of the log file showing what 'ir' is actually doing. Is the macro running 3 times? (I only pressed the key once) -

Code:
MACRO
Real IR code: 00000000 0xbf401000
MACRO
Real IR code: 0x000001 0xbf401000
macro thread starting.
MACRO
Real IR code: 0x000001 0xbf401000
macro thread starting.
MACRO
Real IR code: 0x000001 0xbf401000
macro thread starting.
Macro inject: f2
Macro inject: f2
Macro inject: f2
Macro inject: c
Injecting 0c

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af18 1 0100af24
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 0c (2)
Real IR code: 00000000 0xf30c1000
GetQueueSize: 1
GetEvents(): faking key 0c (1)
Real IR code: 0x000001 0xf30c1000
Macro inject: c
Injecting 0c

InjectCommand: Got mutex     
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af30 1 0100af3c
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 0c (2)
Real IR code: 00000000 0xf30c1000
GetQueueSize: 1
GetEvents(): faking key 0c (1)
Real IR code: 0x000001 0xf30c1000
Macro inject: c
Injecting 0c

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af48 1 0100af54
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 0c (2)
Real IR code: 00000000 0xf30c1000
GetQueueSize: 1
GetEvents(): faking key 0c (1)
Real IR code: 0x000001 0xf30c1000
Macro inject: 3
Injecting 03

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af60 1 0100af6c
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 03 (2)
Real IR code: 00000000 0xfc031000
GetQueueSize: 1
GetEvents(): faking key 03 (1)
Real IR code: 0x000001 0xfc031000
Macro inject: 3
Injecting 03

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af78 1 0100af84
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 03 (2)
Real IR code: 00000000 0xfc031000
GetQueueSize: 1
GetEvents(): faking key 03 (1)
Real IR code: 0x000001 0xfc031000
Macro inject: 3              
Injecting 03

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100af90 1 0100af9c
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 03 (2)
Real IR code: 00000000 0xfc031000
GetQueueSize: 1
GetEvents(): faking key 03 (1)
Real IR code: 0x000001 0xfc031000
Macro inject: 7
Injecting 07

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100afa8 1 0100afb4
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 07 (2)
Real IR code: 00000000 0xf8071000
GetQueueSize: 1
GetEvents(): faking key 07 (1)
Real IR code: 0x000001 0xf8071000
Macro inject: 7
Injecting 07

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100afc0 1 0100afcc
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 07 (2)
Real IR code: 00000000 0xf8071000
GetQueueSize: 1
GetEvents(): faking key 07 (1)
Real IR code: 0x000001 0xf8071000
Macro inject: 7
Injecting 07

InjectCommand: Got mutex
get_inbuf: Popped existing.
get_inbuf: Popped existing.
InjectCommand: Buffers 0 0100afd8 1 0100afe4
InjectCommand: Input list 0
InjectCommand: setting signal (0x100ada8)
GetQueueSize: 1
GetEvents(): faking key 07 (2)
Real IR code: 00000000 0xf8071000
GetQueueSize: 1              
GetEvents(): faking key 07 (1)
Real IR code: 0x000001 0xf8071000
macro thread exiting.
macro thread exiting.
macro thread exiting.

When the Subtitle key is pressed, the volume control appears (but in this case doesn't change), there is a delay, then it looks like the numbers are sent 2 or 3 times each.

Hope the above is of help.

One other oddity (which is of no great consequence) - if you specify a delay as the first item in a macro, it is ignored and the macro continues immediately with the next keypress.

And finally a couple of queries -
1. is there a limit to the length of the macro?
2. is there any way of breaking into a macro part-way through (ie. in the middle of a delay)?

Apologies for the length of this post!
 
Yes, it saw the key as being held down long enough to receive the command three times. When I tested it here (with the previous macro) it worked fine. There may be a way of stopping this from happening - effectively noting that the macro is already in progress. I'll have a look at it.
When the Subtitle key is pressed, the volume control appears (but in this case doesn't change),
That makes sense - the first press just brings up the volume bar.

One other oddity (which is of no great consequence) - if you specify a delay as the first item in a macro, it is ignored and the macro continues immediately with the next keypress.
I can see why that's happening. When the first keypress is detected then it's substituted for the first part of the macro. Since it's executing in the main thread it can't introduce a delay at that point without stalling the whole Humax application.

1. is there a limit to the length of the macro?
50
2. is there any way of breaking into a macro part-way through (ie. in the middle of a delay)?
No.
 
Version 1.09 works OK - many thanks.

Sorry for the delay in replying, as I've been restricting tests to times when there were no recordings taking place. Just as well, as I've had a couple of unexpected reboots (which hasn't happened before).

It's difficult to diagnose the reason, as the humaxtv.log file gets overwritten on reboot and the crash log contains nothing for the times in question. While it would be good to get to the bottom of this, I don't like to take up too much of your time, af123 - you've undoubtedly got more important matters to deal with.

Thanks again.
 
What would you use this for, other than annoying your kids/wife by changing their channels from next room. Other more creative uses?

Well, having "buttons" that work exactly once every time you press them would be a huge bonus on the T2. I've given up using my T2 because the remote is so crap.
 
Well, having "buttons" that work exactly once every time you press them would be a huge bonus on the T2. I've given up using my T2 because the remote is so crap.
Actually they all repeat, other than the PVR/TV/DVD/Audio keys. It uses the so-called NEC format IR transmission format where the button's command is followed by a short 'repeat' code for as long as the button is pressed*. But this doesn't cause multiple button presses and the remotes here work fine.

As BH says it could be a simple case of needing an internal clean but it's usually only the most used buttons that get iffy unless something's been spilt on it.

Sounds to me like it could be something else. Is the remote the Humax one or a replacement, and is the range what it should be? It should work fine with the remote pointed at the ceiling with good batteries.

* You can have fun in with an IR Tx that just sends the 'repeat' code...
 
Last edited:
Is there some particular reason for this fragment in the ir startup script /mod/etc/init.d/S40ir? It doesn't appear to have any effect except potentially filling the modinit log. Should the subsequent commands (running the ir startup macro, if any) be moved into the subshell?
Code:
...
              # Wait for network to come up...
              (
                      while [ ! -f /tmp/if-up ]; do
                              echo "ir: waiting for network..."
                              sleep 1
                      done
              ) &
...
 
Is there some particular reason for this fragment in the ir startup script /mod/etc/init.d/S40ir?
I don't know, I imagine it's supposed to delay running the boot macro until the network is up, but it obviously doesn't work. I'll fix it, thanks.
 
In this sort of case there's a choice between fixing as in "making it do what it appears to be trying to do" and as in "removing non-functional code and leaving the same behaviour". I'll be interested to see which way you go!
 
I presume the codes received from the IR need not be the standard ones, or could be codes from the other modes, and then mapped to codes or macros.

I'm thinking in terms of a custom handset (probably JP1), with extra buttons used as direct-dial for specific channels.

Any reason this might not work?
 
I presume the codes received from the IR need not be the standard ones, or could be codes from the other modes, and then mapped to codes or macros.
Yes - that's a trick I use on my boxes to get a discrete power off code.

Code:
humax# cat /mod/boot/ir3.map
0x7887827d:0:Discrete power off
 
Back
Top