This page describes the steps necessary to read smartcards using Gentoo Linux.
There are USB and serial card readers. The discussed steps here are for serial card readers, the one used is Towitoko's CHIPDRIVE micro 100, which is fully supported. Also tested was the CHIPDRIVE micro 120.
The steps needed to get the card reader software installed are:
emerge -av sys-apps/pcsc-lite emerge -av app-misc/towitoko
The configuration file is /etc/reader.conf.d/reader.conf. Add the following:
FRIENDLYNAME "Towitoko CHIPDRIVE micro 100 V4.30" DEVICENAME /dev/ttyS0 LIBPATH /usr/lib/libtowitoko.so.2.0.0 CHANNELID 0x0103F8
Make sure the devicename and the channel ID match your system. Use the following for reference:
Plug the card reader in, then use the provided testing application in /usr/bin/tester.
Press “in”, then select the COM port where the card has been plugged in. If all is well, you see
... COM1 Status: Processor smartcard present ...
Next, start the pcscd daemon in debug mode. Note the the configuration file has to be provided with option -c, otherwise the daemon fails to read it. This is considered a bug by the author which'll probably be reported later.
pcscd -d --info -c /etc/reader.conf.d/reader.conf
View the output of /var/log/messages, if pscsd is properly configured, the reader is shown there:
Sep 22 20:30:01 hostname pcscd: Card ATR: 3A 84 00 12 02 01 00 95
To stop the daemon, kill the process:
If you have more than one reader, you can add the configuration to /etc/reader.conf.d/reader.conf, creating an additional descriptive block.
Reading and editing the phone numbers on a SIM card with the above setup is possible with the use of an SIM card adapter and the right application. The one presented here is monosim. Note that with the described system, Gentoo Linux, pcsc-lite and libchipcard, card readers micro 100 and micro 120 it has only been possible to read a German D1 card, not D2 (Vodafone).
This application uses the mono framework, which makes installation rather hefty just for this little application (still it might be useful for you.)
The needed steps are:
emerge -av mono emerge -av gtk-sharp emerge -av glade-sharp
Download the monosim application, unpack in a new folder, don't start it yet.
mkdir monosim cd monosim/ tar xzvf ../monoSIM_v1.3.0.Linux.tar.gz
As root, start the pcscd daemon:
pcscd -c /etc/reader.conf.d/reader.conf
Now start the monosim application:
That's it! You should now be able to read, export and edit the phone numbers stored on the card.
Unfortunately I did not get any application to work which uses PC/SC libray as described above. Here's a quick rundown of an alternative procedure, using libchipdrive, following a howto on forums.gentoo.org:
emerge -av libchipcard vi /etc/chipcard3/server/chipcardd3.conf vi /etc/chipcard3/client/chipcardc3.conf chipcardd3 -C /etc/chipcard3/server/chipcardd3.conf addreader --dtype tow_ctapi --rtype tow_cdm --rname towitoko2 --rport COM1 chipcardd3 -C /etc/chipcard3/server/chipcardd3.conf --pidfile /var/run/chipcardd3.pid -f --loglevel notice --logtype console chipcardd3 -C /etc/chipcard3/server/chipcardd3.conf --pidfile /var/run/chipcardd3.pid chipcard3-tool list chipcard3-tool check /usr/bin/kvkcard3 read