Re: [RFC] What are the goals for the architecture of an in-kernel IR system?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David =?iso-8859-1?Q?H=E4rdeman?=
Date: Friday, March 26, 2010 - 4:27 am

On Thu, Mar 25, 2010 at 11:42:33AM -0300, Mauro Carvalho Chehab wrote:

I'd suggest:

struct keycode_table_entry {
	unsigned keycode;
	unsigned index;
	unsigned len;
	char scancode[];
};

Use index in EVIOCGKEYCODEBIG to look up a keycode (all other fields are 
ignored), that way no special function to clear the table is necessary, 
instead you do a loop with:

EVIOCGKEYCODEBIG (with index 0)
EVIOCSKEYCODEBIG (with the returned struct from EVIOCGKEYCODEBIG and
		  keycode = KEY_RESERVED)

until EVIOCGKEYCODEBIG returns an error.

This also allows you to get all the current mappings from the kernel 
without having to blindly search through an arbitrarily large keyspace.

Also, EVIOCLEARKEYCODEBIG should be:

#define EVIOCLEARKEYCODEBIG _IOR('E', 0x04, struct keycode_table_entry)

That way a user space application can simply call EVIOCLEARKEYCODEBIG, 
ask the user for an appropriate keycode, fill in the keycode member of 
the struct returned from EVIOCLEARKEYCODEBIG and call EVIOCSKEYCODEBIG.

On a related note, I really think the interface would benefit from 
allowing more than one keytable per irrcv device with an input device 
created per keytable. That way you can have one input device per remote 
control. This implies that EVIOCLEARKEYCODEBIG is a bit misplaced as an 
evdev IOCTL since there's an N-1 mapping between input devices and irrcv 
devices.

ioctl's to set/get keycodes for ir should also take a flag parameter in 
the struct to allow special properties to be set/returned for a given 
keycode mapping (I'm thinking of keycodes which powers on the computer 
for instance, that should be exposed to userspace somehow).

With all of that, the struct might need to be something like:

struct keycode_table_entry {
	unsigned keycode; /* e.g. KEY_A */
	unsigned table;   /* Table index, for multiple keytables */
	unsigned index;   /* Index in the given keytable */
	unsigned flags;   /* For additional functionality */
	unsigned len;     /* Of the struct */
	char scancode[];  /* Per-protocol scancode data follows */
};

Finally, I think irrcv should create a chardev of its own with ioctl's 
like EVIOCLEARKEYCODEBIG (and RX/TX parameter setting ioctl's).  The 
same chardev can be used for IR blasting (by writing data to it once TX 
parameters have been set).


-- 
David Härdeman
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC] What are the goals for the architecture of an in ..., Christoph Bartelmus, (Fri Dec 4, 4:01 pm)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Sun Dec 6, 4:46 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Mon Dec 7, 8:36 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Mon Dec 7, 4:44 pm)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 4:17 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 4:23 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 4:58 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 7:07 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 7:13 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 7:56 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 8:41 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 8, 8:49 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Sun Dec 13, 5:14 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 15, 6:33 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Dec 15, 7:19 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Thu Mar 25, 7:42 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Thu Mar 25, 12:00 pm)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Fri Mar 26, 4:04 am)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Fri Mar 26, 4:27 am)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Fri Mar 26, 5:23 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Mar 26, 7:40 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Mar 26, 8:17 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Mar 26, 10:22 am)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Fri Mar 26, 12:07 pm)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Fri Mar 26, 12:21 pm)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Sat Mar 27, 1:27 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Sun Mar 28, 4:22 pm)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Sun Mar 28, 5:51 pm)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Tue Mar 30, 4:01 am)
Re: [RFC] What are the goals for the architecture of an in ..., David =?iso-8859-1?Q ..., (Tue Mar 30, 4:09 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Mar 30, 5:43 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Tue Mar 30, 11:01 pm)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Apr 9, 6:01 am)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Apr 9, 4:32 pm)
Re: [RFC] What are the goals for the architecture of an in ..., Mauro Carvalho Chehab, (Fri Apr 9, 6:01 pm)