[Pcsclite-git-commit] [website] 02/02: matrix.py: support multiple identical VID/PID

Ludovic Rousseau rousseau at moszumanska.debian.org
Sun Nov 15 21:31:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository website.

commit 490e12ba1b66c09d28fd1c7b0203e97f6a6c8072
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Sun Nov 15 22:26:28 2015 +0100

    matrix.py: support multiple identical VID/PID
    
    If the same VendorID/ProductID is used more than once then the next
    occurences are labeled "_1", "_2", etc.
    
    For example a composite device with 2 (or more) CCID interfaces will
    have a different URL for each interface.
    
    Example: the Feitian R502 has 3 CCID interfaces.
    They are available at:
    https://pcsclite.alioth.debian.org/ccid/shouldwork.html#0x096E0x060D
    https://pcsclite.alioth.debian.org/ccid/shouldwork.html#0x096E0x060D_1
    https://pcsclite.alioth.debian.org/ccid/shouldwork.html#0x096E0x060D_2
---
 matrix.py        | 18 ++++++++++++++++--
 webpage.template |  4 ++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/matrix.py b/matrix.py
index 63e3589..dcf534c 100755
--- a/matrix.py
+++ b/matrix.py
@@ -344,16 +344,28 @@ def generate_page(section, title, comment, readers):
     for manufacturer in manufacturers:
         main_layer.write_layer('manufacturer', manufacturer=manufacturer)
 
+        old_idVendor = old_idProduct = ''
+        version = 0
+
         # for each reader
         for reader in sorted(manufacturer_readers[manufacturer]):
             image = "img/" + readers[reader].get('image', "no_image.png")
             im = Image.open("ccid/" + image)
             resolution = "width:%dpx;height:%dpx" % im.size
+            idVendor=readers[reader]['idVendor']
+            idProduct=readers[reader]['idProduct']
+            if old_idVendor == idVendor and old_idProduct == idProduct:
+                version += 1
+                version_str = "_%d" % version
+            else:
+                version = 0
+                version_str = ''
             note_layer = main_layer.open_layer('reader',
                 manufacturer=manufacturer,
                 product=readers[reader]['iProduct'],
-                idVendor=readers[reader]['idVendor'],
-                idProduct=readers[reader]['idProduct'],
+                idVendor=idVendor,
+                idProduct=idProduct,
+                version=version_str,
                 image=image,
                 style=resolution)
 
@@ -386,6 +398,8 @@ def generate_page(section, title, comment, readers):
             note_layer.write_layer('release',
                 release=readers[reader]['release'])
 
+            old_idVendor = idVendor
+            old_idProduct = idProduct
     file_writer.close()
 
 
diff --git a/webpage.template b/webpage.template
index 8338185..deb1fb6 100644
--- a/webpage.template
+++ b/webpage.template
@@ -50,8 +50,8 @@
     {reader}
     <ul>
         <li>
-            <a name="%idVendor%%idProduct%"></a>
-            %manufacturer% <a href="#%idVendor%%idProduct%">%product%</a>
+            <a name="%idVendor%%idProduct%%version%"></a>
+            %manufacturer% <a href="#%idVendor%%idProduct%%version%">%product%</a>
           <p><img src="%image%" alt="%manufacturer% %product%" style="%style%"></p>
           %contents%
       </li>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/website.git



More information about the Pcsclite-cvs-commit mailing list