Roverbook steel. Проект Debian вместо Android.

Назад Главная


Roverbook steel. Проект Debian вместо Android.

Клавиатура

При нажатом CapsLock вместо букв абракадабра. Практически все не буквенно-цифровые кнопки не обрабатываются (генерятся неизвестные сканд-коды). В диалоговом окне ввода логина-пароля иногда символы вводятся, но не отображаются (логин-пароль не отображается, но вход в систему происходит)

Работа клавиатуры в Debian лучше, чем в Android: нет эффекта "нажал одну клавишу, получил другую". По крайней мере это работает для буквенно-цифровых кнопок. Проверял на OpenOffice. Более того, сам офис работает!

Я думал, что OpenOffice на Rover будет жутко тормозить. Оказалось, что загрузка процессора нормальная: отрытие меню (т.е. скорее всего вследствии нагрузки для прорисовки графики) требует от процессора 50-60%, в режиме ожидания офис забирает около 27% от CPU (процесс soffice.bin - 2.9%). Набирать текст и вставлять картинки в документ не пробовал, но есть все основания предпологать, что работать с документами можно будет с приемлемым комфортом!

Контроллер клавиатуры на Steel выполнен на программируемом микроконтроллере Fujitsu mb95f334k (жаль, что программатор стоит как сам смартбук). Это программа выдает скан-коды оптимизированные для Android. Требуется изменить карту кодов клавиатуры (keyboard map), чтобы Debian корректно понимал нажатые кнопки. В большинстве своем все работает нормально. Но ряд нужных кнопок нет:

Скан-коды клавиатуры RoverBook Steel

Проверял программой xev
Обозначения:


