[kmscon-devel] Add --xkb-keymap option

David Herrmann dh.herrmann at gmail.com
Sun Mar 10 16:09:22 PDT 2013


Hi Ran

On Sun, Mar 10, 2013 at 11:11 PM, Ran Benita <ran234 at gmail.com> wrote:
> On Sun, Mar 10, 2013 at 01:32:05PM +0100, David Herrmann wrote:
>> I was also thinking of adding a built-in keymap fallback that can be
>> used if none is found on the system. The build-system already provides
>> a way to link any raw text/binary file into the executable so it would
>> be really easy to implement with this patch.
>
> That's really nice, didn't think to do it with the linker. A basic
> keymap can be made quite small (still in text form). And it would be
> like the dumb_kbd backend comeback for free :)

Yes! I sometimes regret removing it. But this would be a nice way to
get dumb_kbd again.

>> However, I'd prefer using xkb_keymap_new_from_string() instead of
>> _from_file(). This would allow passing either a pointer to the
>> built-in keymap or to the mmap()'ed file. I can adjust the patch
>> myself, but I first wanted to hear your opinion on it.
>
> Sounds good to me, mmap'ing the file might even be faster (I haven't
> looked what flex does with a FILE*, but probably it just fread()'s it).
>
> One caveat though is that the string needs to be NUL-terminated, there's
> no size parameter. That's one API oversight. So if the file happens to
> be a multiple of the page size... But I think there are ways to work
> around that.

Ugh, would it be easy to implement xkb_keymap_new_from_memory() with a
size parameter? Or does the internal keymap parser require the
terminating zero, too?

I thought about it a little and I doubt that there is a good way to
get the terminating zero for mapped files. So I will go with
malloc()+fread() or something like this.

>> Btw., if keyboards get you bored and you need some new fancy projects,
>> how about doing a similar library for mice? That is, turning
>> xf86-input-synaptics into a library ;)
>
> Well, as an off-topic side note, I once read this document:
> http://www.ccs.neu.edu/home/shivers/papers/sre.txt
> And since then I try to keep in mind the stuff he talks about in the
> preamble. So clearly I'm still in the early stages with the keyboards :)
> But thanks for the suggestion, I might persue it when school is off
> again (if no one else does until then).

The other side is over-engineering. Hard to find the best way to go.
Anyway, I think I will create some small kmscon-internal library to
handle mouse/synaptics input. If it turns out to be useful and if I
did it right, it will be easy to turn it into a real library.
But I doubt that I have to time to do that, yet. So I will probably
end up copying evdev.c and evdev-touchpad.c from weston sources.

Thanks
David


More information about the kmscon-devel mailing list