Re: [AD] Problems with keyboard

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Done!, I found the error, the problem is that Sarge installed a new
version of linux-kernel-headers (2.5.999-test7-bk-16), where
<linux/keyboard.h> includes <linux/input.h>, and in this last file
there are definitions like:

[linux/input.h]
#define KEY_RESERVED            0
#define KEY_ESC                 1
#define KEY_1                   2
#define KEY_2                   3
#define KEY_3                   4
#define KEY_4                   5
#define KEY_5                   6
#define KEY_6                   7
...

This redefined all Allegro macros, so finally kernel_to_mycode gets
the original Linux scancodes:

static unsigned char kernel_to_mycode[128] =
{
   /* 0x00 */  0,              KEY_ESC,        KEY_1,          KEY_2,
   /* 0x04 */  KEY_3,          KEY_4,          KEY_5,          KEY_6,
...

It's the same that:

static unsigned char kernel_to_mycode[128] =
{
   /* 0x00 */  0,              1,	       2,              3,
   /* 0x04 */  4,	       5,              6,              7,
...

One solution is definining _INPUT_H after <linux/keyboard.h>:

#define _INPUT_H
#include <linux/kd.h>
#include <linux/keyboard.h>
#include <linux/vt.h>

Other solution is moving these includes to the top of the file, so
Allegro will overwrite the original Linux definitions. But there are
another thing: You know that gcc doesn't like redefinitions, but gcc
doesn't warn me about that <linux/input.h> redefines Allegro KEY_*
macros, but the inverse isn't true, gcc warn me when Allegro redefines
<linux/input.h> macros. How linux headers can disable the warning?
(some #pragma)

-- 
http://www.davidcapello.com.ar





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/