Кнопка (код 182) RU переключает раскладку (внутри контроллера, но Debian перестает понимать коды)
Кнопка Menu и Робот (67) == Ctrl_L
Правая верхняя без рисунка (90) == Insert
Delete = BackSpace (22) == BackSpace
Shift+3 (забыл записать) == ESC
Shift+5 (ff97) == стрелка вверх
Shift+7 (ff96) == стрелка влево
Shift+9 (ff98) == стрелка вправо
Shift+[ (ff99) == стрелка вниз
Shift+R (ff7e) == mode swicth
Shift+T (3c) == <
Shift+H (ff9d) == Begin (Home)
Shift+J (ff7f) == NumLock
Shift+K (ffab) == +
Shift+L (ffaf) == -
Shift+" (ffc6) == F9
Shift+Z (забыл записать) == *
Shift+X (забыл записать) == ScrollLock

Возможные пути решения

Вариант 1

Keyboard map (layout)

Change console keyboard layout in debian

Posted on 02 May 2006 by Angus Hardie

I’ve been using Parallels Workstation virtualization a lot recently for testing databases and it works amazingly well.

However I did come across a weird problem. I’d installed Debian linux and the console keyboard layout wasn’t correct for my Apple USB keyboard.

The solution was to use this command

dpkg-reconfigure console-data

Which walked me through selecting the right keyboard layout.

Djamu posted a comment suggesting that the following command might work better for server installations:

dpkg-reconfigure keyboard-configuration

console-data пришлось на большом компьютере установить, чтобы сделать snapshot
#apt-get install console-data


Вариант 2

источник

Debian Etch Server

Default Language
dpkg-reconfigure locales
Keyboard Layout
dpkg-reconfigure console-data

Вариант 2.2

источник
Change the language with
dpkg-reconfigure locales
Change the default keyboard layout
dpkg-reconfigure console-data
dpkg-reconfigure console-setup
That’s it, much more comfortable…

Вариант 3

источник

Debian Manual - Printing Your X Windows Keymap

You might be supprised to know that your X Windows system can handle, by default, the typing of a wide range of characters that aren't generally found on your keyboard. Before I go on I have to say that I am in the UK and thus use a UK keyboard. Some of the characters I can type aren't found on my keyboard but if you are reading this ourside the UK they may be on yours. Further more, the characters you can type are dependent on the keymap currently in use. For instance I could set my keyboard up to use say Chinese symbols and then I wouldn't be able to type any English symbols. This guide will show you how to print out the keymap for your curent display.

First open a shell and enter the command

xkbcomp -xkm $DISPLAY

this will create a file in the directory in which it is run called something like "server-0_0.xkm" which is the X keyboard map for your current display. This file is needed in order to generate the printable keyboard map file.

Now taking the file from above run it though this command

xkbprint -eps -color -fit -ll 2 -level2 server-0_0.xkm server-0_0.eps

which will give you an eps file showing the basic keymapings that you can use. Alternativly you can also perform the above two steps in a single step using

xkbprint -eps -color -fit -ll 2 -level2 $DISPLAY server-0_0.eps

If you want to change your locale such that it is using UTF-8 and able to send extended characters correctly then you need to do the following.

First run

dpkg-reconfigure locales

and select a UTF-8 locale from the list. Then you need to add the following two lines to /etc/profile

export LANG=en_GB.UTF-8

export LC_ALL=en_GB.UTF-8

You will need to log out and log back in to ensure that these get read. Finally check that everything is ok by opening a console and running the command

locale

Which should give out put looking something like this

LANG=en_GB.UTF-8

LC_CTYPE="en_GB.UTF-8"

LC_NUMERIC="en_GB.UTF-8"

LC_TIME="en_GB.UTF-8"

LC_COLLATE="en_GB.UTF-8"

LC_MONETARY="en_GB.UTF-8"

LC_MESSAGES="en_GB.UTF-8"

LC_PAPER="en_GB.UTF-8"

LC_NAME="en_GB.UTF-8"

LC_ADDRESS="en_GB.UTF-8"

LC_TELEPHONE="en_GB.UTF-8"

LC_MEASUREMENT="en_GB.UTF-8"

LC_IDENTIFICATION="en_GB.UTF-8"

LC_ALL=en_GB.UTF-8

If it doesn't first try logging in as yourself again at the command prompt with "su - username" because you may be using a non-login shell (this is probably true if you are using konsole). You might also want to read this page.


Вариант 4

источник

Debian: change the keyboard layout from the console

I’ve installed a new test system to play around a little bit (a Debian Squeeze install). Since I was too lazy to install it from scratch and I’m using VMWare anyway, I thought I’d just download a pre-installed virtual machine.

Now this virtual machine had a US keyboard configured and I’m using a German keyboard. After googling for how to change the keyboard layout from the console, I found a few hints:

dpkg-reconfigure console-data

Unfortunately the package console-data is not installed on my system.

Then I found the following:

dpkg-reconfigure keyboard-configuration

This package is installed and you can choose a keyboard layout. Great !

After saving, I pressed “Z” and got a “Y” on the console. So still having a US keyboard configured.

Since keyboard-configuration modifies the file /etc/default/keyboard, I checked this file:

# cat /etc/default/keyboard
# Check /usr/share/doc/keyboard-configuration/README.Debian for
# documentation on what to do after having modified this file.
# The following variables describe your keyboard and can have the same
# values as the XkbModel, XkbLayout, XkbVariant and XkbOptions options
# in /etc/X11/xorg.conf.

XKBMODEL=”pc105″
XKBLAYOUT=”de”
XKBVARIANT=”nodeadkeys”
XKBOPTIONS=”"

# If you don’t want to use the XKB layout on the console, you can
# specify an alternative keymap. Make sure it will be accessible
# before /usr is mounted.
# KMAP=/etc/console-setup/defkeymap.kmap.gz

Everything looks fine… But the hint in the beginning of the file might be pointing to the solution. So let’s check this README.Debian file:

# cat /usr/share/doc/keyboard-configuration/README.Debian
After modifying /etc/default/keyboard, you can apply the changes to the linux console by running setupcon. If X is configured to use that file too, then the changes will become visible to X only if

udevadm trigger –subsystem-match=input –action=change

There is the solution:

#setupcon

And the keyboard layout is German !!


Вариант 5

источник
Для slack

90-keyboard-layout.conf has nothing to do with the console. Create a file under /etc/rc.d called 'rc.keymap' and then past this in there:

#!/bin/sh
# Load the keyboard map.  More maps are in /usr/share/kbd/keymaps.
if [ -x /usr/bin/loadkeys ]; then
 /usr/bin/loadkeys de-latin1.map
fi
chmod +x /etc/rc.d/rc.keymap

Edit to load your preferred keyboard layout. Make sure it is executbale and it will be run each time you boot. You can have it take effect immediately by simply running it:

/etc/rc.d/rc.keymap

Usually this is file is created when you first install your system if you have chosen an alternate keyboard map during installation.


dirvers\input\keyboard
Makefile
#
# Makefile for the input core drivers.
#

# Each configuration option enables a list of files.
ifeq ($(CONFIG_RK2818_SDK),y)
obj-$(CONFIG_BUTTON_RK28AD)             += rk28_ad_button_sdk.o
endif
ifeq ($(CONFIG_RK2818_A7),y)
obj-$(CONFIG_BUTTON_RK28AD)             += rk28_ad_button.o
endif

obj-$(CONFIG_BUTTON_RK28AD_M7U)             += rk28_ad_button_M7U.o
obj-$(CONFIG_BUTTON_RK28AD_M703U)             += rk28_ad_button_M703U.o


ifeq ($(CONFIG_MACH_LANMO_W7),y)
obj-$(CONFIG_BUTTON_RK28AD)             += lanmow7_keypad.o
endif
obj-$(CONFIG_KEYBOARD_RK28ATBD)		+= rk28_atkeyboard.o
obj-$(CONFIG_KEYBOARD_ATKBD)		+= atkbd.o
obj-$(CONFIG_KEYBOARD_SUNKBD)		+= sunkbd.o
obj-$(CONFIG_KEYBOARD_LKKBD)		+= lkkbd.o
obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
obj-$(CONFIG_KEYBOARD_AMIGA)		+= amikbd.o
obj-$(CONFIG_KEYBOARD_ATARI)		+= atakbd.o
obj-$(CONFIG_KEYBOARD_LOCOMO)		+= locomokbd.o
obj-$(CONFIG_KEYBOARD_NEWTON)		+= newtonkbd.o
obj-$(CONFIG_KEYBOARD_STOWAWAY)		+= stowaway.o
obj-$(CONFIG_KEYBOARD_CORGI)		+= corgikbd.o
obj-$(CONFIG_KEYBOARD_SPITZ)		+= spitzkbd.o
obj-$(CONFIG_KEYBOARD_TOSA)		+= tosakbd.o
obj-$(CONFIG_KEYBOARD_HIL)		+= hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD)		+= hilkbd.o
obj-$(CONFIG_KEYBOARD_OMAP)		+= omap-keypad.o
obj-$(CONFIG_KEYBOARD_PXA27x)		+= pxa27x_keypad.o
obj-$(CONFIG_KEYBOARD_AAED2000)		+= aaed2000_kbd.o
obj-$(CONFIG_KEYBOARD_GPIO)		+= gpio_keys.o
obj-$(CONFIG_KEYBOARD_GOLDFISH_EVENTS)	+= goldfish_events.o
obj-$(CONFIG_KEYBOARD_HP6XX)		+= jornada680_kbd.o
obj-$(CONFIG_KEYBOARD_HP7XX)		+= jornada720_kbd.o
obj-$(CONFIG_KEYBOARD_MAPLE)		+= maple_keyb.o
obj-$(CONFIG_KEYBOARD_BFIN)		+= bf54x-keys.o
rk28_ad_button_sdk.c
/*
 * linux/drivers/input/keyboard/rk28_ad_button.c
 *
 * Driver for the rk28 matrix keyboard controller.
 *
 * Created: 2009-5-4
 * Author:	LZJ <lzj@rockchip.com>
 *
 * This driver program support to AD key which use for rk28 chip
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */


