--On Tuesday, July 07, 2009 00:03:49 +0100 Rick Jones
<[email protected]> wrote:
I find that about one time in 4 or 5 it doesn't detect any port as a
modem, but unplug/re-plug and it usually gets it. I think this is probably
because the probe responses get masked by the stream of UMs coming out
(+ZUSIMR:2), these need to be killed off by sending +CPMS?. This has to be
done anyway to get the thing to dial reliably - I rely on an external
script to do it at the moment, but it's not ideal. Would it be feasible for
nm-modem-probe to do this?
There is another problem with the serial port termios modes, AFAICT, NM
doesn't set them up, but neither does the Option driver. They can have an
arbitrary state which results in unpredictable behaviour, and even kernel
panics.
OK, I retract that, having looked at the source code!
It's strange, but when trying to get concrete symptoms from the previous
erratic behaviour, I was certain that running "stty raw" on each port
improved the way it worked. Must have been an illusion.
However, I've looked at nm-modem-probe, and tried a patch which seems to
work quite well - diff is attached.
It sends an initialisation to the modem before trying the various tests,
this is "AT E0 +CPMS". Turning off echo reduces the clutter in the
responses, and +CPMS is ZTE-specific to stop it emitting continuous UMs,
which just get in the way of everything. +CPMS is actually invalid, but has
the right effect, and should be benign on any other modem.
I also removed the \n from the modem commands, again it reduces response
clutter (the modem takes \r as command terminator). However, maybe \r\n is
needed for other modems? I don't know.
With this patch I now get 100% modem detection, and connection on the first
or second try. That is a HUGE improvement!
Rick
--- nm-modem-probe-orig.c 2009-07-06 15:36:36.000000000 +0100
+++ nm-modem-probe.c 2009-07-07 12:24:15.000000000 +0100
@@ -329,6 +329,15 @@
timeout_ms -= 500;
}
+ /* PATCH - turn off echo and send +CPMS to stop ZTE +ZUSIMR messages */
+ if (modem_send_command (fd, "AT E0 +CPMS\r"))
+ {
+ const char *null_responses[] = { NULL };
+ /* we expect ERROR response! */
+ modem_wait_reply (fd, 2, null_responses, terminators, &term_idx, &reply);
+ }
+ /* END PATCH */
+
/* Standard response timeout case */
timeout_ms += 3000;
@@ -339,7 +348,7 @@
g_get_current_time (&start);
idx = term_idx = 0;
- send_success = modem_send_command (fd, "AT+GCAP\r\n");
+ send_success = modem_send_command (fd, "AT+GCAP\r");
if (send_success)
idx = modem_wait_reply (fd, 2, gcap_responses, terminators, &term_idx, &reply);
else
@@ -391,7 +400,7 @@
reply = NULL;
verbose ("GCAP failed, trying ATI...");
- if (modem_send_command (fd, "ATI\r\n")) {
+ if (modem_send_command (fd, "ATI\r")) {
idx = modem_wait_reply (fd, 3, ati_responses, terminators, &term_idx, &reply);
if (0 == term_idx && 0 == idx) {
verbose ("ATI response: %s", reply);
@@ -410,7 +419,7 @@
if ((idx != -2) && !(ret & MODEM_CAP_GSM) && !(ret & MODEM_CAP_IS707_A)) {
const char *cgmm_responses[] = { CGMM_TAG, NULL };
- if (modem_send_command (fd, "AT+CGMM\r\n")) {
+ if (modem_send_command (fd, "AT+CGMM\r")) {
idx = modem_wait_reply (fd, 5, cgmm_responses, terminators, &term_idx, &reply);
if (0 == term_idx && 0 == idx) {
verbose ("CGMM response: %s", reply);
_______________________________________________
NetworkManager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list