Closed dauheeIRL closed 11 years ago
Thanks for the report! My one modem started doing something similar after I enabled the SIM PIN, but it would only reset the SMSC after a complete power down. Thanks for the suggestion though - I'll add something similar to connect() for you modem and others like it.
Could you perhaps put a line in connect() that spits out the SMSC number after each instruction currently in there, so we can figure out which command is triggering the reset? Something simple like self.write('AT+CSCA?') combined with the usual debug log output should work fine.
OK I'm at a total loss. I am no longer experiencing this behaviour! I put in the self.write('AT+CSCA?') after each command and the SMSC remained. I'm not sure how this can happen! I was travelling while testing, I don't know if it could have had something to do with it (roaming or something like that).
(Nothing to do with this, but I am also confused as I can send SMS even though I have no credit on the card. My head is hurts trying to figure this one out!)
Hmm... Maybe the roaming could have been what caused it (specifically since the values were set to "random" numbers instead of just erased completely).
I am not too keen on adding code to the connect() method without verifying what the problem is - too much like "shotgun debugging" for my tastes. ;-)
For now I am going to close this ticket as "invalid" - if we can find a more concrete, repeatable scenario I'll be happy to re-visit this ticket and address it. Thanks again for the report and debugging though - your input has been extremely valuable.
OK a little bit of sanity has come back. I was checking self.smsc each time, but I forgot that caches the value. After using self.write('AT+CSCA?') it appears the SMSC is lost after self.write('AT+CSMP=49,167,0,0') in connect. This is quite possibly specific to my modem and I have an easy workaround so totally agree to put the shotgun away for this one :)
Cheers.
Thanks for the information, and it makes much more sense now. The issue has been fixed in b16357b5e8ca8818b77bce608aad0fd27cf2a471
This is perfect and has resolved that issue now. Many thanks for this.
Thanks for the (very) thorough investigation! Your modem's behaviour in this regard is very strange; I've seen slow SIM cards and slow modems before, but it shouldn't give a 330 error if it is waiting for the SIM (or something else) - that's what the "_writeWait" attribute and automatic handling of CME 515 (device busy) and CME 14 (SIM busy) errors are for (in write()).
I'll try to come up with something that handles this in a similar fashion as the 515 and 14 errors, but for that I need more output from you (so that I can modify the modem profile I'm using for unit testing). Could you please modify that script you posted to print out the exact response from the modem instead of 'retry get smsc'? Just change this:
self.write('AT+CSCA?') #won't reach next line if there is an error
to
response = self.write('AT+CSCA?', parseError=False)
print(response)
EDIT: You'll need to change your while loop's condition as well. Something like:
while True:
response = self.write('AT+CSCA?', parseError=False)
print('response:',response)
#currentSmscNumber = self.smsc
if response and response[-1] == 'OK':
break
print('got smsc')
print("took seconds: %i"%(time.time() - starttime))
Thanks (and thanks for your patience!)
Apologies I made a post on this thread and then deleted. This issue is totally sorted for me now. I will raise another issue with text I removed from here.
Sorry about that.
Its Mr. Trouble again :)
The SMSC number appears to get wiped on each connect - the return value of modem.smsc() goes to: +10787132000000000000000000000000000000000 But another time it goes to modem.smsc(): +47204226000000000000000000000000000000000
Not sure what the string is but from debugging it looks like AT+CSCA? value is: + I didn't see this behaviour before, not sure if its something new. to get around this I put the following 2 lines after the setting echo off line in the connect function: self.write('ATE0') # echo off tempsmsc = self.smsc
and this at the end of connect: if tempsmsc != "+": self.smsc = tempsmsc
Again, this could be non standard behaviour by my modem, but I have seen lots of posts about SMSC needing to be set manually which could be related.