#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/input.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/delay.h>

#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>

#include <asm/arch/typedef.h>
#include <asm/arch/gpio.h>
#include <asm/arch/hardware.h>
#include <asm/arch/iomux.h>
#include <asm/arch/adc.h>

/* ************
 *	  DEBUG
 **************/

#if 0
#define DBG(x...)	printk(KERN_INFO x)
#else
#define DBG(x...)
#endif
#define SHOWME	"Keyboard"
//#define S_LEVEL  S_L_WARN
#define S_LEVEL  S_L_ERROR
#include <asm/arch/rk28_debug.h>


#define WAKEUP_KEY_PORT PLAY_ON_IOPIN
//ROCKCHIP AD KEY CODE ,for demo board
//      key		--->	EV	
#if 1
#define AD1KEY1		103//DPAD_UP	----------UP
#define AD1KEY2 		106//DPAD_RIGHT-------FFD
#define AD1KEY3 		105//DPAD_LEFT--------FFW	
#define AD1KEY4 		108//DPAD_DOWN------DOWN		#define AD1KEY5		158//62   //ENDCALL           WAKE_DROPPED
#define AD1KEY5		ENDCALL       //    WAKE_DROPPED
#define AD1KEY6		ENDCALL        //   WAKE_DROPPED

#define AD2KEY1		114   //VOLUME_DOWN  	 	59	//MENU			//115   //VOLUME_UP
#define AD2KEY2 		115   //VOLUME_UP      		//114   //VOLUME_DOWN
#define AD2KEY3 		59	//MENU	
#define AD2KEY4 		102   //HOME				//62   //ENDCALL  		
#define AD2KEY5 		158	//BACK----ESC   		115   //VOLUME_UP	//158	//BACK------------ESC
#define AD2KEY6 		116	//POWER
#else 
#define AD1KEY1 		103//DPAD_UP	----------UP
#define AD1KEY2 		106//DPAD_RIGHT-------FFD
#define AD1KEY3 		105//DPAD_LEFT--------FFW	
#define AD1KEY4 		108//DPAD_DOWN------DOWN		
#define AD1KEY5 		28    //ENTER
#define AD1KEY6 		28    //ENTER

