Code Painters The Art of Coding

6Sep/102

Android emulator and the SIM card serial number

Update: Please see my latest post about this topic.

After publishing the post about changing the IMEI number, I was asked about modifying the SIM card serial number. Yes, it is perfectly possible, but requires a bit more investigation. In general, the mechanism used is the same (i.e. AT commands sent to the emulated GSM modem).

The telephony subsystem sends the following command to the emulated modem to retrieve the SIM card serial number (use any GSM modem manual for reference):

AT+CRSM=176,12258,0,0,10

The first numerical parameter denotes a command to execute on the SIM card, 176 stands for READ BINARY. Second parameter is the field identifier - Integrated Circuit Card identification, that is the SIM card serial number (for the full list of fields, called Elementary Files, refer to 3GPP TS 51.011 specification). Emulated modem responds with the following hard-coded response:

+CRSM: 144,0,98101430121181157002

The string of digits following the second comma is what we're looking for, however, with every pair of digits swapped. All the SIM card commands and responses can be found in external/qemu/telephony/sim_card.c.

Changing the emulated SIM card serial number is now as easy changing the IMEI. To change the SIM card serial to e.g. 12345678901234567890, one has to:

  • backup the emulator binary ;)
  • open the binary in the hex editor
  • search for 98101430121181157002
  • replace it with 21436587092143658709 (remember about swapping)
Share:
  • Facebook
  • Digg
  • del.icio.us
  • Twitter
  • LinkedIn
  • Google Bookmarks
  • Reddit
  • StumbleUpon
Comments (2) Trackbacks (0)
  1. Thanks a lot.
    This is very useful. Can’t understand why they hardcoded this information.

    • Well, I can’t understand it either. Seems like they just hacked the GSM modem emulation in a hurry.

      I’ve made a patch permitting to configure IMEI/IMSI in the AVD settings file, but it’s not yet ready for release.

      Actually, there are many things to improve about the Android SDK. I do not understand why they decided to emulate the whole software stack, including ARM CPU. iPhone simulator is a simple API re-implementation, amazingly fast compared to Android’s one :)


Add Comment Register



Leave a comment

No trackbacks yet.