[Pcsclite-cvs-commit] r5945 - /trunk/PCSC/src/pcsc-spy.py
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Sep 9 07:42:46 UTC 2011
Author: rousseau
Date: Fri Sep 9 07:42:45 2011
New Revision: 5945
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5945
Log:
Make pylint happier
Modified:
trunk/PCSC/src/pcsc-spy.py
Modified: trunk/PCSC/src/pcsc-spy.py
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/pcsc-spy.py?rev=5945&op=diff
==============================================================================
--- trunk/PCSC/src/pcsc-spy.py (original)
+++ trunk/PCSC/src/pcsc-spy.py Fri Sep 9 07:42:45 2011
@@ -1,7 +1,9 @@
#! /usr/bin/env python
+"""
# Display PC/SC functions arguments
# Copyright (C) 2011 Ludovic Rousseau
+"""
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,7 +22,6 @@
import os
import atexit
-import sys
fifo = os.path.expanduser('~/pcsc-spy')
@@ -32,10 +33,12 @@
def cleanup():
+ """ cleanup at exit """
os.unlink(fifo)
def parse_rv(line):
+ """ parse the return value line """
(function, rv) = line.split(':')
if function[0] != '<':
raise Exception("Wrong line:", line)
@@ -44,6 +47,7 @@
def log_rv(f):
+ """ log the return value """
line = f.readline().strip()
rv = parse_rv(line)
if not "0x00000000" in rv:
@@ -53,39 +57,47 @@
def log_in(line):
+ """ generic log for IN line """
print color_green + " i " + line + color_normal
def log_out(line):
+ """ generic log for OUT line """
print color_magenta + " o " + line + color_normal
def log_in_hCard(f):
+ """ log hCard IN parameter """
hContext = f.readline().strip()
log_in("hCard: %s" % hContext)
def log_in_hContext(f):
+ """ log hContext IN parameter """
hContext = f.readline().strip()
log_in("hContext: %s" % hContext)
def log_out_hContext(f):
+ """ log hContext OUT parameter """
hContext = f.readline().strip()
log_out("hContext: %s" % hContext)
def log_in2(header, f):
+ """ generic log IN parameter """
data = f.readline().strip()
log_in("%s %s" % (header, data))
def log_out2(header, f):
+ """ generic log OUT parameter """
data = f.readline().strip()
log_out("%s %s" % (header, data))
def log_out_n_str(size_name, field_name, f):
+ """ log multi-lines entries """
data = f.readline().strip()
log_out("%s %s" % (size_name, data))
size = int(data, 16)
@@ -99,10 +111,12 @@
def log_name(name):
+ """ log function name """
print color_blue + name + color_normal
def SCardEstablishContext(f):
+ """ SCardEstablishContext """
log_name("SCardEstablishContext")
dwScope = f.readline().strip()
scopes = {0: 'SCARD_SCOPE_USER',
@@ -114,18 +128,21 @@
def SCardIsValidContext(f):
+ """ SCardIsValidContext """
log_name("SCardIsValidContext")
log_in_hContext(f)
log_rv(f)
def SCardReleaseContext(f):
+ """ SCardReleaseContext """
log_name("SCardReleaseContext")
log_in_hContext(f)
log_rv(f)
def SCardListReaders(f):
+ """ SCardListReaders """
log_name("SCardListReaders")
log_in_hContext(f)
log_in2("mszGroups:", f)
@@ -134,6 +151,7 @@
def SCardListReaderGroups(f):
+ """ SCardListReaderGroups """
log_name("SCardListReaderGroups")
log_in_hContext(f)
log_in2("pcchGroups:", f)
@@ -142,6 +160,7 @@
def SCardGetStatusChange(f):
+ """ SCardGetStatusChange """
log_name("SCardGetStatusChange")
log_in_hContext(f)
log_in2("dwTimeout:", f)
@@ -150,6 +169,7 @@
def SCardFreeMemory(f):
+ """ SCardFreeMemory """
log_name("SCardFreeMemory")
log_in_hContext(f)
log_in2("pvMem:", f)
@@ -157,6 +177,7 @@
def SCardConnect(f):
+ """ SCardConnect """
log_name("SCardConnect")
log_in_hContext(f)
log_in2("szReader", f)
@@ -170,6 +191,7 @@
def SCardTransmit(f):
+ """ SCardTransmit """
log_name("SCardTransmit")
log_in_hCard(f)
log_in2("bSendBuffer", f)
@@ -178,6 +200,7 @@
def SCardControl(f):
+ """ SCardControl """
log_name("SCarControl")
log_in_hCard(f)
log_in2("dwControlCode", f)
@@ -187,6 +210,7 @@
def SCardGetAttrib(f):
+ """ SCardGetAttrib """
log_name("SCardGetAttrib")
log_in_hCard(f)
log_in2("dwAttrId", f)
@@ -195,6 +219,7 @@
def SCardSetAttrib(f):
+ """ SCardSetAttrib """
log_name("SCardSetAttrib")
log_in_hCard(f)
log_in2("dwAttrId", f)
@@ -203,6 +228,7 @@
def SCardStatus(f):
+ """ SCardStatus """
log_name("SCardStatus")
log_in_hCard(f)
log_in2("pcchReaderLen", f)
@@ -216,6 +242,7 @@
def SCardReconnect(f):
+ """ SCardReconnect """
log_name("SCardReconnect")
log_in_hCard(f)
log_in2("dwShareMode", f)
@@ -226,6 +253,7 @@
def SCardDisconnect(f):
+ """" SCardDisconnect """
log_name("SCardDisconnect")
log_in_hCard(f)
log_in2("dwDisposition", f)
@@ -243,6 +271,7 @@
print "fifo %s already present. Reusing it." % fifo
f = open(fifo, 'r')
+ #import sys
#f = sys.stdin
# check version
@@ -250,10 +279,6 @@
if version != "PCSC SPY VERSION: 1":
print "Wrong version:", version
return
-
- functions = {'SCardEstablishContext': SCardEstablishContext,
- 'SCardIsValidContext': SCardIsValidContext,
- 'SCardReleaseContext': SCardReleaseContext}
line = f.readline()
while line != '':
More information about the Pcsclite-cvs-commit
mailing list