#define AD2KEY1 		103//DPAD_UP	----------UP
#define AD2KEY2 		106//DPAD_RIGHT-------FFD
#define AD2KEY3 		108//DPAD_DOWN------DOWN
#define AD2KEY4 		59	//MENU		
#define AD2KEY5 		158 //BACK------------ESC
#define AD2KEY6 		116 //POWER

#endif
#define Valuedrift		70
#define EmptyADValue			950  //1000
#define InvalidADValue	10
#define ADKEYNum		12

/*power event button*/
#define  POWER				116
#define  ENDCALL				62
#define  ONESEC_TIMES		100
#define  SEC_NUM			1
#define  SLEEP_TIME			2	/*per 40ms*/
static unsigned  int	pwrscantimes = 0;
static unsigned  int valuecount = 0;
static unsigned  int g_code = 0;
static unsigned  int g_wake =0;

static unsigned int 	encall_times = 100;

#define KEY_PHYS_NAME	"rk28_AD_button/input0"
//ADC Registers
typedef  struct tagADC_keyst
{
	unsigned int adc_value;
	unsigned int adc_keycode;
}ADC_keyst,*pADC_keyst;

//	adc	 ---> key	
static  ADC_keyst ad1valuetab[] = {
	{ 95, AD1KEY1},
	{247,AD1KEY2},
	{403,AD1KEY3},
	{561,AD1KEY4},
	{723,AD1KEY5},
//	{899,AD1KEY6},

	{EmptyADValue,0}
};
static  ADC_keyst ad2valuetab[] = {
	{95,  AD2KEY1},
	{249, AD2KEY2},
	{406, AD2KEY3},
	{561, AD2KEY4},
	{726, AD2KEY5},
//	{899, AD2KEY6},
	
	{EmptyADValue,0}

};

static int encall_time = 0;
static int esc_time = 0;

//key code tab
static unsigned char initkey_code[ ] = 
{
	AD1KEY1, AD1KEY2,AD1KEY3,AD1KEY4,AD1KEY5,AD1KEY6,
	AD2KEY1, AD2KEY2,AD2KEY3,AD2KEY4,AD2KEY5,AD2KEY6,ENDCALL	,KEY_WAKEUP
};


