summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-03-08 23:26:12 +0100
committerSuren A. Chilingaryan <csa@suren.me>2016-03-08 23:26:12 +0100
commit3efe83956be40c98f3ac44cd186a056ec5cf0066 (patch)
tree4ff877a984667d22197cc002e22a365f774a8327
parentbbcb2c11b8f47104176d1129e703ce8586dd4407 (diff)
downloadpcitool-3efe83956be40c98f3ac44cd186a056ec5cf0066.tar.gz
pcitool-3efe83956be40c98f3ac44cd186a056ec5cf0066.tar.bz2
pcitool-3efe83956be40c98f3ac44cd186a056ec5cf0066.tar.xz
pcitool-3efe83956be40c98f3ac44cd186a056ec5cf0066.zip
Fix device detection code
-rw-r--r--misc/ipedevices.xml8
-rw-r--r--pcilib/xml.c2
-rw-r--r--xml/devices/testdevice.xml2
3 files changed, 6 insertions, 6 deletions
diff --git a/misc/ipedevices.xml b/misc/ipedevices.xml
index 889a917..b0c8ee3 100644
--- a/misc/ipedevices.xml
+++ b/misc/ipedevices.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<devices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <device vendor="10ee" device="0" model="ipecamera"/>
- <device vendor="10ee" device="1" model="ipecamera"/>
- <device vendor="10ee" device="2" model="ipedma"/>
- <device vendor="10ee" device="3" model="ipedma"/>
+ <device vendor="10ee" device="0000" model="ipecamera"/>
+ <device vendor="10ee" device="0001" model="ipecamera"/>
+ <device vendor="10ee" device="0002" model="ipedma"/>
+ <device vendor="10ee" device="0003" model="ipedma"/>
</devices>
diff --git a/pcilib/xml.c b/pcilib/xml.c
index 467c9c7..c514f40 100644
--- a/pcilib/xml.c
+++ b/pcilib/xml.c
@@ -1294,7 +1294,7 @@ char *pcilib_detect_xml_model(pcilib_t *ctx, unsigned int vendor_id, unsigned in
xmlXPathObjectPtr nodes;
xmlChar xpath_query[64];
- xmlStrPrintf(xpath_query, sizeof(xpath_query), (xmlChar*)"/devices/device[@vendor=%x and @device=%x]/@model", vendor_id, device_id);
+ xmlStrPrintf(xpath_query, sizeof(xpath_query), (xmlChar*)"/devices/device[@vendor=\"%04x\" and @device=\"%04x\"]/@model", vendor_id, device_id);
data_dir = getenv("PCILIB_DATA_DIR");
if (!data_dir) data_dir = PCILIB_DATA_DIR;
diff --git a/xml/devices/testdevice.xml b/xml/devices/testdevice.xml
index d7f7d11..c9cdd3d 100644
--- a/xml/devices/testdevice.xml
+++ b/xml/devices/testdevice.xml
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<devices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <device vendor="0000" device="0" model="test"/>
+ <device vendor="0000" device="0000" model="test"/>
</devices>