tech-kern archive

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

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



Iain Hibbert wrote:
On Thu, 9 Oct 2008, Jared D. McNeill wrote:

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

  typedef uint32_t        remote_addr_t;

this could do with being 48-bits at least (I don't know if the Sony PS3
Bluetooth remote provides an identifier, but the bdaddr which could be
otherwise used is 48bit and in the futureworld where everything has an
IPv6 device I can see it being needed)

I had assumed in the bluetooth configuration that the receiver ID (see below) would be the MAC address, and the remote address would be 0. We can bump this to 64-bit anyway, though.

  typedef uint32_t        remote_command_t;

again, I don't exactly know if this is enough for a HID remote - the only
information I have 'seems' to show that the PS3 remote provides 11 bytes
of input data (this is from a posting on the FreeBSD bluetooth list):

Input   id=1 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=1 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=2 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=3 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=4 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=5 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Feature id=6 size=8 count=11 page=Microsoft usage=0x0001, logical range 0..255
Collection page=Generic_Desktop usage=Game_Pad

but it could just be a bitmask that could be decoded to 88 individual
events.

Not a problem again to increase the size here. Do you think 64-bits would be enough or would you like the command to be eg. a 16-byte uint8_t array?

  struct remote_info {
        char    ri_devid[REMOTE_DEVID_LEN];
  };

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

so, this would be something like "uirda0-3343" for device ID 3343 sending
events via uirda0 ?

The intent is to not use device_xname so attach order doesn't matter. My ATI receiver reports a serial number of 660808003247 for example, so no matter the order of remote or emdtv attachments, I will always know that this piece of hardware has generated an event.

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

you didn't say how events are transmitted out of the /dev/wsremote0, will
it be possible to extend the event structure in the future?

These are returned when a read for sizeof(struct remote_event) bytes is issued. We can extend the event structure later if required simply by making it larger.

I'm not sure what the features are above, but sometimes that is a way to
set configuration options on the device. I should ignore that for now, but
it would be nice to leave room in the API for that kind of thing..

Always good to keep those things in mind :)

Cheers,
Jared


Home | Main Index | Thread Index | Old Index