1. Install cmake
Code: Select all
sudo apt-get install cmake
2. Install make
Code: Select all
sudo apt-get install automake
3.Install gcc
Code: Select all
sudo apt-get install gcc
4.Install g++
Code: Select all
sudo apt-get install g++
5. Enter pyGlobalPlatform source code directory. Execute cmake to generate Makefile
Note: Whether to execute step 2 to 3 is according to your own system situation.
You can of course execute the command of this step to install the corresponding tools your system lacks according to the system prompt.
6. Execute make command
Code: Select all
make
make install (Administrator permission required)
7. Enter python
Code: Select all
import pyglobalplatform as gp
c = gp.establishContext()
readername = gp.listReaders(c)[0]
ci = gp.connectCard(c, readername, 1)
selectCommand = '\x00\xA4\x04\x00\x00'
for i in xrange(1000):
print ">> " + "".join("%02X" %(ord(v)) for v in selectCommand)
print "<< " + "".join("%02X" %(ord(v)) for v in gp.GP211_send_APDU(c, ci, None, selectCommand))
gp.disconnectCard(c, ci)
gp.releaseContext(c)
Note:
1. Please be sure that you have already installed GlobalPlatform and gppcscconnectionplugin
2. If GlobalPlatform and gppcscconnectionplugin are installed under /usr/local/lib, you need to add LD_LIBRARY_PATH:
Code: Select all
export LD_LIBRARY_PATH="/usr/lib;/usr/local/lib;"
3. If you have any problem, feel free to address them here!