Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-15-2008, 05:20 AM   #1
Registered: Apr 2008
Location: Espaņa
Distribution: Suse
Posts: 220

Rep: Reputation: 32
Problem with pci_get_device.....


In this moment, I am learning how to handle pci devices.
Well, I am made some test and I have one doubt:

1.- This function, pci_get_device(MY_VENDOR_ID, MY_DEVICE_ID, NULL);, can I only use with a driver???. I try to explain more, I try to use this function in a normal programm, example.c with a main function.
When I try to compile this example I have this message:

/home/john/NetBeansProjects/driver/driver.c:23: undefined reference to `pci_get_device'
collect2: ld returned 1 exit status
#include <stdio.h>
#include <stdlib.h>
#include <linux/pci.h>

#define MY_VENDOR_ID 0X1677
#define MY_DEVICE_ID 0x197B

struct pci_dev *my_dev;
int main(int argc, char** argv) {

my_dev = pci_get_device(MY_VENDOR_ID, MY_DEVICE_ID, NULL);

return (EXIT_SUCCESS);
Can I do it??? or not???

Can I use it only in a driver???

Best regards.


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
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 08:45 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:57 PM.

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