LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-09-2006, 06:11 AM   #1
kalen
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
Custom PCI driver problems (acess from user-space) - Ubuntu 6.06 / Linux 2.6


Hi,

I'm writing a custom PCI driver for some in-house hardware (porting across to Linux). I've gotten hold of "Linux Device Drivers 3rd edition" which covers everything I need, but I'm still having problems getting my driver off the ground.

Here is what I'm doing in the driver code:

(init entry point) (exported with module_init(...) macro)
* register_chrdev_region - allocate my major and minor numbers ok
* pci_register_driver - returns 0 (success), and my driver is visible in /sys/bus/pci/drivers

PCI probe function (included in pci_driver struct)
Checks that the pci_dev struct passed to it matches the custom hardware, and returns 0 on success. It enables the device using pci_enable_device.

PCI remove function (included in pci_driver struct)
Frees internal memory, then disables device with pci_disable_device.

Exit entry point (exported with module_exit(...) macro)
de-registers major/minor numbers using unregister_chrdev_region, then de-registers the driver using pci_unregister_driver.

I also export the pci_driver struct using the MODULE_DEVICE_TABLE(pci, custom_ids) macro.

I have a script that creates nodes in the /dev directory
mknod -m 666 /dev/customdevice c 104, 0
and I can see the device files. I can also see the device in /proc/devices (listed under character devices)

Unfortunately, when I call int fd = open("/dev/custom_device",0) from user space I get an error 6: No such device or address

What am I doing wrong/forgetting?

Many thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to assign names to PCI devices, that ioctl() can use from user space? MarkGaleck Linux - Kernel 2 10-23-2006 03:55 PM
Problems while compilation of a custom program under Ubuntu 6.06 GSMD Programming 2 08-14-2006 05:32 AM
New Linux/Ubuntu user: Problems with INTEL PRO/Wireless 3945ABG bodean Linux - Wireless Networking 4 05-07-2006 10:46 AM
New Linux/Ubuntu user: Problems with INTEL PRO/Wireless 3945ABG bodean Linux - Laptop and Netbook 1 05-03-2006 03:31 PM
Problems trying to compile custom ATI binary driver guerilla fighta Linux - Software 0 02-13-2003 04:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration