Support
All support resources for our products. Here you can find answers to frequently asked questions, discuss with other users, recover a lost license code or file a support request.
Forum closed
This forum was closed and turned into an archive effective April 21, 2018. It is no longer possible to create new topics or reply to existing topics.

Thanks everyone for all the great questions and contributions over the years.

Please use the Contact form to get in touch.

Remote Buddy Forum

Overview 

AuthorThread
User

20.06.2016 03:43:41
Premature Stop signal with Apple Remote

This posting is older than 6 months and can contain outdated information.
Hi,

I experience a strange and for me crucial issue with the Apple Remote (Built-in IR Receiver) connected to a Mac mini (2011) currently running Mountain Lion.

I need to control a mechanical device with a start and a stop signal: starting to press the corresponding button of the Apple Remote should send a start signal to the device, releasing the button should send a stop signal, so that the mechanical device is active as long as I press the button of the Apple Remote.

This sounds like the easiest and most natural thing in the world, but unfortunately, I just cannot get it to work.

The mechanical device is connected via Ethernet, i.e. it is controlled by network commands. There is an OS X command line utility (let’s call it mycmd) which allows to send start and stop commands to the device.

So I constructed a fitting behavior with 1 action. The action uses 2 AppleScript steps: 
Execute on button press: do shell script "/usr/local/bin/mycmd start" 
Execute on button release: do shell script "/usr/local/bin/mycmd stop" 
As I said, the simplest thing in the world.

And indeed, everything works as expected if I test this with the Script Remote Virtual Remote, with a script like this:

tell application "Remote Buddy" to scriptremote button "plus" event "press" 
delay 3 
tell application "Remote Buddy" to scriptremote button "plus" event "release"

When I run this script, "/usr/local/bin/mycmd start" is immediately invoked; 3s later, "/usr/local/bin/mycmd stop" is invoked. Just as it should be.

HOWEVER, as soon as I use the Apple Remote instead and press the Plus button for 3s, "/usr/local/bin/mycmd start" is immediately invoked (as it should be), and then, only 100ms-200ms later, "/usr/local/bin/mycmd stop" is invoked – no matter how long I actually press the button.

I tried everything I could think of to debug this, and, among many other things, replaced "/usr/local/bin/mycmd start" and "/usr/local/bin/mycmd stop" with "logger start" and "logger stop". Looking at the syslog, I found to my big surprise that in this case, the Apple Remote DOES work as expected, i.e. the "stop" appears in the syslog exactly when I release the button of the Apple Remote. (Of course, the Script Remote Virtual Remote works as well.)

So, to sum up:

Script Remote & logger WORKS (stop is sent when the button is released) 
Script Remote & mycmd WORKS (stop is sent when the button is released) 
Apple Remote & logger WORKS (stop is sent when the button is released) 
Apple Remote & mycmd DOES NOT WORK (stop is sent 100ms-200ms after start)

I.e. every combination works except the one combination I actually need. :-(

I have no idea what happens here. mycmd is a very simple command line utility that basically just sends a few bits over a network interface. Controlling something via the local network should not be anything special nowadays.

The action is assigned to the Global mapping, and Remote Buddy Preferences > General > Advanced > "Manually activated Behaviors stay active until they are explicitely deactivated" is checked, so it’s not an issue of another behavior taking over.

But what is it? From my debugging, I can only assume that it’s a deep rooted bug somewhere within the Apple Remote specific code (in contrast to the Script Remote code).

But how can I work around this? Using an IR remote to start/stop a device over the network really isn’t an exotic task, is it?

Last edited: 20.06.2016 03:44:03

Last edited: 20.06.2016 03:46:28

Last edited: 20.06.2016 03:49:44

Last edited: 20.06.2016 03:55:15 

These entries from the FAQ may be relevant to this topic:

Configuration
Hardware
Hardware - Apple® Remote
Thread-display::