Setting up SIM reader

From Rhizomatica Wiki
Jump to: navigation, search
HOWTO Install: SIM Reader

We have two options for the SIM reader:

 - SIM Reader connected to the BSC
 - SIM Reader connected to the admin PC

In the first scenario the SIM reader is connected to the BSC and by uncommenting the required code in RAI (/var/rhizomatica/rai/provisioning.php) it will automatically extract the IMSI and the 5 digit extension assigned to a phone.

The second scenario is when the SIM reader is connected to the admin PC and so the admin has to manually input in RAI the IMSI of the user in "Subscriber number" field. In order to do that the user needs to put the SIM in the reader, click on an icon on the desktop that will run a program and show the IMSI. Copy that IMSI and put it in the subscriber number for the provisioning.

For both options the proper packages needs to be installed in the platform in order for this to work.

Step 1

Install the "card" python library from Github:

 git clone
 cd card
 python install

Step 2

Install the following packages:

 apt-get install libccid pcscd python-pyscard

Start pcscd if it's not already running:

 /etc/init.d/pcscd start

Step 3

Plug the SIM reader and put a SIM in it, try to run


If it's working you will see the IMSI.

//Note: in the admin PC there is no /var/rhizomatica you will have to copy the script//

Step 4 (Only for Admin PC)

The Admin needs a way to see the IMSI in order to input the "Subscriber number" in RAI. In this admin PC you need to copy the script but since /var/rhizomatica/ does not exists put the script under /usr/bin/ so it will be /usr/bin/

Create the following bash script /usr/bin/


IMSI=`python /usr/bin/`
zenity \
--info \
--text="<span size=\"xx-large\">IMSI: $IMSI</span>" \
--title="SIM Reader" \

Save the file and give exec permission. chmod +x /usr/bin/

From ubuntu graphical interface open a terminal. Put the SIM in the reader and launch the command to see that is working.

If it's working you can now create an icon on the desktop that will execute the /usr/bin/ script.

Good luck!