public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* How to use omap keypad driver function
@ 2006-08-18 13:54 Devendra Kumar Madhesia
  2006-08-19  0:26 ` andrzej zaborowski
  0 siblings, 1 reply; 5+ messages in thread
From: Devendra Kumar Madhesia @ 2006-08-18 13:54 UTC (permalink / raw)
  To: linux-omap-open-source





Hi,

My objective is to create a user application program that will handle
keypad interrupt.

like in my program some method e.g

keyEvent(keyCode)
{
switch(keyCode)
{
case '1':
    do some operation;
case 'a':
   do some operation;
...............

}
}

But how can get these key event with keycode from omap keypad driver?
How to call omap keypad driver function from user space program?

In normal device driver, there is entry function (like ioctl,read,write
etc) in device driver but
in omap keypad driver code no entry function exists like this.


Thanks a lot.
Best Regards,
Devendra

***********************  FSS-Unclassified   ***********************
"DISCLAIMER: This message is proprietary to Flextronics Software
Systems Limited (FSS) and is intended solely for the use of the
individual to whom it is addressed. It may contain  privileged or
confidential information and should not be circulated or used for
any purpose other than for what it is intended. If you have received
this message in  error, please notify the originator immediately.
If you are not the intended recipient, you are notified that you are
strictly  prohibited  from  using, copying, altering, or disclosing
the contents of this message.  FSS  accepts no  responsibility  for
loss or damage arising from the use of  the information transmitted
by this email including damage from virus."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use omap keypad driver function
  2006-08-18 13:54 How to use omap keypad driver function Devendra Kumar Madhesia
@ 2006-08-19  0:26 ` andrzej zaborowski
  2006-08-19 11:25   ` Devendra Kumar Madhesia
  2006-08-22 12:00   ` Devendra Kumar Madhesia
  0 siblings, 2 replies; 5+ messages in thread
From: andrzej zaborowski @ 2006-08-19  0:26 UTC (permalink / raw)
  To: Devendra Kumar Madhesia; +Cc: linux-omap-open-source

Hi,

On 18/08/06, Devendra Kumar Madhesia
<devendra.madhesia@flextronicssoftware.com> wrote:
>
>
>
>
> Hi,
>
> My objective is to create a user application program that will handle
> keypad interrupt.
>
> like in my program some method e.g
>
> keyEvent(keyCode)
> {
> switch(keyCode)
> {
> case '1':
>     do some operation;
> case 'a':
>    do some operation;
> ...............
>
> }
> }
>
> But how can get these key event with keycode from omap keypad driver?
> How to call omap keypad driver function from user space program?

