gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-21


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-213-g9914511
Date: Sat, 09 Apr 2011 19:07:17 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  9914511ca7744c6c094b0b6a74af7b9f16f117cb (commit)
      from  a4937c89b3f43c97dd062b9084a06b7c6ed7323a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=9914511ca7744c6c094b0b6a74af7b9f16f117cb


commit 9914511ca7744c6c094b0b6a74af7b9f16f117cb
Author: Pawel Kot <address@hidden>
Date:   Sat Apr 9 20:49:00 2011 +0200

    fix: workaround when gnokii hangs on opening the serial port
    
    We've got reports that gnokii does hang when opening the serial port in AT
    mode for Nokia phones. The debug output ends with the line:
     Serial device: opening device /dev/ttyACM0
    The example reported device is:
     Bus 001 Device 002: ID 0421:047b Nokia Mobile Phones
    Strace shows that the hang can be caused by:
     tcsetattr(fd, TCSADRAIN, &t);
    or
     ioctl(fd, TIOCMBIS, &flags);
    Apparently they go together (if one doesn't work the other does not work
    neither). We suspect that this is the kernel problem. Some additional
    reports to describe the problem symptoms:
    http://old.nabble.com/Gnokii-hangs-on-ttyUSB0-at-an-ioctl-td7613918.html
    https://bugzilla.redhat.com/show_bug.cgi?id=504798
    
    The patch allows to disable setting port speed, DTR and RTS bits.
    To disable setting port speed set:
     serial_baudrate = 0
    in the config file. To disable DTS and RTS bits set:
     set_dtr_rts = 0
    in the config file.
    
    Thanks to Sapote at #gnokii IRC channel for help in debugging.

diff --git a/ChangeLog b/ChangeLog
index b4acdbb..cff81da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@
       files (eg. birthdays)                         (Daniele Forsi)
     o fix sms encoding: don't break multibyte characters when
       creating multipart messages                       (Paweł Kot)
+    o add possibility to disable setting serial port speed and
+      DTR and RTS bits                                  (Paweł Kot)
  * nk6510 driver updates
     o fix calendar handling issues (few off-by-ones)    (Paweł Kot)
     o implement deletecalendarnote for series40 3rd+ Ed (Paweł Kot)
diff --git a/Docs/sample/gnokiirc b/Docs/sample/gnokiirc
index 1165131..3b5aaaa 100644
--- a/Docs/sample/gnokiirc
+++ b/Docs/sample/gnokiirc
@@ -128,6 +128,9 @@ use_locking = yes
 
 # Baudrate to use on serial port connections.
 # Currently used only by models AT and BIP/CIMD. Defaults to 19200.
+# Set to 0 to disable port speed setting. Try doing this when gnokii hangs
+# on opening the serial port:
+# > Serial device: opening device /dev/ttyACM0
 serial_baudrate = 19200
 
 # Force waiting after each sent character the specified usec time.
@@ -146,6 +149,11 @@ serial_baudrate = 19200
 # when DCD line will drop.
 #require_dcd = 1
 
+# If set to 0, DTR and RTS will not be set on the serial line. Default is 1.
+# Try doing this when gnokii hangs on opening the serial port:
+# > Serial device: opening device /dev/ttyACM0
+#set_dtr_rts = 0
+
 # If you are using a bluetooth connection, you can specify the rfcomm
 # channel number here. If you don't specify the value, it is autodetected
 # on connection (it may take an additional second). FBUS connections always
diff --git a/common/cfgreader.c b/common/cfgreader.c
index fb2427d..626f3d6 100644
--- a/common/cfgreader.c
+++ b/common/cfgreader.c
@@ -809,6 +809,14 @@ static gn_error cfg_psection_load(gn_config *cfg, const 
char *section, const gn_
                cfg->require_dcd = def->require_dcd;
        }
 
+       if (!(val = gn_cfg_get(gn_cfg_info, section, "set_dtr_rts")))
+               cfg->set_dtr_rts = def->set_dtr_rts;
+       else if (sscanf(val, " %d %c", &cfg->set_dtr_rts, &ch) != 1) {
+               fprintf(stderr, _("Unsupported [%s] %s value \"%s\"\n"), 
section, "set_dtr_rts", val);
+               fprintf(stderr, _("Assuming: %d\n"), def->set_dtr_rts);
+               cfg->set_dtr_rts = def->set_dtr_rts;
+       }
+
        if (!(val = gn_cfg_get(gn_cfg_info, section, "smsc_timeout")))
                cfg->smsc_timeout = def->smsc_timeout;
        else if (sscanf(val, " %d %c", &cfg->smsc_timeout, &ch) == 1)
@@ -1207,6 +1215,7 @@ static gn_error cfg_file_or_memory_read(const char *file, 
const char **lines)
        gn_config_default.serial_write_usleep = -1;
        gn_config_default.hardware_handshake = false;
        gn_config_default.require_dcd = false;
+       gn_config_default.set_dtr_rts = true;
        gn_config_default.smsc_timeout = -1;
        gn_config_default.irda_string[0] = 0;
        gn_config_default.connect_script[0] = 0;
diff --git a/common/devices/unixserial.c b/common/devices/unixserial.c
index 564954d..985f1da 100644
--- a/common/devices/unixserial.c
+++ b/common/devices/unixserial.c
@@ -312,6 +312,9 @@ void serial_setdtrrts(int fd, int dtr, int rts, struct 
gn_statemachine *state)
 {
        unsigned int flags;
 
+       if (!state->config.set_dtr_rts)
+               return;
+
        flags = TIOCM_DTR;
 
        if (dtr)
@@ -363,6 +366,9 @@ gn_error serial_changespeed(int fd, int speed, struct 
gn_statemachine *state)
        int new_speed = B9600;
 
        switch (speed) {
+       case 0:
+               dprintf("Not setting port speed\n");
+               return;
        case 2400:
                new_speed = B2400;
                break;
diff --git a/include/gnokii/data.h b/include/gnokii/data.h
index a271361..0f4ea85 100644
--- a/include/gnokii/data.h
+++ b/include/gnokii/data.h
@@ -174,6 +174,7 @@ typedef struct {
                                                        /* Use with caution -- 
may break newer DCT4 phones */
 
        unsigned int use_locking;                       /* Should we use 
locking system or not */
+       int set_dtr_rts;                                /* Should we set DTR 
and RTS bits on the serial line */
        /* do not change the following values from userspace */
        char m_model[GN_MODEL_MAX_LENGTH];
        char m_manufacturer[GN_MANUFACTURER_MAX_LENGTH];

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                   |    2 ++
 Docs/sample/gnokiirc        |    8 ++++++++
 common/cfgreader.c          |    9 +++++++++
 common/devices/unixserial.c |    6 ++++++
 include/gnokii/data.h       |    1 +
 5 files changed, 26 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]