* ioctl to keyboard device file.
@ 2005-05-11 16:43 P.Manohar
2005-05-11 17:14 ` Marcel Holtmann
0 siblings, 1 reply; 9+ messages in thread
From: P.Manohar @ 2005-05-11 16:43 UTC (permalink / raw)
To: linux-kernel
hai,
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.
Thanks&Regards,
P.Manohar,
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file.
2005-05-11 16:43 ioctl to keyboard device file P.Manohar
@ 2005-05-11 17:14 ` Marcel Holtmann
2005-05-11 17:34 ` P.Manohar
0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2005-05-11 17:14 UTC (permalink / raw)
To: P.Manohar; +Cc: linux-kernel
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?
Regards
Marcel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
2005-05-11 17:14 ` Marcel Holtmann
@ 2005-05-11 17:34 ` P.Manohar
2005-05-11 17:53 ` Marcel Holtmann
0 siblings, 1 reply; 9+ messages in thread
From: P.Manohar @ 2005-05-11 17:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-kernel
n Wed, 11 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?
Hai,
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.
regards,
P.Manohar.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
2005-05-11 17:34 ` P.Manohar
@ 2005-05-11 17:53 ` Marcel Holtmann
2005-05-11 18:17 ` Jan-Benedict Glaw
[not found] ` <Pine.LNX.4.60.0505121454240.26644@lantana.cs.iitm.ernet.in>
0 siblings, 2 replies; 9+ messages in thread
From: Marcel Holtmann @ 2005-05-11 17:53 UTC (permalink / raw)
To: P.Manohar; +Cc: linux-kernel
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.
Regards
Marcel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
2005-05-11 17:53 ` Marcel Holtmann
@ 2005-05-11 18:17 ` Jan-Benedict Glaw
[not found] ` <Pine.LNX.4.60.0505121454240.26644@lantana.cs.iitm.ernet.in>
1 sibling, 0 replies; 9+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-11 18:17 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2664 bytes --]
On Wed, 2005-05-11 19:53:20 +0200, Marcel Holtmann <marcel@holtmann.org> wrote:
> > >> 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.
I don't know what device the initial sender tries to support, but uinput
is only a solution for "normal" human input. I yet fail to see how
you'd support eg. keyboard-based magnetic stripe readers or barcode
scanners with it. These devices don't play nicely with atkbd: they send
some "random" make and break codes so you'd get some garbage from stdin.
But in reality, you'd rather prefer to (like for /dev/input/event*)
select() for a fully received magnetic stripe or barcode or the like.
Also, you may need to write (in terms of raw bytes) to the keyboard port
of the i8042 eg. to use keyboards with built-in displays.
Right now, I'm writing a driver (for 2.6.x) for some MSR. I'm attempting
to do this by having a "relay" serio port which is a serio client wrt.
the serio port registered by i8042. It shall register another serio port
(to which atkbd then connects) and supply an interface for some other
module to intercept/filter the make/break codes. It *could* be done with
serio_raw, but then you'd need to implement a full atkbd implementation
in userspace (which I consider being quite ugly...).
So the resumée is that the Input API is *really* cool for normal
devices, but from my point of view, it cannot really handle these
complicated Point of Sale devices nicely. Give us some days, we'll at
least put the serio_relay.c driver on the table. Maybe it's useful for
somebody else...
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
[not found] ` <Pine.LNX.4.60.0505121454240.26644@lantana.cs.iitm.ernet.in>
@ 2005-05-12 10:01 ` Marcel Holtmann
2005-05-16 8:58 ` P.Manohar
0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2005-05-12 10:01 UTC (permalink / raw)
To: P.Manohar; +Cc: Linux Kernel Mailing List
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
2005-05-12 10:01 ` Marcel Holtmann
@ 2005-05-16 8:58 ` P.Manohar
2005-05-16 9:54 ` Marcel Holtmann
0 siblings, 1 reply; 9+ messages in thread
From: P.Manohar @ 2005-05-16 8:58 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-kernel
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
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
2005-05-16 8:58 ` P.Manohar
@ 2005-05-16 9:54 ` Marcel Holtmann
[not found] ` <Pine.LNX.4.60.0505162112240.25368@lantana.cs.iitm.ernet.in>
0 siblings, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2005-05-16 9:54 UTC (permalink / raw)
To: P.Manohar; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ioctl to keyboard device file
[not found] ` <Pine.LNX.4.60.0505162112240.25368@lantana.cs.iitm.ernet.in>
@ 2005-05-16 16:19 ` Marcel Holtmann
0 siblings, 0 replies; 9+ messages in thread
From: Marcel Holtmann @ 2005-05-16 16:19 UTC (permalink / raw)
To: P.Manohar; +Cc: Linux Kernel Mailing List
Hi,
why do you always remove the CC to the mailing list or is too hard to
press the Reply to All button?
> Thank u very much for guiding me in right direction. Sorry to disturb
> u. Can u suggest me some refence material for knowing how to write
> user space keyboard driver using uinput.c ,
> I have seen the code of uinput.c, keybdev.c ,but not getting an idea
> to write keyboard driver from it.
Use Google to find example code on how to use uinput. There must also
still exists some old Bluetooth HID code that used uinput.
> Does this solution work with X-windows also?
I already answered this one. This is native input subsystem stuff and
has nothing to do with the higher applications.
Regards
Marcel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-05-16 16:19 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 16:43 ioctl to keyboard device file P.Manohar
2005-05-11 17:14 ` Marcel Holtmann
2005-05-11 17:34 ` P.Manohar
2005-05-11 17:53 ` Marcel Holtmann
2005-05-11 18:17 ` Jan-Benedict Glaw
[not found] ` <Pine.LNX.4.60.0505121454240.26644@lantana.cs.iitm.ernet.in>
2005-05-12 10:01 ` Marcel Holtmann
2005-05-16 8:58 ` P.Manohar
2005-05-16 9:54 ` Marcel Holtmann
[not found] ` <Pine.LNX.4.60.0505162112240.25368@lantana.cs.iitm.ernet.in>
2005-05-16 16:19 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox