Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

(Mostly OT) Using a remote with perl?

by BUU (Prior)
on Apr 07, 2004 at 10:48 UTC ( [id://343248]=perlquestion: print w/replies, xml ) Need Help??

BUU has asked for the wisdom of the Perl Monks concerning the following question:

The situation is thus: I have a debian box (unstable,2.4). It plays mp3s. I have wish to use a remote to change which mp3 is playing, select between them, so on and so forth. Preferably I would like to interface some kind of remote control with a perl script that controls the mp3s. Anyone have any ideas here?

(Note, the main point in doing this is the fun in creating it, please do not suggest "prebuilt" solutions that attempt to solve all of these problems)

Replies are listed 'Best First'.
Re: (Mostly OT) Using a remote with perl?
by matija (Priest) on Apr 07, 2004 at 11:18 UTC
    LIRC (http://www.lirc.org) is the "Linux Infra Red Control" project. It provides drivers and an interface for programs that want to react to remote controls under Linux.

    You can find Perl interfaces to LIRC at Lirc.

      LIRC is indeed what you want. After you got that set up (even my exotic remote worked :) you can just use 'irexec' to hack some scripts together (I use bash) to do whatever you want. I currently run xmms, xawtv via the remote, as well as a little script that passes my last email to festival and a little snippet that will display the From and Subject header of my latest two emails on my screen, using osd_cat.

      --
      b10m

      All code is usually tested, but rarely trusted.
        LIRC sounds very promising, but I'm a tad confused as to exactly what I could use to get signals from my remote to the computer. The only two devices it lists in the "hardware" side are both in german so I'm not sure which I need/should get. What did you use to receive signals from your "exotic" remote?
Re: (Mostly OT) Using a remote with perl?
by andreychek (Parson) on Apr 07, 2004 at 17:28 UTC

    I was considering doing something like this using X10. You could do everything you need with the Active Home hardware. The pieces you would use are:

    • X10 Remote Control
    • X10 Transceiver Module (take the remote's RF signals and push them across your power line)
    • X10 Computer Interface

    With those, you could generate signals on the remote, and see them from your computer.

    On the software end of things, there's a number of choices available to you. Misterhouse is one of my favorites. It's a software package written in Perl that interacts with X10 devices. You could easily program it to control XMMS based on what X10 signals it seems going across your power line.

    This sounds like a fun project. Good luck with it,

    -Eric


    --
    Lucy: "What happens if you practice the piano for 20 years and then end up not being rich and famous?"
    Schroeder: "The joy is in the playing."
      This looked interesting, but when I looked at Misterhouse it only had a few events listed from x10 remotes:
        XM1MK
        X - every command will start with this
        M1 - the house code and unit
        MK - the house code and the command
      
        K here might be any of the following:
          J    - ON
          K    - OFF
          L    - brighten
          M    - dim 
          dd%  - Sets module to this brightness level
          +-dd - Bright/dims by this amount
      
      It doesn't seem like just these events would be enough to program a decent interface.
        I have an x10 RF remote (part of the boom2000 kit) hooked up to my windows machine. It has a setup screen which lets you assign functions to all of the buttons on the remote. I guess Mr. House just chose not to use them?

        There's some perl code for listening to x10 remotes in Talking Winamp RF remote control. I've never gotten around to trying it though.

        I think you can still do what you want. In setting up X10, you would set your remote for a particular "House Code", by default it's set to "A". Within each House Code, you have 16 Unit Code's that you can use.

        And then, within each Unit Code, you have the ability to turn it on, off, brighten, and dim.

        What I would probably do is make it so that pressing "Unit Code #1 On" in the remote has xmms start playing. "Unit Code #2 On" would go forward a song, "Unit Code #3 On" would go back a song, etc.

        Good luck

        -Eric


        --
        Lucy: "What happens if you practice the piano for 20 years and then end up not being rich and famous?"
        Schroeder: "The joy is in the playing."
Re: (Mostly OT) Using a remote with perl?
by Abigail-II (Bishop) on Apr 07, 2004 at 11:06 UTC
    Well, you'd first need some hardware - a remote, and a device that receives the signals from the remote. Then you need a driver so that you can communicate with the device, to see which signal(s) the remote sent. Then you would need some XS code to interface with the driver.

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://343248]
Approved by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-16 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found