guozhong chen

I don’t know how to set the x, that keyboard drive can be loaded correctly.

Discussion created by guozhong chen on Oct 13, 2011

 Freescale development kit provides two options—— Preconfig Min Profile and

FSL gnome release package.

The first option will not compile gtk+gstreamer,and X11lib.

The second option will generate the …… but the file that generates the rootfs directory too large.

I just need the minimum configuration to run gtk application. So I chose the first option——Preconfig Min Profile. And then config the kernel to compile gtk+ libgstreamer lib , and X11.

Because the target board without matrix keyboard, only use the keys of linking GPIO instead. I modify the routine. Adding the configuration code—— gpio_keys_button as follow:

 

#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)

 

 

static struct gpio_keys_button mx23evk_gpio_buttons[] = {

 

{

 

.gpio = MXS_PIN_TO_GPIO(PINID_SSP1_DETECT),

 

.type = EV_KEY,

 

.code = KEY_A,//KEY_VOLUMEUP,

 

.desc = "SW105",

 

.active_low = 1,

 

.wakeup = 1,

 

},

 

 

 

{

 

.gpio = MXS_PIN_TO_GPIO(PINID_SSP1_DATA0),

 

.type = EV_KEY,

 

.code = KEY_B,//KEY_UP,

 

.desc = "SW108",

 

.active_low = 1,

 

.wakeup = 1,

 

},

 

{

 

.gpio = MXS_PIN_TO_GPIO(PINID_SSP1_DATA1),

 

.type = EV_KEY,

 

.code = KEY_C,//KEY_DOWN,

 

.desc = "SW107",

 

.active_low = 1,

 

.wakeup = 1,

 

},

 

{

 

.gpio = MXS_PIN_TO_GPIO(PINID_SSP1_DATA2),

 

.type = EV_KEY,

 

.code = KEY_D,//KEY_VOLUMEDOWN,

 

.desc = "SW106",

 

.active_low = 1,

 

.wakeup = 1,

 

},

 

{

 

.gpio = MXS_PIN_TO_GPIO(PINID_SSP1_CMD),

 

.type = EV_KEY,

 

.code = KEY_E,//KEY_ESC,

 

.desc = "SW109",

 

.active_low = 1,

 

.wakeup = 1,

 

},

 

 

 

};

 

 

 

 

 

static struct gpio_keys_platform_data mx23evk_gpio_button_data = {

 

.buttons = mx23evk_gpio_buttons,

 

.nbuttons = ARRAY_SIZE(mx23evk_gpio_buttons),

 

};

 

 

 

static struct platform_device mx23evk_gpio_button_device = {

 

.name = "gpio-keys",

 

.id = -1,

 

.num_resources = 0,

 

.dev = {

 

.platform_data = &mx23evk_gpio_button_data,

 

}

 

};

 

 

 

 

 

static void __init mx23_init_gpio_keyboard(void)

 

{

 

platform_device_register(&mx23evk_gpio_button_device);

 

}

 

 

 

 

 

int __init mx23_device_init(void)

 

{

 

 

 

..........

 

..........

 

//add function call in the initialization of device

 

mx23_init_gpio_keyboard();

 

 

 

return 0;

 

}

 

 

 

#endif

 

 

 

And then configure the kernel to enable the GPIO Buttons:

 

 

 

Device Drivers --->

 

Input device support --->

 

[*] Keyboards --->

 

<*> GPIO Buttons

 

 

 

When download the kernel and rootfs to target board. Target board runs and displays:

 

 

 

input: gpio-keys as /class/input/input0

 

input: mxs-kbd as /class/input/input1

 

input: MXS touchscreen as /class/input/input2

 

 

 

Prove gpio-keys driver has been loaded. The information of "printk" prove "input_event" function run correctly.

 

And the function "is_event_supported(type, dev->evbit, EV_MAX)" returns true.

 

 

 

 

 

static void gpio_keys_report_event(struct work_struct *work)

 

{

 

struct gpio_button_data *bdata =

 

container_of(work, struct gpio_button_data, work);

 

struct gpio_keys_button *button = bdata->button;

 

struct input_dev *input = bdata->input;

 

unsigned int type = button->type ?: EV_KEY;

 

int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low;

 

/*inkfish debug*/

 

printk(KERN_INFO "%s %s %d\r\n", __FILE__, __FUNCTION__, __LINE__);

 

printk(KERN_INFO "type=%d, button->code=%d, state=%d\r\n", type, button->code, state);

 

input_event(input, type, button->code, !!state);

 

input_sync(input);

 

}

 

 

 

void input_event(struct input_dev *dev,

 

unsigned int type, unsigned int code, int value)

 

{

 

unsigned long flags;

 

 

 

if (is_event_supported(type, dev->evbit, EV_MAX)) {

 

/*inkfish debug*/

 

printk(KERN_INFO "%s %s %d\r\n", __FILE__, __FUNCTION__, __LINE__);

 

 

 

spin_lock_irqsave(&dev->event_lock, flags);

 

add_input_randomness(type, code, value);

 

input_handle_event(dev, type, code, value);

 

spin_unlock_irqrestore(&dev->event_lock, flags);

 

}

 

}

 

 

 

But now I don’t know how to set the x so that keyboard drive can be loaded correctly at the boot.

 

 

Xfbdev -keybd gpio-keys,,device=/dev/input/event0

 

(EE) XKB: Couldn't open rules file /usr/share/X11/xkb/rules/base

 

(EE) XKB: No components provided for device Virtual core keyboard

 

Cannot find keyboard driver gpio-keys

 

The result does not correctly. Why?

 

 

I uploaded my linux kernel config file -- attach Files.

Attachments

Outcomes