struct rk28_AD_button_platform_data {
	int x;
	
};

struct rk28_AD_button {
	struct rk28_AD_button_platform_data *pdata;
	struct timer_list timer;

	struct clk *clk;
	struct input_dev *input_dev;
	void __iomem *mmio_base;
	/* matrix key code map */
	unsigned char keycodes[13];
	/* state row bits of each column scan */
	uint32_t direct_key_state;
	unsigned int direct_key_mask;
	int rotary_rel_code[2];
	int rotary_up_key[2];
	int rotary_down_key[2];
};

 struct rk28_AD_button *prockAD_button;


extern 	void  RockAdcScanning(void);
extern 	void  printADCValue(void);
extern 	int32 ADCInit(void);
extern 	int get_rock_adc1(void);
extern	int get_rock_adc2(void);

unsigned int find_rock_adkeycode(unsigned int advalue,pADC_keyst ptab)
{	
	while(ptab->adc_value!=EmptyADValue)
		{
			if((advalue>ptab->adc_value-Valuedrift)&&(advalue<ptab->adc_value+Valuedrift))
				return ptab->adc_keycode;
			ptab++;
		}
	
	return 0;
}


static int rk28_AD_button_open(struct input_dev *dev)
{
//	struct rk28_AD_button *AD_button = input_get_drvdata(dev);


	return 0;
}

static void rk28_AD_button_close(struct input_dev *dev)
{
//	struct rk28_AD_button *AD_button = input_get_drvdata(dev);

}

#define res_size(res)	((res)->end - (res)->start + 1)

int keydata=58;
static  int ADSampleTimes = 0;

