faucamp / python-gsmmodem

Python module to control a GSM modem attached to the system: send/receive SMS messages, handle calls, etc
GNU Lesser General Public License v3.0
386 stars 304 forks source link

nokia gsm - no sms reading #15

Closed the01 closed 11 years ago

the01 commented 11 years ago

Hey guys,

I'm not sure if you want to support all kinds of gsm modems or only certain ones, but just in case:

from what i could gather there is a problem with newer nokia phones (and their modems), s60 i believe, as they do not support receiving sms.

Because of that fails the connect() at two points:

at+cpms=?

+CPMS: (),(),()

OK

and

at+cnmi=2,1,0,2

ERROR

or in code (line 227 in modem.py):

self.write('AT+CPMS={0}'.format(','.join(cpmsItems))) # Set message storage del cpmsSupport del cpmsLine

self.write('AT+CNMI=2,1,0,2') # Set message notifications

i have bypassed that issue for now by catching the exception and checking if it the (),(),() response:

try: self.write('AT+CPMS={0}'.format(','.join(cpmsItems))) # Set message storage except CommandError as e: if cpmsItems == [ '' , '' , '' ]: pass # my error -> ignore else: raise e del cpmsSupport del cpmsLine

try: self.write('AT+CNMI=2,1,0,2') # Set message notifications except CommandError as e: if cpmsItems == [ '' , '' , '' ]: pass # my error -> ignore else: raise e

it's a quick and dirty fix, but for now it works..

cheers

faucamp commented 11 years ago

Thanks for the report and suggested patch! I'd like to add your modem's profile to the unit tests, since I haven't encountered one of these before. Could you please post the output of "identify-modem.py -d"? (under the "tools" directory of python-gsmmodem)

the01 commented 11 years ago

args: Namespace(baud=115200, debug=True, pin=None, port='/dev/ttyACM0') Sure:

Connecting to GSM modem on /dev/ttyACM0...

== MODEM DEBUG INFORMATION ==

ATI ['Nokia', 'OK'] AT+CGMI: ['Nokia', 'OK'] AT+CGMM: ['Nokia N95 8GB', 'OK'] AT+CGMR: ['V 06wk41v64.20', '01-10-09', 'RM-320', '(c) Nokia', 'OK'] AT+CFUN=?: ['+CFUN: (0,1),(0,1)', 'OK'] AT+WIND=?: ['ERROR'] AT+WIND?: ['ERROR'] AT+CPMS=?: ['+CPMS: (),(),()', 'OK'] AT+CNMI=?: ['ERROR'] AT+CVHU=?: ['+CVHU: (0-2)', 'OK'] AT+CSMP?: ['+CSMP: 49,167,0,0', 'OK'] AT+GCAP: ['+GCAP: +CGSM,+DS,+W', 'OK'] AT+CPIN? ['+CPIN: READY', 'OK'] AT+CLAC: ['ERROR']

faucamp commented 11 years ago

Thanks again for the report. I've modified connect() to detect whether or not the modem is capable of reading stored SMSs, so the rest of the functionality should work fine now. Please re-open the ticket if the problem persists.