tinowagner.com // Blog

Dies und das.
  • Blog
  • Projekte
  • Impressum

Untermenü

  • Archiv
  • Kategorien

    • Allgemein
    • Bilder
    • Fundstücke
    • OS & Apps
      • Gimp
      • Linux
      • Mac
    • Physik
    • Programmieren
      • Web-Dev
    • Sprache
  • Neueste Beiträge

    • 750 frames of chaos
    • Magnetic pendulum, the OpenCL way.
    • Asus DH Remote: Crafting an OS X driver
    • Das Magnetpendel
    • Powerbook und Lower Memory Slot
  • Neueste Kommentare

    • Tino Wagner bei Möge es doppel-pendeln!
    • Anna bei Möge es doppel-pendeln!
    • Grandeau bei Das Magnetpendel
    • Tino Wagner bei Das Magnetpendel
    • Grandeau bei Das Magnetpendel
  • Blogroll

    • Nicole Schönfelder
  • Meta

    • Anmelden
    • Beitrags-Feed (RSS)
    • Kommentare als RSS
    • WordPress.org
« Das Magnetpendel
Magnetic pendulum, the OpenCL way. »

Asus DH Remote: Crafting an OS X driver 2009-11-02

Some ASUS mainboards are supplied with a remote control, the „Asus DH Remote“. I’m running Mac OS X Snow Leopard on a P5W DH Deluxe, which is quite old from a technical point of view, but actually doing a good job. As often, there are only Windows drivers for the remote, but none for Linux or even OS X. For the Linux part, there is already a driver for LIRC.

When I realized that the IR receiver is a simple USB HID device, I started brewing an OS X user-space utility together that interfaces the receiver. It is merely a hack based off example code I found at the Mac Dev Center, but that got it to work in a short time.

Basically, what you get from the receiver is the message that a key on the remote was pressed or released. Using this information, the tool is using Brandon Holland’s IRKeyboardEmu to emulate HID command reports sent by an Apple Remote. This allows you to use the Asus DH Remote as a controller for FrontRow or iTunes!

It is far from being perfect, but I think it’s a good starting point for your own inventions.

Download

Source and Universal Binary: AsusRemote-v0.1.zip

Installation

  1. Download and extract the archive.
  2. Install the binary:
    # sudo cp AsusRemote /usr/local/bin/AsusRemote
    # sudo chown root:wheel /usr/local/bin/AsusRemote
    # sudo chmod +s /usr/local/bin/AsusRemote

    Note the SUID bit for AsusRemote. It needs superuser rights to interface to IRKeyboardEmu! Else it will issue an error issuing a sysctl command.
  3. To be able to use the daemon right after booting OS X, you need to copy com.tinowagner.AsusRemote.plist to /Library/LaunchDaemons/:
    # sudo cp com.tinowagner.AsusRemote.plist /Library/LaunchDaemons/
    # sudo chown root:wheel /Library/LaunchDaemons/com.tinowagner.AsusRemote.plist
  4. Finally, you should download the newest binary of IRKeyboardEmu and copy it to /System/Library/Extensions. Just follow the instructions in the readme.
  5. After rebooting, check that the daemon is running. There should be a process called AsusRemote.

Key assignment

This is a hard coded part. It tries to match the keys on the Apple Remote.

  1. AP LAUNCH: Menu. Start FrontRow.
  2. + and –: Up and down arrows, Volume up/down.
  3. Reverse and Forward: Previous/Rewind, Next/Fast-forward
  4. Play/Pause: Enter, Play/Pause

There is no action assigned to the other keys.

Troubleshooting

If nothing happens after pressing a key, try running AsusRemote from command line. First kill the daemon running in the background:
# sudo killall AsusRemote
# AsusRemote

You should now see a version message. Pressing an arbitrary key on the remote should produce an output:

AsusRemote v0.1
2009, (c) Tino Wagner <ich@tinowagner.com>

Key: Plus
Key: Minus
Key: Reverse
Key: Forward
Key: Play/Pause
Key pressed: Plus
Key released: Plus
Key pressed: Minus
Key released: Minus
Key pressed: Forward
Key released: Forward
Key pressed: Reverse
Key released: Reverse
Key: AP Launch
Key: AP Launch
^C

Notes

Feel free to modify the code to your likes! But please drop me a note if it’s an improvement that could be useful for everybody, so I can post it here.

