From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Stezenbach Date: Mon, 14 Dec 2009 12:37:50 +0000 Subject: Re: [PATCH] keymap: support for force_release quirk Message-Id: <20091214123750.GA29583@sig21.net> List-Id: References: <20091214001219.GA17792@sig21.net> In-Reply-To: <20091214001219.GA17792@sig21.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: linux-hotplug@vger.kernel.org On Mon, Dec 14, 2009 at 11:34:31AM +0100, Kay Sievers wrote: > On Mon, Dec 14, 2009 at 11:28, Johannes Stezenbach wrote: > > On Mon, Dec 14, 2009 at 10:14:50AM +0100, Martin Pitt wrote: > >> > >> A gotcha that I see here is that the force_release only ever gets > >> appended to. I. e. whenever we run udevtrigger, we'd append the same > >> keys again. POSIX shell doesn't have elaborate substring matching > >> capabilities like bash's ${x/pattern/string}, so it might not be too > >> easy to check if we already have a key in POSIX sh. (But please don't > >> call grep in a loop; let's rather rewrite this bit in C). There might > >> be some trickery with splitting by IFS=3D, into an array or so, if you > >> want to keep using sh? > > > > The problem is that force_release is preset by the kernel, so > > in order to do what you want we need either > > a) pass both old and new key list on "change" > > b) save initial force_release value to a file on "add" > > =A0 and use the file on "change" >=20 > It should just not mangle the sysfs string if the value is already > contained. Why would you need to store anything between a "change" and > "add" event? Both events are handled the same way, and the two > independent events run one after each other. I don't understand. I only append to the force_release attribute because the kernel already removes duplicates. However, what does not work this way is to remove scancodes from force_release. I thought that was what Martin wanted to accomplish on the "change" event. > I guess the logic to append a value to the sysfs string only if needed > should be done in a tine C program, or a sed script with a RUN+=3D call > directly to sed maybe can be used ... sed cannot do hex to decimal conversion, but awk could be used. Thanks, Johannes