Find the answer to your Linux question:
Results 1 to 3 of 3
I am rather new to Linux and kernel programming. I am in the process of writing a driver for a new PCIe device. Everything seems fine until I attempt to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Location
    Allen, TX
    Posts
    18

    Unhappy Need Kernel Driver Help


    I am rather new to Linux and kernel programming. I am in the process of writing a driver for a new PCIe device. Everything seems fine until I attempt to open the device.

    I am able to build and install the driver. I am creating a char device and accessing the driver through ioctl calls. The device can be seen in the /dev directory.

    ls - l /dev | grep pxm:
    crw-rw-r-- 1 root staff 125, 0 2010-11-29 09:01 pxmuio96a

    All resources requested have been successfully obtained.

    When I execute
    dev_handle = open(device_id, O_RDWR) // device_id = "/dev/pxmuio96a"
    the return value is -1.

    It appears to me like the open routine is not being linked to my device. The device structure is:

    struct file_operations pxmuio96_fops = {
    owner: THIS_MODULE,
    open: pci_device_open,
    release: pci_device_release,
    ioctl: pci_device_ioctl,
    };

    I have been chasing this for days. Any help would be greatly appreciated. Thanks.

  2. #2
    Just Joined!
    Join Date
    Nov 2010
    Location
    Allen, TX
    Posts
    18
    Digging a little deeper, I have determined that I am getting errno = 6 (ENXIO), which is "No such device or address". Don't understand this since I can see the device and am using the same name in the open statement.
    Last edited by pauldemet; 11-30-2010 at 05:25 PM.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,701
    Put some printk() statements in your code to output log data to see what your kernel module is doing when you try to open the device.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close

Posting Permissions

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