Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Getting phone model

I put Korakot snippet (Looking up phone model using firmware code) into an useful module.

You need miso module.
All info can be found at this site

   1  
   2  #
   3  # Firmware.py  infos found at http://homepage.mac.com/alvinmok/nokia/firmware.html
   4  #
   5  
   6  '''
   7  firmware.prefix_name 
   8  firmware.suffix_name 
   9  firmware.phone_model
  10  firmware.phone_cpu_speed
  11  '''
  12  import sysinfo
  13  import miso
  14  
  15  ECPUSpeed = 0x0B
  16  
  17  mapping_firmware_model={
  18    'RM-51': '3230',
  19    'RM-38': '3250',
  20    'NHM-10': '3600',
  21    'NHM-10X': '3620',
  22    'NHL-8': '3650',
  23    'NHL-8X': '3660',
  24    'RM-25': '6260',
  25    'RM-29': '6260b',
  26    'NHL-10': '6600',
  27    'NHL-12': '6620',
  28    'NHL-12X': '6620',
  29    'RM-1': '6630',
  30    'RH-67': '6670',
  31    'RH-68': '6670b',
  32    'RM-36': '6680',
  33    'RM-57': '6681',
  34    'RM-58': '6682',
  35    'RH-51': '7610',
  36    'RH-52': '7610b',
  37    'NHL-2NA': '7650',
  38    'RM-49': 'E60-1',
  39    'RM-89': 'E61-1',
  40    'RM-10': 'E70-1',
  41    'RM-24': 'E70-?',
  42    'NEM-4': 'N-Gage',
  43    'RH-29': 'N-Gage QD (asia/europe)',
  44    'RH-47': 'N-Gage QD (americas)',
  45    'RM-84': 'N70-1',
  46    'RM-99': 'N70-5',
  47    'RM-67': 'N71-1',
  48    'RM-112': 'N71-5',
  49    'RM-91': 'N80-3',
  50    'RM-92': 'N80-1',
  51    'RM-42': 'N90-1',
  52    'RM-43': 'N91-1',
  53    'RM-158': 'N91-5' }
  54  
  55  mapping_prefix_description ={
  56   'N':'Mobile Phone',
  57   'R':'Computing Device',
  58   'T':'Terminal'}
  59  
  60  mapping_suffix_description ={
  61      'B': 'GSM 900/1900',
  62      'C': 'DAMPS 800',
  63      'D': 'CDMA/AMPS 800',
  64      'E': 'GSM 900/1800',
  65      'F': 'NMT-450',
  66      'K': 'GSM 1800',
  67      'L': 'GSM 900/1800/1900 or GSM 850/1800/1900',
  68      'M': 'EGSM 900/1800 (may include WCDMA)',
  69      'N': 'IEEE 802.11b',
  70      'P': 'CDMA 800',
  71      'W': 'AMPS/TDMA 800/1900',
  72      'X': 'ETACS/TACS'}
  73  
  74  sw = sysinfo.sw_version()
  75  sw_list = sw.split(' ')
  76  
  77  firmware_version = sw_list[1]
  78  firmware_date = sw_list[2]
  79  firmware_code=sw_list[3]
  80  
  81  temp = firmware_code.split('-')
  82  firmware_prefix = temp[0][0]
  83  firmware_suffix = temp[0][-1]
  84  
  85  prefix_name = mapping_prefix_description[firmware_prefix]
  86  suffix_name = mapping_suffix_description[firmware_suffix]
  87  phone_model = mapping_firmware_model[firmware_code] 
  88  phone_cpu_speed = miso.get_hal_attr(ECPUSpeed) # CPU speed in Hz


usage:
   1  
   2  >>>import firmware
   3  >>>firmware.phone_model
   4  >>>'6600'
   5  >>>firmware.phone_cpu_speed
   6  >>>104000

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS