Browse Source

Fix device detection code

Suren A. Chilingaryan 8 years ago
parent
commit
3efe83956b
3 changed files with 6 additions and 6 deletions
  1. 4 4
      misc/ipedevices.xml
  2. 1 1
      pcilib/xml.c
  3. 1 1
      xml/devices/testdevice.xml

+ 4 - 4
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>

+ 1 - 1
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;

+ 1 - 1
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>