LinuxQuestions.org
Help answer threads with 0 replies.
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 10-25-2012, 02:11 PM   #1
nedsana
LQ Newbie
 
Registered: Oct 2012
Posts: 6

Rep: Reputation: Disabled
Linux PCI driver problem: probe function not called


Hi all,

I am still new to Linux drivers, but I read book Linux Device Drivers tried some simple examples there. I also read many articles, presentations etc, so I decided that it is time to do something on my own.

I am trying to create a PCI driver for my sound card. In this forum I found the following template and decidd to use it:
http://true-random.com/homepage/proj...pci_template.c

My current problem is that my probe function is not executed. I placed dumps in my init fiction and I can see them in dmesg. But my dumps in probe never appear.

As far as I understood the probe function should be called by kernel. What should happen:
- the defined in the driver struct pci_device_id[] should be read by kernel and once the device id and vendor are recognized the probe function will be called.

So my conclusion: I have not filled this struct with correct info.

And the question: where do I get the correct device_id and vendor?


Currently I use device_id, which I got from lspci:
>>>lspci:
00:05.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01)
>>>lspci -n:
00:05.0 0401: 8086:2415 (rev 01)

05 - device id
8086 - vendor

And this is how I have filled in the struct:
#define VENDOR_ID 0x8086
#define DEVICE_ID 0x0005
static struct
pci_device_id pci_drv_ids[] __devinitdata =
{
{ VENDOR_ID, DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ }
};


Where do I go wrong?

Thank you in advance?
 
Old 10-26-2012, 03:35 AM   #2
nedsana
LQ Newbie
 
Registered: Oct 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Anyone?
 
Old 10-26-2012, 03:14 PM   #3
nedsana
LQ Newbie
 
Registered: Oct 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
I think I found a solution. Well at least my probe function is now executed


So... I missed 2 things:

>>>1<<<
As I expected I have filled wrong info in struct pci_device_id.

And the wrong item is the device_id. So where did I get the device_id from, again from lspci:

>>>lspci -n:
00:05.0 0401: <VENDOR>:<DEVICE_ID> (rev 01)

So in my case
>>>lspci -n:
00:05.0 0401: 8086:2415 (rev 01)

#define VENDOR_ID 0x8086
#define DEVICE_ID 0x2415


Note: number 05 which I initially used seems to be the number of the PCI slot. But don't trust to this conclusion of mine


>>>2<<<
I had to turn off the currently running audio driver(I needed access to the audio device on the first place).
So what I did: I added the driver in the blacklist, so it will never be started when the OS boots.
To do this modify file /etc/modprobe.d/blacklist.conf.
Add a line blacklist <driver name>
Then reboot.
 
  


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
mdio probe function not called. rashyd80 Programming 3 07-20-2010 02:45 AM
Where is a PCI module's Probe function called? jbreaka4lyfe Linux - General 2 05-18-2010 04:07 AM
who will call the probe function of the pci driver in x86 processor joslyn Linux - Software 0 05-17-2010 08:24 AM
USB Driver Probe function not being called xtom Fedora 0 10-28-2005 04:48 PM


All times are GMT -5. The time now is 10:41 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration