* No subject
@ 2012-10-15 9:24 Niroj Pokhrel
2012-10-15 10:19 ` Matthias Brugger
0 siblings, 1 reply; 5+ messages in thread
From: Niroj Pokhrel @ 2012-10-15 9:24 UTC (permalink / raw)
To: kernelnewbies
Hi,
I'm new to linux and kernel . I'm ongoing with the linux device drivers.
I've followed the the book LDD but i'm lost about how to call my driver's
specific method from the user space.
Eg: if have developed a character device and inserted the module then how
can i make sure that when I read or write that it implement the functions
via the methods i have implemented in my module.
--
Niroj Pokhrel
NIT Jamshedpur,
B.Tech,Electronics and Communication
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121015/5d90dec4/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* (no subject)
2012-10-15 9:24 No subject Niroj Pokhrel
@ 2012-10-15 10:19 ` Matthias Brugger
2012-10-15 10:53 ` Niroj Pokhrel
0 siblings, 1 reply; 5+ messages in thread
From: Matthias Brugger @ 2012-10-15 10:19 UTC (permalink / raw)
To: kernelnewbies
Hi,
On 10/15/2012 11:24 AM, Niroj Pokhrel wrote:
> Hi,
> I'm new to linux and kernel . I'm ongoing with the linux device drivers.
> I've followed the the book LDD but i'm lost about how to call my
> driver's specific method from the user space.
> Eg: if have developed a character device and inserted the module then
> how can i make sure that when I read or write that it implement the
> functions via the methods i have implemented in my module.
the most easy way would be to put some printk output in your read/write
functions of your driver. So with cat/echo from userspace you should be
able to verify your implementation.
Regards,
Matthias
>
> --
> Niroj Pokhrel
> NIT Jamshedpur,
> B.Tech,Electronics and Communication
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* (no subject)
2012-10-15 10:19 ` Matthias Brugger
@ 2012-10-15 10:53 ` Niroj Pokhrel
2012-10-15 11:12 ` Kumar amit mehta
2012-10-15 11:20 ` Javier Martinez Canillas
0 siblings, 2 replies; 5+ messages in thread
From: Niroj Pokhrel @ 2012-10-15 10:53 UTC (permalink / raw)
To: kernelnewbies
Thank Matthias!!!
I have tried using printk . What I really want to do now is to implement
the methods I have written by calling from the user space. Like I want to
read or write to the character devices via user space.
On Mon, Oct 15, 2012 at 3:49 PM, Matthias Brugger <
matthias.bgg@googlemail.com> wrote:
> Hi,
>
>
> On 10/15/2012 11:24 AM, Niroj Pokhrel wrote:
>
>> Hi,
>> I'm new to linux and kernel . I'm ongoing with the linux device drivers.
>> I've followed the the book LDD but i'm lost about how to call my
>> driver's specific method from the user space.
>> Eg: if have developed a character device and inserted the module then
>> how can i make sure that when I read or write that it implement the
>> functions via the methods i have implemented in my module.
>>
>
> the most easy way would be to put some printk output in your read/write
> functions of your driver. So with cat/echo from userspace you should be
> able to verify your implementation.
>
> Regards,
> Matthias
>
>
>> --
>> Niroj Pokhrel
>> NIT Jamshedpur,
>> B.Tech,Electronics and Communication
>>
>>
>> ______________________________**_________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.**org <Kernelnewbies@kernelnewbies.org>
>> http://lists.kernelnewbies.**org/mailman/listinfo/**kernelnewbies<http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies>
>>
>>
>
--
Niroj Pokhrel
NIT Jamshedpur,
B.Tech,Electronics and Communication
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121015/def69e39/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* (no subject)
2012-10-15 10:53 ` Niroj Pokhrel
@ 2012-10-15 11:12 ` Kumar amit mehta
2012-10-15 11:20 ` Javier Martinez Canillas
1 sibling, 0 replies; 5+ messages in thread
From: Kumar amit mehta @ 2012-10-15 11:12 UTC (permalink / raw)
To: kernelnewbies
On Mon, Oct 15, 2012 at 04:23:59PM +0530, Niroj Pokhrel wrote:
> Thank Matthias!!!
> I have tried using printk . What I really want to do now is to implement
> the methods I have written by calling from the user space. Like I want to
> read or write to the character devices via user space.
>
Did you register your callbacks for read and write in your char driver ?
If yes, then you can write and read(given you have methods for write and read
for your char driver), through 'echo', 'cat' etc of your char device through
fs nodes(under /dev). I'm guessing that you've exported your device under /dev
file system.
-Amit
> On Mon, Oct 15, 2012 at 3:49 PM, Matthias Brugger <
> matthias.bgg at googlemail.com> wrote:
>
> > Hi,
> >
> >
> > On 10/15/2012 11:24 AM, Niroj Pokhrel wrote:
> >
> >> Hi,
> >> I'm new to linux and kernel . I'm ongoing with the linux device drivers.
> >> I've followed the the book LDD but i'm lost about how to call my
> >> driver's specific method from the user space.
> >> Eg: if have developed a character device and inserted the module then
> >> how can i make sure that when I read or write that it implement the
> >> functions via the methods i have implemented in my module.
> >>
> >
> > the most easy way would be to put some printk output in your read/write
> > functions of your driver. So with cat/echo from userspace you should be
> > able to verify your implementation.
> >
> > Regards,
> > Matthias
^ permalink raw reply [flat|nested] 5+ messages in thread
* (no subject)
2012-10-15 10:53 ` Niroj Pokhrel
2012-10-15 11:12 ` Kumar amit mehta
@ 2012-10-15 11:20 ` Javier Martinez Canillas
1 sibling, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2012-10-15 11:20 UTC (permalink / raw)
To: kernelnewbies
On Mon, Oct 15, 2012 at 12:53 PM, Niroj Pokhrel <nirojpokhrel@gmail.com> wrote:
> Thank Matthias!!!
> I have tried using printk . What I really want to do now is to implement the
> methods I have written by calling from the user space. Like I want to read
> or write to the character devices via user space.
>
Hi Niroj,
Please don't top post, it is not polite since forces readers to scroll
to the bottom to gain some context about the conversation.
> On Mon, Oct 15, 2012 at 3:49 PM, Matthias Brugger
> <matthias.bgg@googlemail.com> wrote:
>>
>> Hi,
>>
>>
>> On 10/15/2012 11:24 AM, Niroj Pokhrel wrote:
>>>
>>> Hi,
>>> I'm new to linux and kernel . I'm ongoing with the linux device drivers.
>>> I've followed the the book LDD but i'm lost about how to call my
>>> driver's specific method from the user space.
>>> Eg: if have developed a character device and inserted the module then
>>> how can i make sure that when I read or write that it implement the
>>> functions via the methods i have implemented in my module.
>>
>>
>> the most easy way would be to put some printk output in your read/write
>> functions of your driver. So with cat/echo from userspace you should be able
>> to verify your implementation.
>>
>> Regards,
>> Matthias
>>
>>>
>>> --
>>> Niroj Pokhrel
>>> NIT Jamshedpur,
>>> B.Tech,Electronics and Communication
>>>
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>
>
>
>
> --
> Niroj Pokhrel
> NIT Jamshedpur,
> B.Tech,Electronics and Communication
>
There is no need to implement anything in user-space.
If your char dev driver has been correctly implemented and registered
then the standard file operation syscalls can be used to access the
device. The Linux kernel virtual filesystem will use the information
on the character device node (major number) to know which struct
file_operations (and hence file operations callbacks) has to be used.
Hope it helps,
--
Javier
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-15 11:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-15 9:24 No subject Niroj Pokhrel
2012-10-15 10:19 ` Matthias Brugger
2012-10-15 10:53 ` Niroj Pokhrel
2012-10-15 11:12 ` Kumar amit mehta
2012-10-15 11:20 ` Javier Martinez Canillas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.