gnokii-users
[Top][All Lists]
Advanced

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

Re: FBUS speed change to 19200 and 115200


From: Jari Turkia
Subject: Re: FBUS speed change to 19200 and 115200
Date: Wed, 21 Nov 2007 23:34:46 +0200
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Pawel Kot wrote:

Go ahead. I will try to test it with dlr3p cable and 6210 and 6310 models.

Guess what! I finally cracked it. The patch is included. It has nothing to do with baud-rate.

First you need to increase the sleep into 50000 usecs. The command simply does not sink in very fast.

Secondly you cannot free the device instance on FBUS terminate-command. On init there will be three attempts. Two of them will fail due to already lost device instance. In my case the 3rd one will succeed if there still is a device instance to refer.

Additionally (from fbus.c):
   res = device_read(buffer + offset, 255, state);
That has a potential buffer overflow. What happens when command returns over 255 characters?

Regards,
Jari Turkia

diff -aur gnokii/common/links/fbus.c 
gnokii-0.6.21-CVS20071121/common/links/fbus.c
--- gnokii/common/links/fbus.c  2007-11-21 22:24:58.000000000 +0200
+++ gnokii-0.6.21-CVS20071121/common/links/fbus.c       2007-11-21 
22:58:35.000000000 +0200
@@ -112,7 +112,7 @@
        /* Read from the port only when select succeeds */
        while (res > 0 && waitformore) {
                /* Avoid 'device temporarily unavailable' error */
-               usleep(50);
+               usleep(50000);
                res = device_read(buffer + offset, 255, state);
                /* The whole answer is read */
                if (strstr(buffer, "OK"))
diff -aur gnokii/common/phones/nk6510.c 
gnokii-0.6.21-CVS20071121/common/phones/nk6510.c
--- gnokii/common/phones/nk6510.c       2007-11-10 21:00:59.000000000 +0200
+++ gnokii-0.6.21-CVS20071121/common/phones/nk6510.c    2007-11-21 
23:02:13.000000000 +0200
@@ -259,7 +259,7 @@
        case GN_OP_Init:
                return NK6510_Initialise(state);
        case GN_OP_Terminate:
-               FREE(DRVINSTANCE(state));
+//             FREE(DRVINSTANCE(state));
                return pgen_terminate(data, state);
        case GN_OP_GetModel:
                return NK6510_GetModel(data, state);

reply via email to

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