[Pcsclite-git-commit] [website] 02/07: Reader selection: add support of dwFeatures
Ludovic Rousseau
rousseau at moszumanska.debian.org
Sat Oct 17 17:42:25 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 64d0568d1ade29ebdc1fcbb269d731cd09f7439f
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Fri Oct 16 17:55:04 2015 +0200
Reader selection: add support of dwFeatures
It is now possible to filter according to the dwFeatures field.
A dropdown menu is presented so you can select the feature in a list
(and not use a numeric value)
---
select_readers/js/main.js | 64 ++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 60 insertions(+), 4 deletions(-)
diff --git a/select_readers/js/main.js b/select_readers/js/main.js
index f6b8104..bfcfa73 100644
--- a/select_readers/js/main.js
+++ b/select_readers/js/main.js
@@ -32,6 +32,25 @@
var Filter, Filtered_readers, Results;
+var Readers_dwFeatures = [
+ ["Automatic activation of ICC on inserting", 0x000004, 0x000004],
+ ["Automatic baud rate change according to frequency and Fi, Di params", 0x000020, 0x000020],
+ ["Automatic ICC clock frequency change according to parameters", 0x000010, 0x000010],
+ ["Automatic ICC voltage selection", 0x000008, 0x000008],
+ ["Automatic IFSD exchange as first exchange (T=1)", 0x000400, 0x000400],
+ ["Automatic parameter configuration based on ATR data", 0x000002, 0x000002],
+ ["Automatic parameters negotiation made by the CCID", 0x000040, 0x000040],
+ ["Automatic PPS made by the CCID", 0x000080, 0x000080],
+ ["CCID can set ICC in clock stop mode", 0x000100, 0x000100],
+ ["NAD value other than 00 accepted (T=1)", 0x000200, 0x000200],
+ ["ICCD", 0x000800, 0x000800],
+ ["Character level exchange", 0x000000, 0x070000],
+ ["TPDU level exchange", 0x010000, 0x070000],
+ ["Short APDU level exchange", 0x020000, 0x070000],
+ ["Short and Extended APDU level exchange", 0x040000, 0x070000],
+ ["USB Wake up signaling supported on card insertion and removal", 0x100000, 0x100000]];
+
+
function reader_url(reader) {
"use strict";
@@ -100,7 +119,7 @@ function update_list() {
function match(filters, reader) {
"use strict";
- var a, b, i, l, f, field, value, relation;
+ var a, b, i, l, f, field, value, relation, v, m;
for (f = 0; f < filters.length; f += 1) {
field = filters[f][0];
@@ -114,6 +133,14 @@ function match(filters, reader) {
if (reader[field].indexOf(value) === -1) {
return false;
}
+ } else if ('dwFeatures' === field) {
+ v = Readers_dwFeatures[value][1]; /* value */
+ m = Readers_dwFeatures[value][2]; /* mask */
+ /*jslint bitwise: true */
+ if ((reader[field] & m) !== v) {
+ return false;
+ }
+ /*jslint bitwise: false */
} else {
if (reader[field] !== value) {
return false;
@@ -149,7 +176,7 @@ function match(filters, reader) {
function function_filter() {
"use strict";
- var section, iManufacturer, reader, work_reader, f, value, field;
+ var section, iManufacturer, reader, work_reader, f, value, field, feature;
Filtered_readers = [];
@@ -164,7 +191,15 @@ function function_filter() {
Filter[f][1] = $("#relation_" + f).html().split(' ')[0];
/* if the reader value is an integer then we convert the user value */
- if (typeof reader[field] === 'number') {
+ if (field === 'dwFeatures') {
+ for (feature in Readers_dwFeatures) {
+ if (Readers_dwFeatures.hasOwnProperty(feature)) {
+ if (value === Readers_dwFeatures[feature][0]) {
+ value = feature; /* the feature index */
+ }
+ }
+ }
+ } else if (typeof reader[field] === 'number') {
value = parseInt(value, 10);
// console.log(value);
@@ -267,6 +302,23 @@ function update_filters_ihm() {
}
}
html += '</select>';
+ } else if (Filter[f][0] === 'dwFeatures') {
+ // dwFeatures: predefined list
+ html += '<div class="input-group-btn">';
+ html += '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" id="relation_' + f + '">AAA</button>';
+ html += '<ul class="dropdown-menu" role="menu">';
+ html += ' <li><a href="#">= </a></li>';
+ html += ' <li class="divider"></li>';
+ html += ' <li><a href="#">disabled</a></li>';
+ html += '</div>';
+
+ html += '<select class="form-control update-ihm" id="value_' + f + '">';
+ for (feature in Readers_dwFeatures) {
+ if (Readers_dwFeatures.hasOwnProperty(feature)) {
+ html += '<option>' + Readers_dwFeatures[feature][0] + '</option>';
+ }
+ }
+ html += '</select>';
} else {
html += '<div class="input-group-btn">';
html += '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" id="relation_' + f + '">AAA</button>';
@@ -287,7 +339,11 @@ function update_filters_ihm() {
$("#filters").append(html);
$("#relation_" + f).html(Filter[f][1] + ' <span class="caret"></span>');
- $("#value_" + f).val(Filter[f][2]);
+ if (Filter[f][0] === 'dwFeatures') {
+ $("#value_" + f).val(Readers_dwFeatures[Filter[f][2]]);
+ } else {
+ $("#value_" + f).val(Filter[f][2]);
+ }
}
// activate filters menu
--
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