From mboxrd@z Thu Jan 1 00:00:00 1970 From: David =?iso-8859-1?Q?H=E4rdeman?= Subject: Re: [RFC] What are the goals for the architecture of an in-kernel IR system? Date: Tue, 30 Mar 2010 13:01:38 +0200 Message-ID: <20100330110138.GA6164@hardeman.nu> References: <9e4733910912151229o371ee017tf3640d8f85728011@mail.gmail.com> <20091215203300.GL24406@elf.ucw.cz> <9e4733910912151245ne442a5dlcfee92609e364f70@mail.gmail.com> <9e4733910912151338n62b30af5i35f8d0963e6591c@mail.gmail.com> <4BAB7659.1040408@redhat.com> <20100326112755.GB5387@hardeman.nu> <4BACC769.6020906@redhat.com> <20100326160150.GA28804@core.coreip.homeip.net> <4BAFE4B7.2030204@redhat.com> <4BAFF985.3090703@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <4BAFF985.3090703@redhat.com> Sender: linux-media-owner@vger.kernel.org To: Mauro Carvalho Chehab Cc: Dmitry Torokhov , Jon Smirl , Pavel Machek , Krzysztof Halasa , hermann pitton , Christoph Bartelmus , awalls@radix.net, j@jannau.net, jarod@redhat.com, jarod@wilsonet.com, kraxel@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, superm1@ubuntu.com List-Id: linux-input@vger.kernel.org On Sun, Mar 28, 2010 at 09:51:17PM -0300, Mauro Carvalho Chehab wrote: >=20 > I spoke too soon... removing the index causes a problem at the read i= octl: there's no way > to retrieve just the non-sparsed values. >=20 > There's one solution that would allow both read/write and compat to w= ork nicely, > but the API would become somewhat asymmetrical: >=20 > At get (EVIOCGKEYCODEBIG): > use index/len as input and keycode/scancode as output; >=20 > At set (EVIOCSKEYCODEBIG): > use scancode/keycode/len as input (and, optionally, index as output)= =2E >=20 This was exactly the approach I had in mind when I suggested using=20 indexes. > Having it asymmetrical doesn't sound good, but, on the other hand,=20 > using index for > the set function also doesn't seem good, as the driver may reorder th= e entries after > setting, for example to work with a binary tree or with hashes. I don't think the assymetry is really a problem. As I see it, there are= =20 basically two user cases: 1) Userspace wants scancode X to generate keypress Y (In which case userspace doesn't care one iota what the index is) 2) Userspace wants to get the current keytable from the kernel (In which case a loop with an index from 0 to n is appropriate) and, possibly: 3) Userspace wants to know what keycode (if any) scancode X generates (In which case approach 2 will work just as well, but this usecase seems a bit contrived anyway...) --=20 David H=E4rdeman