2005-05-12 10:03:02

by Marcel Holtmann

[permalink] [raw]
Subject: Re: ioctl to keyboard device file

Hi,

> >>>> I want to add a new ioctl to keyboard driver device file which will
> >>>> perform the work of copying user space data sent to it into kernel
> >>>> space and send those characters to handle_scancode function of keyboard
> >>>> driver.. Now I want to know
> >>>>
> >>>> 1) what is the device file corresponding to keyboard (is it
> >>>> /dev/input/keyboard).
> >>>> 2) where file operations structure is defined for that.
> >>>> 3) where the those ioctls handled(not found in keyboard.c).
> >>>>
> >>>> Any small help is appreciated.
> >>>
> >>> why not using uinput for this job?
> >>
> >> Thanks for the solution. I did the above task, by defining a new
> >> character device driver and sending ioctl to it. and calling
> >> handle_scancode from it. Now I want
> >> to do the same task with in the keyboard driver. For that I need to send
> >> ioctl to keyboard device file.
> >> For that only I asked the
> >> above doubts.
> >
> > what your are trying to do looks wrong to me. Why don't you use uinput.
> > It is there and it is the correct thing for the job.
> >
>
> Can u pl. tell what uinput will do,
> Can u have any idea about the way That I want it to do.

with uinput you can write your own input driver (keyboards, mice etc.)
in the userspace. So you create a keyboard device driven by uinput and
feed your key strokes from the other machine to it.

Regards

Marcel



2005-05-16 08:58:38

by P.Manohar

[permalink] [raw]
Subject: Re: ioctl to keyboard device file

hai,

My task is to send the characters to any application as if the input
is coming from keyboard. For that I created one character device file. To
it I am sending input characters through ioctl. In the character device
ioctl definition I am copying these user characters to kernel space and
sending these characters to handle_scancode function. What is the wrong
with this solution. This solution is working now. But waht I am asking is
istead of sending our ioctl to newly created device file, can we able to
send ioctl to the keyboard buffer, so that avoiding the use of new
character device file , whose purpose is just to handle ioctl.

I think now u got my doubt.

One more is, uinput case,

Whether uinput also doing the same thing, waht I am doing?
For sending user data to kernel sapce we should use ioctl ,is it right?

Plz cc (mail) me with ur comments.

Regards,
Manohar.
On Thu, 12 May 2005, Marcel Holtmann wrote:

> Hi,
>
>>>>>> I want to add a new ioctl to keyboard driver device file which will
>>>>>> perform the work of copying user space data sent to it into kernel
>>>>>> space and send those characters to handle_scancode function of keyboard
>>>>>> driver.. Now I want to know
>>>>>>
>>>>>> 1) what is the device file corresponding to keyboard (is it
>>>>>> /dev/input/keyboard).
>>>>>> 2) where file operations structure is defined for that.
>>>>>> 3) where the those ioctls handled(not found in keyboard.c).
>>>>>>
>>>>>> Any small help is appreciated.
>>>>>
>>>>> why not using uinput for this job?
>>>>
>>>> Thanks for the solution. I did the above task, by defining a new
>>>> character device driver and sending ioctl to it. and calling
>>>> handle_scancode from it. Now I want
>>>> to do the same task with in the keyboard driver. For that I need to send
>>>> ioctl to keyboard device file.
>>>> For that only I asked the
>>>> above doubts.
>>>
>>> what your are trying to do looks wrong to me. Why don't you use uinput.
>>> It is there and it is the correct thing for the job.
>>>
>>
>> Can u pl. tell what uinput will do,
>> Can u have any idea about the way That I want it to do.
>
> with uinput you can write your own input driver (keyboards, mice etc.)
> in the userspace. So you create a keyboard device driven by uinput and
> feed your key strokes from the other machine to it.
>
> Regards
>
> Marcel
>
>

2005-05-16 09:54:21

by Marcel Holtmann

[permalink] [raw]
Subject: Re: ioctl to keyboard device file

Hi,

> My task is to send the characters to any application as if the input
> is coming from keyboard. For that I created one character device file. To
> it I am sending input characters through ioctl. In the character device
> ioctl definition I am copying these user characters to kernel space and
> sending these characters to handle_scancode function. What is the wrong
> with this solution. This solution is working now. But waht I am asking is
> istead of sending our ioctl to newly created device file, can we able to
> send ioctl to the keyboard buffer, so that avoiding the use of new
> character device file , whose purpose is just to handle ioctl.

using uinput is the way to achieve this goal. What you did is an ugly
hack and I don't see any chance to get it merged back mainline.

> One more is, uinput case,
>
> Whether uinput also doing the same thing, waht I am doing?
> For sending user data to kernel sapce we should use ioctl ,is it right?

This has nothing to do with ioctl() versus write(). Forget about it and
start using uinput.

Regards

Marcel