New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset crashed device if needed #371
base: master
Are you sure you want to change the base?
Reset crashed device if needed #371
Conversation
Some phones or dongles (e.g. the Huawei E303) may crash, and constantly return '<CR><LF>+CMS<SPACE>ERROR:<SPACE>500<CR><LF>' after a SMS send query is sent. In this case, a soft reset (CFUN=0 then CFUN=1) is needed to get the dongle working again.
...maybe I should enclose the first |
Codecov Report
@@ Coverage Diff @@
## master #371 +/- ##
==========================================
- Coverage 35.82% 35.81% -0.01%
==========================================
Files 213 213
Lines 66947 66952 +5
==========================================
+ Hits 23981 23982 +1
- Misses 42966 42970 +4 |
/* Huawei devices may return UNKNOWN errors. A soft reset may help to recover */ | ||
SMSD_LogError(DEBUG_INFO, Config, "Resetting the device because of error", error); | ||
force_reset = TRUE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure here - ERR_UNKNOWN can also easily happen when Gammu doesn't understand some response and it could easily lead to reset loop.
I'd rather recommend using ResetFrequency to reset phone in defined intervals (eg. weekly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. However, I did not understand what happened until I thoroughly sniffed the AT command stream, and dug in gammu's code. At least, do you think the log files could be more explicit and give hints about this ResetFrequency when UNKNOWN errors are encountered?
I never payed attention to this feature until I saw it in the code (and I swear I read the documentation before using smsd :-) )
I get your point about a confusion about ERR_UNKNWON when Gammu doesn't understand some response. Do you think we should then distinguish two types of unknown errors, i.e. errors when Gammu does not understand, and errors when the dongle actually sends ERROR 500 messages over the wire? Because such an error 500 (= "unknown error" according to the AT standard) seems to be meaningful, at least for my dongle (more than if Gammu did not understand something).
Maybe we should also add a counter to prevent getting in a reboot loop?
My point is, I agree this may be dangerous, I agree I am using a crappy dongle, but I'm quite sure I'm not the only one to get such errors.
And I'm pretty sure 90% of the people getting such errors won't search as deep as I did. Giving them an out-of-the-box solution may ease their lives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that error 500 is the most frequent you get from the AT modem. So assuming it is good reason to reset doesn't sound reasonable. I can as well mean that Gammu constructed command that modem doesn't understand and resetting in that case would not make the situation any better.
I have only tested this with my own device.
My Huawei E303 dongle constantly bugs/crashes after a month or so of use. The only solution is to reset it (see the commit message).
This commit successfully resets my dongle when this bug is encountered. However, I have no way to test it on other devices. Could you please double check I have not broken the
ATGEN_Reset
function for non-E303 devices?Thanks