tech-kern archive

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

Final remote(4) / remote(9) API proposal



Here's the final remote API I'm proposing. Feedback?

  typedef uint32_t        remote_addr_t;
  typedef uint32_t        remote_command_t;

  struct remote_info {
        char    ri_devid[REMOTE_DEVID_LEN];
  };

  struct remote_event {
        uint8_t                 re_toggle;
        remote_addr_t           re_address;
        remote_command_t        re_command;
        struct timespec         re_time;
  };

  #define REMOTE_GINFO    _IOR('r', 0, struct remote_info)

The general idea is that the consumer ("remoted", more on that later) can map a deviceId/remoteAddress pair to a keymapping. Device ID is a unique ID for the receiver (with my driver I've been using the USB iSerialNumber to generate this; if the driver doesn't provide an ID the device name is used as default), and the remote address (0 if the remote protocol doesn't support this).

The driver API is very simple; after calling config_found_ia, a driver simply invokes for every input event:

void remote_input(device_t remotedev, uint8_t toggle, remote_addr_t address, remote_command_t command);

Cheers,
Jared


Home | Main Index | Thread Index | Old Index