static void rk28_adkeyscan_timer(unsigned long data)
{
	unsigned int ADKEY1,code = 0;
	static int sign = 1;
	/*Enable  AD controller to sample */
	prockAD_button->timer.expires  = jiffies+msecs_to_jiffies(10);
	add_timer(&prockAD_button->timer);
	RockAdcScanning();
	if (ADSampleTimes < 4)
	{
		ADSampleTimes ++;		
		goto scan_io_key;  	/* scan gpio button event*/
	}
	ADSampleTimes = 0;	
	/*Get button value*/
	ADKEY1=get_rock_adc1();
#ifdef CONFIG_RK2818_SDK		/*xxm*/
	if((ADKEY1>EmptyADValue)&&(ADKEY1<=InvalidADValue))  
		goto scan_io_key1;
	valuecount++;
	if(valuecount < 2)
		goto scan_code;	
	code=find_rock_adkeycode(ADKEY1,ad2valuetab);
	valuecount = 2;	
	goto scan_code;  ///scan_code;	
scan_io_key1:
	valuecount = 0;	

scan_code:	
	if((g_code == 0) && (code == 0))
	    goto scan_io_key; 
	if(code != 0)
	{
		if(valuecount<2)
			goto scan_io_key; 
		if(g_code == 0)
		{
			g_code = code;
			DBG("\n %s::%d rock adc1 key scan ,find press down a key=%d  \n",__func__,__LINE__,g_code);
			input_report_key(prockAD_button->input_dev,g_code,1);
	        input_sync(prockAD_button->input_dev);
	        goto scan_io_key; 
		}
		else
		{
			if(g_code != code)
			{
				DBG("\n %s::%d rock adc1 key scan ,find press up a key=%d  \n",__func__,__LINE__,g_code);
				input_report_key(prockAD_button->input_dev,g_code,0);
				input_sync(prockAD_button->input_dev);
				DBG("\n %s::%d rock adc1 key scan ,find press down a key=%d  \n",__func__,__LINE__,code);
				input_report_key(prockAD_button->input_dev,code,1);
				input_sync(prockAD_button->input_dev);
				g_code = code;
				goto scan_io_key; 
			}
		}
    
    }
	if((g_code != 0)&&(code == 0)&&(ADSampleTimes == 0))
	{
		DBG("\n %s::%d rock adc1 key scan ,find press up a key=%d  \n",__func__,__LINE__,g_code);
#ifdef CONFIG_RK2818_SDK
	    input_report_key(prockAD_button->input_dev,g_code,0);
	    input_sync(prockAD_button->input_dev);
#endif	
		valuecount = 0;
		g_code = 0;
		goto scan_io_key;
	}
#endif	
scan_io_key :
	if(!GPIOGetPinLevel(PLAY_ON_IOPIN))				/*xxm*/
	{
		pwrscantimes += 1;
		if(pwrscantimes == (SEC_NUM * ONESEC_TIMES))
		{
			input_report_key(prockAD_button->input_dev,ENDCALL,1);
			input_sync(prockAD_button->input_dev);
			printk("the kernel come to power down!!!\n");
			encall_times = 100;
		}
		if(pwrscantimes ==( (SEC_NUM + 1)* ONESEC_TIMES))
		{
			pwrscantimes = 0;
			input_report_key(prockAD_button->input_dev,ENDCALL,0);
			input_sync(prockAD_button->input_dev);
			printk("the kernel come to power up!!!\n");
			encall_times = 100;
		}
		return ;
	}
	else
	{
		if(encall_times > 0)
			encall_times--;
	}
	if( pwrscantimes > SLEEP_TIME )
	{
		pwrscantimes = 0;
		if(rk2818_get_suspend_flags() !=  PM_AWAKE)
		{
			if(rk2818_get_suspend_flags() == PM_TWOLEVEL_SLEEP)	/*already wake up*/
			{
				printk("\n%s^^Wake Up from key IRQ^^!!\n",__FUNCTION__);
				return;
			}
			if(encall_times == 0) 
			{
				input_report_key(prockAD_button->input_dev,158,1);
				input_sync(prockAD_button->input_dev);
				input_report_key(prockAD_button->input_dev,158,0);
				input_sync(prockAD_button->input_dev);
				printk("[xxm]%s~~~wake up~~~\r\n",__func__);
			}
		}
		else
		{
			if(encall_times == 0) 
			{
				input_report_key(prockAD_button->input_dev,62,1);
				input_sync(prockAD_button->input_dev);
				input_report_key(prockAD_button->input_dev,62,0);
				input_sync(prockAD_button->input_dev);
				printk("[xxm]%s~~~sleep ~~~\r\n",__func__);
			}
		}
	}
}

/* only send wakeup when at deep sleep. */
#if 0
void rk28_send_wakeup_key( void ) 
{
		if(rk2818_get_suspend_flags() != PM_AWAKE)
		{
			rk2818_set_suspend_flags(PM_AWAKE);
			input_report_key(prockAD_button->input_dev,ENDCALL,1);
			input_sync(prockAD_button->input_dev);
			input_report_key(prockAD_button->input_dev,ENDCALL,0);
			input_sync(prockAD_button->input_dev);
			printk("\n%s::send key:%d ^^^^^!!\n",__FUNCTION__, ENDCALL);
		}
}
#else
/* only send wakeup when at deep sleep. */
void rk28_send_wakeup_key( void ) 
{
		if(rk2818_get_suspend_flags() != PM_AWAKE ){	
		  	rk2818_set_suspend_flags(PM_AWAKE);
		  	//rk2818_set_suspend_flags(PM_ONELEVEL_SLEEP);
			input_report_key(prockAD_button->input_dev,ENDCALL,1);
			input_sync(prockAD_button->input_dev);
			input_report_key(prockAD_button->input_dev,ENDCALL,0);
			input_sync(prockAD_button->input_dev);
			printk("\n%s::send key:%d ^^^^^!!\n",__FUNCTION__, ENDCALL);
			//mdelay(20);
		  	//rk2818_set_suspend_flags(PM_AWAKE);
		}
}
#endif
//a@nzy
static irqreturn_t rk28_AD_irq_handler(s32 irq, void *dev_id)
{
        
   if(rk2818_get_suspend_flags() == PM_TWOLEVEL_SLEEP)
	{
    	rk28_send_wakeup_key();
    }
    return IRQ_HANDLED;
}

