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 ...
- 11-29-2010 #1Just Joined!
- Join Date
- Nov 2010
- Location
- Allen, TX
- Posts
- 4
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.
- 11-29-2010 #2Just Joined!
- Join Date
- Nov 2010
- Location
- Allen, TX
- Posts
- 4
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 04:25 PM.
- 12-08-2010 #3Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,961
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!


Reply With Quote
