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
    • Feed der Einträge
    • Kommentare-Feed
    • WordPress.org

750 frames of chaos 2009-11-25

Here's a video my graphics card has just finished. It's a travel lasting 750 frames from a friction coefficent of 0.05 to 1.0 and my "standard" setting of three magnets below the pendulum's body (see here and here for more information).

Kategorie Bilder, Physik, Programmieren | 0 Kommentare »

Magnetic pendulum, the OpenCL way. 2009-11-23

For the last couple of days I did some effort on porting my Python implementation of a magnetic pendulum (German post here, the slides include lots of pictures) to OpenCL. It's really cool to leverage GPU power for your own benefit.

If you'd like to see code rather than words, you should come around at my Git repository. Just to quote from the README file:

This is an implementation of a magnetic pendulum in OpenCL. A spherical pendulum is influenced by magnets. For every point of origin the program finds the magnet the pendulum's body will be nearest when it comes to rest (friction is taken into account). It will create an image, where every pixel (points in the \(\)-\(\)-plane) is mapped to a color representing each magnet.

The problem is ideally suited for parallel computing as every initial condition can be solved independently from the others. I did a Python version some time ago that utilized Scipy. Although it was quite optimized with C code, it performed very bad. To create a map of 1600x1600 pixels, it took about 2700 minutes! Leveraging the power hidden in GPUs, I wanted to know what speed-up would be reached.

The code works quite good so far. I began coding a CPU version in C that is a lot faster than the original Python version, but even my decent GPU outperforms that by a factor of ten. The map from above can now be done in 284 seconds. That is seconds, not minutes! 🙂

Tags: magnetic pendulum, Magnetpendel, OpenCL
Kategorie Allgemein, Physik, Programmieren | 1 Kommentar »

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.

Kategorie Mac, Programmieren | 26 Kommentare »

« Vorherige Einträge

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