static int __devinit rk28_AD_button_probe(struct platform_device *pdev)
{
	struct rk28_AD_button *AD_button;
	struct input_dev *input_dev;
	int  error,i;
	AD_button = kzalloc(sizeof(struct rk28_AD_button), GFP_KERNEL);
	/* Create and register the input driver. */
	input_dev = input_allocate_device();
	if (!input_dev || !AD_button) {
		dev_err(&pdev->dev, "failed to allocate input device\n");
		error = -ENOMEM;
		goto failed1;
	}

	memcpy(AD_button->keycodes, initkey_code, sizeof(AD_button->keycodes));
	input_dev->name = pdev->name;
	input_dev->open = rk28_AD_button_open;
	input_dev->close = rk28_AD_button_close;
	input_dev->dev.parent = &pdev->dev;
	input_dev->phys = KEY_PHYS_NAME;
	input_dev->id.vendor = 0x0001;
	input_dev->id.product = 0x0001;
	input_dev->id.version = 0x0100;
	input_dev->keycode = AD_button->keycodes;
	input_dev->keycodesize = sizeof(unsigned char);
	input_dev->keycodemax = ARRAY_SIZE(initkey_code);
	for (i = 0; i < ARRAY_SIZE(initkey_code); i++)
		set_bit(initkey_code[i], input_dev->keybit);
	clear_bit(0, input_dev->keybit);

	AD_button->input_dev = input_dev;
	input_set_drvdata(input_dev, AD_button);

	input_dev->evbit[0] = BIT_MASK(EV_KEY) ;

	platform_set_drvdata(pdev, AD_button);

	ADCInit();
	prockAD_button=AD_button;

	/* Register the input device */
	error = input_register_device(input_dev);
	if (error) {
		dev_err(&pdev->dev, "failed to register input device\n");
		goto failed2;
	}


	setup_timer(&AD_button->timer, rk28_adkeyscan_timer, (unsigned long)AD_button);
	//mod_timer(&AD_button->timer, 100);
	AD_button->timer.expires  = jiffies + 3;
	add_timer(&AD_button->timer);
	
	error = request_gpio_irq(WAKEUP_KEY_PORT,rk28_AD_irq_handler,GPIOEdgelRising,NULL);
	if(error)
	{
		printk("unable to request playon key IRQ\n");
		goto failed2;
	}
	return 0;

failed2:
	input_unregister_device(AD_button->input_dev);
	platform_set_drvdata(pdev, NULL);	
failed1:
	input_free_device(input_dev);
	kfree(AD_button);
	return error;
}

static int __devexit rk28_AD_button_remove(struct platform_device *pdev)
{
	struct rk28_AD_button *AD_button = platform_get_drvdata(pdev);

	input_unregister_device(AD_button->input_dev);
	input_free_device(AD_button->input_dev);
	kfree(AD_button);
	platform_set_drvdata(pdev, NULL);
	return 0;
}

int ad_button_suspend(struct platform_device *dev, pm_message_t state)
{
        g_wake = 10;
        return 0;
}
int ad_button_resume(struct platform_device *dev)
{
        //g_wake = 0;
        return 0;
}
static struct platform_driver rk28_AD_button_driver = {
	.probe		= rk28_AD_button_probe,
	.remove 	= __devexit_p(rk28_AD_button_remove),
	.suspend = ad_button_suspend,
	.resume = ad_button_resume,
	.driver 	= {
		.name	= "rk28_AD_button",
		.owner	= THIS_MODULE,
	},
};

 int __init rk28_AD_button_init(void)
{
	return platform_driver_register(&rk28_AD_button_driver);
}

static void __exit rk28_AD_button_exit(void)
{
	platform_driver_unregister(&rk28_AD_button_driver);
}

fs_initcall(rk28_AD_button_init);
module_exit(rk28_AD_button_exit);

MODULE_DESCRIPTION("rk28 AD button Controller Driver");
MODULE_LICENSE("GPL");

Сайт создан в системе uCoz