Find the answer to your Linux question:
Results 1 to 5 of 5
Hi guys, I have followed the tutorial here .codeproject.com/Articles/112474/A-Simple-Driver-for-Linux- and got my module up and running(cant put a www as i dont have 15 posts yet). My question is what ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    3

    Compiling a kernel.


    Hi guys,
    I have followed the tutorial here .codeproject.com/Articles/112474/A-Simple-Driver-for-Linux- and got my module up and running(cant put a www as i dont have 15 posts yet). My question is what device does this module actually interface with.Forgive me if it sounds stupid but I am kind of lost here.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    For the record, I believe you are referring to this article:

    http://www.codeproject.com/Articles/...r-for-Linux-OS

    As far as I can tell, the module created in the tutorial merely performs as an example - it does not actually interface with any device, per se. In userland, you would create (via the mknod command) a character device (like a console, versus a block device, like a disk drive) in order to "use" the module.

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    3
    In the tutorial the writer says
    mknod /dev/simple-driver c 250 0
    which I have done(Is this the mknod which you are referring to ?). I can also see the file when I cat it.But what I dont understand was what all that long code for registering a device was and reading from it too when there is no device actually. Once agin I aplogize for my igonrance but it is my first program indeed(of course after the hello world!).

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    yes, that's what i meant by mknod.

    i guess the way you put it, the kernel module IS the device - at least that is what is registering with the kernel. even if there is no physical input device for a given kernel module, the module itself must register/un-register with the kernel. it makes more sense when you actually do have a physical device with which the kernel is communicating, of course.

    Edit: and as far as the kernel is concerned, /dev/simple-driver is a device (sort of), just as /dev/sda represents the primary hard disk.
    Last edited by atreyu; 07-06-2012 at 05:15 AM. Reason: is a device

  6. #5
    Just Joined!
    Join Date
    Jul 2012
    Posts
    3
    Hi,
    Thanks for the reply. It does make some sense now(Though the point of that tutorial I really dont get.). Do you know any good tutorials to actually get started with writing an actual usb driver. I have a usb stick which I can spare.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •