tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal for reporting remote control button presses to userland



On Wed, 8 Oct 2008, Jared D. McNeill wrote:

Ok, I think I have a plan. Is this cool with everybody?


I'd like to add a wsremote(4) device that uses its own wsmux. Add new WSCONS_EVENT_REMOTE_UP/DOWN event type definitions, and feed struct wscons_events for button presses/releases.

We'll deliver raw keycodes to userland, and a 'wsremoted' service that can run which loads a buttonmap (it's going to be different for each remote, lets use /usr/pkg/share/wsremote/ati_tv_wonder_600.plist as an example) and can translate raw button codes to cooked ones on a socket, lets say /var/run/wsremoted.sock. Message format can be something like:

 <?xml version="1.0" encoding="UTF-8"?>
 <plist version="1.0">
 <dict>
   <key>source</key>
   <string>wsremote0</string>
   <key>event</key>
   <string>button-pressed</string>
   <key>command</key>
   <string>volume-up</string>
 </dict>

An application can then listen on that socket for button presses and do whatever it feels like (application might be MythTV, lirc, mplayer, etc).

        A couple of thoughts (some probably more useful than others)

        - You don't mention if the devices export some identifier to
          wsremote - for example if I had two remote providing devices
          that attached dynamically (say via USB), the wsremote0/wsremote1
          order may change, so it would be good to know (if possible)
          which is which, whether its some device type or serial
          identifier, assuming such is available to the driver

        - How would you provide a simple 'run command X for key mapping Y'?
          Could have be a simple reader of wsremoted.sock which invokes a
          command passing the key details as args, or even putting that
          functionality in wsremoted?

        - Could it handle needing to deliver different commands from
          the same device to different targets. For example, volume up/down
          to a shell script, various other options to MythTV, and everything
          else simulate normal keyboard imput? Might be possible to do with
          a script in the above 'command with args' option, but that
          would incur additional latency on each command. Maybe have the
          option to have multiple 'wsremoted.sock's and a map of which
          keymapped command goes where.

        Longer term thoughts:

        - Could this replace usbhidacton?

        - A lirc compatible reader of /var/run/wsremoted.sock would be
          a nice additional app

        Anyway, excellent idea ;)


--
                David/absolute       -- www.NetBSD.org: No hype required --


Home | Main Index | Thread Index | Old Index