summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-03-15 14:00:07 +0000
committerFrancois Pons <fpons@mandriva.com>2001-03-15 14:00:07 +0000
commit24ed984500c0fc56a4c3460b719115a89665a707 (patch)
treefe90d97863d9da33a82916f69e5d9737699c7d65
parent8689a6a4250656cddb28f836ec09dffcffbb0f2c (diff)
downloadldetect-24ed984500c0fc56a4c3460b719115a89665a707.tar
ldetect-24ed984500c0fc56a4c3460b719115a89665a707.tar.gz
ldetect-24ed984500c0fc56a4c3460b719115a89665a707.tar.bz2
ldetect-24ed984500c0fc56a4c3460b719115a89665a707.tar.xz
ldetect-24ed984500c0fc56a4c3460b719115a89665a707.zip
added pci(bus,device,function) for DrakX.
-rw-r--r--ldetect.spec5
-rw-r--r--libldetect.h4
-rw-r--r--pci.c5
-rw-r--r--pciusb.c3
4 files changed, 15 insertions, 2 deletions
diff --git a/ldetect.spec b/ldetect.spec
index 6f5a46c..8bed15a 100644
--- a/ldetect.spec
+++ b/ldetect.spec
@@ -1,6 +1,6 @@
%define name ldetect
%define version 0.2.3
-%define release 5mdk
+%define release 6mdk
Name: %{name}
Version: %{version}
@@ -48,6 +48,9 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*
%changelog
+* Thu Mar 15 2001 François Pons <fpons@mandrakesoft.com> 0.2.3-6mdk
+- added pci_bus, pci_device and pci_function for DrakX.
+
* Tue Mar 6 2001 François Pons <fpons@mandrakesoft.com> 0.2.3-5mdk
- added support for SHARE_PATH
- add BuildRequires: usbutils
diff --git a/libldetect.h b/libldetect.h
index 5e43b1a..d61b0ab 100644
--- a/libldetect.h
+++ b/libldetect.h
@@ -9,6 +9,10 @@ struct pciusb_entry {
unsigned short subdevice; /* 0xffff if not probe_type'd or no subid */
unsigned short class; /* 0 if not probe_type'd */
+ unsigned short pci_bus; /* pci bus id 8 bits wide */
+ unsigned short pci_device; /* pci device id 5 bits wide */
+ unsigned short pci_function; /* pci function id 3 bits wide */
+
char *module;
char *text;
};
diff --git a/pci.c b/pci.c
index 94be8ef..0ad3960 100644
--- a/pci.c
+++ b/pci.c
@@ -33,10 +33,13 @@ extern struct pciusb_entries pci_probe(int probe_type) {
sscanf(buf, "%hx %x", &devbusfn, &id);
e.vendor = id >> 16;
e.device = id & 0xffff;
+ e.pci_bus = devbusfn >> 8;
+ e.pci_device = (devbusfn & 0xff) >> 3;
+ e.pci_function = (devbusfn & 0xff) & 0x07;
{
char file[25];
FILE *f;
- snprintf(file, sizeof(file), "/proc/bus/pci/%02x/%02x.%d", devbusfn >> 8, (devbusfn & 0xff) >> 3, (devbusfn & 0xff) & 0x7);
+ snprintf(file, sizeof(file), "/proc/bus/pci/%02x/%02x.%d", e.pci_bus, e.pci_device, e.pci_function);
if (probe_type && (f = fopen(file, "r"))) {
if (fseek(f, 10, SEEK_SET) == 0)
fread(&e.class, 2, 1, f);
diff --git a/pciusb.c b/pciusb.c
index b867b36..29b1d99 100644
--- a/pciusb.c
+++ b/pciusb.c
@@ -49,6 +49,9 @@ extern void pciusb_initialize(struct pciusb_entry *e) {
e->subvendor = 0xffff;
e->subdevice = 0xffff;
e->class = 0;
+ e->pci_bus = 0xffff;
+ e->pci_device = 0xffff;
+ e->pci_function = 0xffff;
e->module = NULL;
e->text = NULL;
}