Results 1 to 9 of 9
Hi,
I am trying to get network adapter vendor name through c program in Linux.
I tried using ioctl calls to fetch the name of the adapter but i ended ...
- 09-10-2009 #1Just Joined!
- Join Date
- Sep 2009
- Posts
- 5
Get Network adapter vendor name through C Program
Hi,
I am trying to get network adapter vendor name through c program in Linux.
I tried using ioctl calls to fetch the name of the adapter but i ended up in fetching the logical name of the network interface.
I used system cal ioctl(fd, SIOCGIFHWADDR, &ifreq). I got eth0 & lp.
But i need the Vendor name of my network adapter through c program i dont want to use lspci and ethtool to do this.
Can any one suggest me how i can fetch this through c program?
Thanks for your help.
Regards,
Bharath P
- 09-10-2009 #2
I don't know if you have this script included in your distro, but I get good results from
inxi -FLinux Registered User # 475019
Lead,Follow, or get the heck out of the way
AntiX,Puppy,Ubuntu,Windows 7=(cuz of scooters)
Open CourseWare for Linux Geeks
- 09-10-2009 #3Just Joined!
- Join Date
- Sep 2009
- Posts
- 5
access PCI structure in c program
Can anyone tel how i can access pci_device_id structure in my c program and get al the vendor id's listed in it ?
I think i can get my Vendor ID and name if i can access PCI structure mentioned above. So please guide how to access PCI structure if possible provide me some example.
Regards,
Bharath P
- 09-10-2009 #4Just Joined!
- Join Date
- Jul 2009
- Posts
- 58
- 09-10-2009 #5
- 09-10-2009 #6Just Joined!
- Join Date
- Jul 2009
- Posts
- 58
It not a very long slide show, but half way in between it goes into card identification and how to setup and read the pci_device_id.
I thought it would be easier to point there than pump out c code into a forum.
- 09-10-2009 #7
So, this page, and the one following it?
Slide shows aren't much good without the presenter talking over them, IMO. The information on them tends to be rather oversimplified and incomplete. In this case, the slide shows that there is this structure called pci_device_id, and how to populate it - but nothing, as far as I can tell, about how to read the device ID from a device, let alone how to do it from userspace.
If I'm not mistaken, pci_device_id isn't even the structure you need to use to read a PCI device's info in userspace. Rather, it appears that PCI device drivers keep a table of pci_device_id which the kernel uses to match PCI devices in the system to relevant drivers... 'Course I could be wrong there...
- 09-10-2009 #8Just Joined!
- Join Date
- Jul 2009
- Posts
- 58
Oh I've never looked for what he is looking for I assume he knew what he was asking for. He wanted to know how to setup the structure.
Now that I think about it "scanpci" should have the code he is looking for at least that'll confirm where the data is located. I'm 99.9% sure that it prints out the vendor name or at least the vendor code.
- 09-10-2009 #9


Reply With Quote