Der Beitrag wurde am Montag, den 2. November 2009 um 23:23 Uhr veröffentlicht und wurde unter Mac, Programmieren abgelegt. Du kannst die Kommentare zu diesen Eintrag durch den RSS 2.0 Feed verfolgen. Du kannst einen Kommentar schreiben, oder einen Trackback auf deiner Seite einrichten.

26 Reaktionen zu “Asus DH Remote: Crafting an OS X driver”

  1. lucaiuli
    Am 30. November 2009 um 12:11 Uhr

    Hi, I followed your step by step tutorial and I get this errors for:
    Keys: Play/Pause, +, -, FW and RW

    ERROR: Unable issuing sysctl command, errno = 2!

    what am I doing wrong?
    I’m on Snow Leopard 10.6.2, Asus P5B Vista Edition, Asus IR and remote.
    Thank you.

    Iulian

  2. Tino Wagner
    Am 30. November 2009 um 12:51 Uhr

    Hi Iulian,

    have you checked that IRKeyboardEmu is installed correctly and loaded? You can check so by running „sudo kextstat | grep IRKeyboardEmu“ in a terminal. If there’s a line indicating the kernel extension is loaded, everything should be fine. If not, you could try loading the kernel extension manually using kextload.

    Best regards,
    Tino

  3. Gigo
    Am 7. Dezember 2009 um 11:59 Uhr

    Hi
    Got also problems with the install.
    AsusRemote works and receives commands form the Remote checked while running AsusRemote via interactive mode.
    IRKeyboardEmu is running.
    But it looks that ther is no mapping from AsusRemote to IRKeyboardEmu.
    Which version of IRKeyboardEmu do you used?
    THX

    gigo

  4. Gigo
    Am 7. Dezember 2009 um 12:00 Uhr

    .. running un 10.5.8 leopard, MAc Mini G4

  5. Gigo
    Am 7. Dezember 2009 um 21:19 Uhr

    HI

    Started AsusRemote from CommandLine and keys are recognized and forwarded to theIRKeybooardEmu.
    Looks that id don’t work only if startet as daemon. Do you have any hints?

    Thank you

    Gigo

  6. Tino Wagner
    Am 7. Dezember 2009 um 21:35 Uhr

    Hi,

    it seems AsusRemote is not running with super-user priviledges. If you run „ps aux | grep AsusRemote“ in a terminal window, you should see a line starting with „root“. If this line is missing, AsusRemote is unable to forward the commands to IRKeyboardEmu. Is it possible that you missed changing the owner of /usr/local/bin/AsusRemote to root?

    HTH

    Best regards,
    Tino

  7. Gigo
    Am 13. Dezember 2009 um 16:46 Uhr

    HI

    Thank you for your response but this is not the solution/problem.
    Process is running as root user.
    Maybe the problem is the latency until the kernel extension is loaded.
    Will make a test with kextload from the launch daemon to see if this will fix it,

    thx Gigo

  8. Gigo
    Am 2. Januar 2010 um 13:30 Uhr

    HI
    Fixed the problem I had with a shellscript that starts in the background via a Apple Script Application Bundle as a User Startup Item.

    One problem is still left:
    The Application Launch Button is recognized by the program, but it seems that ther is no mapping to „Start Frontrow“ or „Menu“
    Any hints?

    Thx gigo

  9. Alex
    Am 3. März 2010 um 21:39 Uhr

    Hello,

    If I buy the IR receiver will it work with snow leopard and a normal apple remote? I don’t need the remote, I have the Apple one, just not the receiver.

    Thanks.

  10. Tino Wagner
    Am 3. März 2010 um 22:42 Uhr

    Hello Alex,
    the receiver is listening only for commands of the Asus remote. So I don’t think it is possible to use it with a normal Apple Remote.

    Best regards,
    Tino

  11. Raon
    Am 6. März 2010 um 08:30 Uhr

    Hello,

    I succeeded to an installation

    Thank you.

    Not yet Snow Leopad 64bit.

  12. 2010-03-06 유용한 링크 | We are connected
    Am 15. März 2010 um 09:57 Uhr

    […] Asus DH Remote: Crafting an OS X driver […]

  13. jayjay
    Am 22. Mai 2010 um 07:42 Uhr

    hi.

    thx to your work, my DH remote works fine on iTunes and FrontRow.

    but it doesnt work on Plex.

    is there any way to make it work on Plex or other apps?

    thank you.

  14. Tino Wagner
    Am 22. Mai 2010 um 08:34 Uhr

    Hi,

    it’s nice to hear that it works for you. About Plex: I’m sure there’s a way to get the remote working with it, either by directy controlling Plex from my daemon or using Plex‘ Apple Remote support. The latter way might not work as emulating Apple Remote commands using IRKeyboardEmu is quite prone to errors.

    Best regards,
    Tino

  15. jayjay
    Am 22. Mai 2010 um 10:09 Uhr

    thank you for the anwer.

    unfortuantely, the later way doesn’t work here.

    so could you please explain more detail about ‚directly controlling Plex from my daemon‘?

    i’m sorry but i’m a totally newbie to mac stuff.

    thank you very much.

  16. Tino Wagner
    Am 22. Mai 2010 um 11:01 Uhr

    I could do some quick changes to the code to let it emulate key presses, if you tell me, which keys should be pressed on the keyboard for each button on the remote.

    Best regards,
    Tino

  17. jayjay
    Am 22. Mai 2010 um 11:24 Uhr

    I really appreciate for your kindness!

    I want ‚ap launch‘ button to launch Plex. (instead of front row)

    and on plex, ‚up down skip play menu‘ buttons to the same as normal apple remote(arrows and return and esc keys)

    thanks, again.

  18. Tino Wagner
    Am 22. Mai 2010 um 12:36 Uhr

    Here you go: AsusRemote-v0.2.zip. I changed the code so it sends key presses for up/down/left/right and return. However I couldn’t get the daemon to launch Plex with a button on the remote.

    By default, the program will work as before. You have to launch it with the parameter „-plex“. It will then send keystrokes to the active window.

    Please try it from the command line first. You should see „* Emulating key presses for Plex *“ the program is working in „Plex mode“ …

    To run it using launchd, add the parameter „-plex“ to the program arguments in the plist.

    Warning: I can’t guarantee that it works. I even couldn’t test it as I don’t have access to my Asus remote at the moment.

  19. jayjay
    Am 22. Mai 2010 um 13:28 Uhr

    wow Tino, you are my savior!

    it works perfectly fine with -plex option except for ‚menu‘ button doesn’t act ‚esc‘ key.

    could you please change the code again for this?

    for me, it’s much better to use DH remote with -plex option.

    thanks!!

  20. Tino Wagner
    Am 22. Mai 2010 um 13:44 Uhr

    I’m happy that it works! 🙂 The „maximize“ button (the one next to AP LAUNCH) should send esc now. Same link as above.

  21. jayjay
    Am 22. Mai 2010 um 17:19 Uhr

    big thanks!!

    it works exactly as i wanted now.

    nice work!!

  22. riconster
    Am 25. Juli 2010 um 03:06 Uhr

    Thank you very much for your work. Is great on Mac OS X Snow Leopard 10.6 on a P5W DH Deluxe.

    😀

  23. riconster
    Am 25. Juli 2010 um 05:54 Uhr

    I think is time for AsusRemote-v0.3 and update to work in Boxee!

    Please.

    😛

  24. Konstantinos Nks.
    Am 30. Oktober 2010 um 02:35 Uhr

    Hello there…
    I have the same problem with Alex but i fixed.
    I tried many ways such lirc etc to work my hackintosh with ir controll without luck!
    Your app work!! 10 stars app, keep the good work!
    Greetings from Greece!
    Thank you!

  25. serkan
    Am 28. April 2011 um 18:05 Uhr

    Installed it on Snow Leopard/P5W DH Deluxe. The only problem I had was that the folder /usr/local/bin did not exist. I manually created the bin folder inside /usr/local/. Otherwise, an awesome „driver“ for something I never had hope for 🙂
    One suggestion though:
    Is it possible to write an interface for it so that the key presses emulated can be defined by the user?

  26. Tino Wagner
    Am 28. April 2011 um 21:27 Uhr

    I’m glad you like it. Of course it would be possible to read in an existing configuration from a plist file and to create a small tool / system settings plugin to modify it. Unfortunately, I don’t have the time for this rather big rewrite at the moment, but maybe somebody else has. I just created a repository at Github for collaboration. This shortcutrecorder control might be very useful then.

Einen Kommentar schreiben


tinowagner.com // Blog is proudly powered by WordPress | WPD
Beiträge (RSS) und Kommentare (RSS)