Kernelnewbies Mailing Lists
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview
thread

Re:

Javier Martinez Canillas

Oct. 15, 2012
11:20 a.m.

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@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

0 0
Reply
Sign in to reply online Use email software

Back to the thread

Back to the list

HyperKitty Powered by HyperKitty version 1.3.12.