I think you shouldn't call the driver directly and rather use the
evdev interface or read from console. If evdev is enabled in your
kernel, the keypad driver will be accessible through /dev/input/eventX
(for example /dev/input/event0 if it's the only input device).
Your program should open() this node and read() from it data in form
of struct input_event (defined in <linux/input.h>). When read()
returns, probably a key has been pressed and .code contains a key
code.
if (buffer->type == EV_KEY)
  switch (buffer->code) {
    case KEY_A:
etc, that's what an X server does for example.

>
> In normal device driver, there is entry function (like ioctl,read,write
> etc) in device driver but
> in omap keypad driver code no entry function exists like this.
>
>
> Thanks a lot.
> Best Regards,
> Devendra
>
> ***********************  FSS-Unclassified   ***********************
> "DISCLAIMER: This message is proprietary to Flextronics Software
> Systems Limited (FSS) and is intended solely for the use of the
> individual to whom it is addressed. It may contain  privileged or
> confidential information and should not be circulated or used for
> any purpose other than for what it is intended. If you have received
> this message in  error, please notify the originator immediately.
> If you are not the intended recipient, you are notified that you are
> strictly  prohibited  from  using, copying, altering, or disclosing
> the contents of this message.  FSS  accepts no  responsibility  for
> loss or damage arising from the use of  the information transmitted
> by this email including damage from virus."
>
>
>
>
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>


-- 
balrog 2oo6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use omap keypad driver function
  2006-08-19  0:26 ` andrzej zaborowski
@ 2006-08-19 11:25   ` Devendra Kumar Madhesia
  2006-08-19 16:14     ` lamikr
  2006-08-22 12:00   ` Devendra Kumar Madhesia
  1 sibling, 1 reply; 5+ messages in thread
From: Devendra Kumar Madhesia @ 2006-08-19 11:25 UTC (permalink / raw)
  To: linux-omap-open-source





Hi,
Thanks for giving such useful idea.

But I have also some doubt.
The omap keypad driver is based on interrupt.
Will this idea also useful for  omap keypad driver?

Plz find source code for omap keypad driver from:
/usr/src/armlinux/linux-2.6.16/drivers/input/keyboard/omap-keypad.c

Best Regards,
Devendra


                                                                           
             "andrzej                                                      
             zaborowski"                                                   
             <balrog@zabor.org                                          To 
             >                         Devendra Kumar Madhesia/HSS@HSS     
             Sent by:                                                   cc 
             balrogg@gmail.com         linux-omap-open-source@linux.omap.c 
                                       om                                  
                                                                   Subject 
             08/19/2006 05:56          Re: How to use omap keypad driver   
             AM                        function                            
                                                                           
                                                                           
             Please respond to                                             
             balrogg@gmail.com                                             
                                                                           
                                                                           




Hi,

On 18/08/06, Devendra Kumar Madhesia
<devendra.madhesia@flextronicssoftware.com> wrote:
>
>
>
>
> Hi,
>
> My objective is to create a user application program that will handle
> keypad interrupt.
>
> like in my program some method e.g
>
> keyEvent(keyCode)
> {
> switch(keyCode)
> {
> case '1':
>     do some operation;
> case 'a':
>    do some operation;
> ...............
>
> }
> }
>
> But how can get these key event with keycode from omap keypad driver?
> How to call omap keypad driver function from user space program?

I think you shouldn't call the driver directly and rather use the
evdev interface or read from console. If evdev is enabled in your
kernel, the keypad driver will be accessible through /dev/input/eventX
(for example /dev/input/event0 if it's the only input device).
Your program should open() this node and read() from it data in form
of struct input_event (defined in <linux/input.h>). When read()
returns, probably a key has been pressed and .code contains a key
code.
if (buffer->type == EV_KEY)
  switch (buffer->code) {
    case KEY_A:
etc, that's what an X server does for example.

>
> In normal device driver, there is entry function (like ioctl,read,write
> etc) in device driver but
> in omap keypad driver code no entry function exists like this.
>
>
> Thanks a lot.
> Best Regards,
> Devendra
>
> ***********************  FSS-Unclassified   ***********************
> "DISCLAIMER: This message is proprietary to Flextronics Software
> Systems Limited (FSS) and is intended solely for the use of the
> individual to whom it is addressed. It may contain  privileged or
> confidential information and should not be circulated or used for
> any purpose other than for what it is intended. If you have received
> this message in  error, please notify the originator immediately.
> If you are not the intended recipient, you are notified that you are
> strictly  prohibited  from  using, copying, altering, or disclosing
> the contents of this message.  FSS  accepts no  responsibility  for
> loss or damage arising from the use of  the information transmitted
> by this email including damage from virus."
>
>
>
>
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>


--
balrog 2oo6



***********************  FSS-Unclassified   ***********************
"DISCLAIMER: This message is proprietary to Flextronics Software
Systems Limited (FSS) and is intended solely for the use of the
individual to whom it is addressed. It may contain  privileged or
confidential information and should not be circulated or used for
any purpose other than for what it is intended. If you have received
this message in  error, please notify the originator immediately.
If you are not the intended recipient, you are notified that you are
strictly  prohibited  from  using, copying, altering, or disclosing
the contents of this message.  FSS  accepts no  responsibility  for
loss or damage arising from the use of  the information transmitted
by this email including damage from virus."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use omap keypad driver function
  2006-08-19 11:25   ` Devendra Kumar Madhesia
@ 2006-08-19 16:14     ` lamikr
  0 siblings, 0 replies; 5+ messages in thread
From: lamikr @ 2006-08-19 16:14 UTC (permalink / raw)
  To: Devendra Kumar Madhesia; +Cc: linux-omap-open-source

Devendra Kumar Madhesia wrote:
>
>
> Hi,
> Thanks for giving such useful idea.
>
> But I have also some doubt.
> The omap keypad driver is based on interrupt.
> Will this idea also useful for  omap keypad driver?
>
> Plz find source code for omap keypad driver from:
> /usr/src/armlinux/linux-2.6.16/drivers/input/keyboard/omap-keypad.c
>
> Best Regards,
> Devendra
>   
Yes, that driver receives creates /dev/input/event(number) to userspace.
(by calling input_allocate_device() method)
and starts listening irq's from the key presses. When it receives irq,
it checks which key was really pressed and uses
input_report_key() method for passing that information to userspace via
/dev/input/event(number) interface.

Note that in this level, you can desire which key events you send to
userspace. In my device I have for example an joypad
that sends always couple of irq's to driver and sending them directly to
userspace would mess apps like gpe-window manager.
(For me the press to right would generate "up-right" and "bottom-right"
events, and instead of passing them, I only send one event
indicating that "right" key were pressed.)

I have not send that driver to omap list because I am not sure would the
omap-keypad driver be the best location for that code.

Mika

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use omap keypad driver function
  2006-08-19  0:26 ` andrzej zaborowski
  2006-08-19 11:25   ` Devendra Kumar Madhesia
@ 2006-08-22 12:00   ` Devendra Kumar Madhesia
  1 sibling, 0 replies; 5+ messages in thread
From: Devendra Kumar Madhesia @ 2006-08-22 12:00 UTC (permalink / raw)
  To: linux-omap-open-source







Hi,
I am trying to open() and read() device file /dev/input/event0.
But read() system call doesn't return it hanged during that call.
Actually read() for /dev/input/event0 file return struct input_event
through which i want to get keycode.
Please help!

Code for reference is :

int main(int argc,char** argv)
{
.......................
.........................
fd = open(/dev/input/event0,O_RDONLY);

IOCTL(fd,EVIOCGNAME,&devName);
printf("Device name:%s,devName);
IOCTL(fd,EVIOCGPHYS,&location);
printf("Device physical location:%s,version);

struct input_event event[64];
while(1)
{
rd = read(fd,event,sizeof(struct input_event)*64);

for (i=0; i< rd/sizeof (input_event),i++)
 {
     if( event[i].type == EV_KEY)
    {
     switch(event[i].code)
       {
       case KEY_1:
........................
       }
    }
 }

}


}

output is : Device name AT Translated set 2 keyboard
                  Device physical location: isa0060/serio0/input0

;;;;;;;;;;;;;;;;;;;;;;;;after that blocked even while pressing key

reason: read() doesn't return
May be that it not recognizing keyboard.I am using PS2 keyboard.
if this is problem then what is device node for this keyborad?


Thanks
Best Regards,
Devendra


                                                                           
             "andrzej                                                      
             zaborowski"                                                   
             <balrog@zabor.org                                          To 
             >                         Devendra Kumar Madhesia/HSS@HSS     
             Sent by:                                                   cc 
             balrogg@gmail.com         linux-omap-open-source@linux.omap.c 
                                       om                                  
                                                                   Subject 
             08/19/2006 05:56          Re: How to use omap keypad driver   
             AM                        function                            
                                                                           
                                                                           
             Please respond to                                             
             balrogg@gmail.com                                             
                                                                           
                                                                           




Hi,

On 18/08/06, Devendra Kumar Madhesia
<devendra.madhesia@flextronicssoftware.com> wrote:
>
>
>
>
> Hi,
>
> My objective is to create a user application program that will handle
> keypad interrupt.
>
> like in my program some method e.g
>
> keyEvent(keyCode)
> {
> switch(keyCode)
> {
> case '1':
>     do some operation;
> case 'a':
>    do some operation;
> ...............
>
> }
> }
>
> But how can get these key event with keycode from omap keypad driver?
> How to call omap keypad driver function from user space program?

I think you shouldn't call the driver directly and rather use the
evdev interface or read from console. If evdev is enabled in your
kernel, the keypad driver will be accessible through /dev/input/eventX
(for example /dev/input/event0 if it's the only input device).
Your program should open() this node and read() from it data in form
of struct input_event (defined in <linux/input.h>). When read()
returns, probably a key has been pressed and .code contains a key
code.
if (buffer->type == EV_KEY)
  switch (buffer->code) {
    case KEY_A:
etc, that's what an X server does for example.

>
> In normal device driver, there is entry function (like ioctl,read,write
> etc) in device driver but
> in omap keypad driver code no entry function exists like this.
>
>
> Thanks a lot.
> Best Regards,
> Devendra
>
> ***********************  FSS-Unclassified   ***********************
> "DISCLAIMER: This message is proprietary to Flextronics Software
> Systems Limited (FSS) and is intended solely for the use of the
> individual to whom it is addressed. It may contain  privileged or
> confidential information and should not be circulated or used for
> any purpose other than for what it is intended. If you have received
> this message in  error, please notify the originator immediately.
> If you are not the intended recipient, you are notified that you are
> strictly  prohibited  from  using, copying, altering, or disclosing
> the contents of this message.  FSS  accepts no  responsibility  for
> loss or damage arising from the use of  the information transmitted
> by this email including damage from virus."
>
>
>
>
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source
>


--
balrog 2oo6



***********************  FSS-Unclassified   ***********************
"DISCLAIMER: This message is proprietary to Flextronics Software
Systems Limited (FSS) and is intended solely for the use of the
individual to whom it is addressed. It may contain  privileged or
confidential information and should not be circulated or used for
any purpose other than for what it is intended. If you have received
this message in  error, please notify the originator immediately.
If you are not the intended recipient, you are notified that you are
strictly  prohibited  from  using, copying, altering, or disclosing
the contents of this message.  FSS  accepts no  responsibility  for
loss or damage arising from the use of  the information transmitted
by this email including damage from virus."

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-22 12:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-18 13:54 How to use omap keypad driver function Devendra Kumar Madhesia
2006-08-19  0:26 ` andrzej zaborowski
2006-08-19 11:25   ` Devendra Kumar Madhesia
2006-08-19 16:14     ` lamikr
2006-08-22 12:00   ` Devendra Kumar Madhesia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox