Closed jonathanendersby closed 11 years ago
Hi, this was by design, at least initially - since most modems issue an "OK" response to the +CUSD immediately, and then issue asynchronous notification for the actual USSD response (this also caused the "incorrect order" issue you reported previously). In other words: that 5 second timeout was originally meant for the acknowledgement "OK", and not for the actual USSD response. Since the "wrong ordering" is now officially supported, this is indeed a bug, and I'll increase the timeout value as you suggested. Thanks!
Thanks again for the report and patch. d7c77de31f5894f6d593fb711675940e8ebf8d67 should fix this; please feel free to re-open this ticket if it does not resolve it for you.
Hi
Not sure if this was "by design" or simply an omission, but, the default timeout is 5 seconds for most things and 15 seconds for USSD. 15 seconds is indeed needed, again for Vodacom. (I timed a few balance check queries and the average on Vodacom was just over 5 seconds).
So, what's happening (as I understand it) - because responseTimeout isn't being passed to the self.write, we're defaulting to the pyserial timeout (which is 5) and even though your thread is waiting around, pyserial isn't, and we get a timeout.
The fix is as simple as changing: (modem.py Line:538)
cusdResponse = self.write('AT+CUSD=1,"{0}",15'.format(ussdString))
to
cusdResponse = self.write('AT+CUSD=1,"{0}",15'.format(ussdString), timeout=responseTimeout)
Cheers, J.