Re: writephonebook fix + MyX-2 support

Daniele Forsi <[email protected]>
Newsgroups gmane.linux.drivers.gnokii
Message-ID <CAN_we7O2QHBDPBR7onHdGBML-KjSoSk6oxDDk6Q74MqsL9QodA@mail.gmail.com>
Hello Raphaël,

> when using --writephonebook, both vCard and ldif parsers returns at the
> end of file (as every file has an end), but the return value is treated
> as GN_ERR_WRONGDATAFORMAT by writephonebook().

yes, that's a long standing bug

thanks for your patch however I think that gmail is messing with it
because git fails to apply it (so I used patch):
$ git am writephonebook-eof.patch
Patch format detection failed.
$

there are two problems:
the first is that now error checking is too liberal and it doesn't
detect broken files such as a file with only "BEGIN:VCARD"

can you check if this gives error for you?
echo "BEGIN:VCARD" | LANG=C gnokii/gnokii --phone fake --writephonebook -vo

I get:
Connecting
strings[0] = BEGIN:VCARD
AT+CPBW=1,"",129,""
Write Succeeded: memory type: ME, loc: 1, name: , number:

also I wouldn't apply it as is because you are changing the coding
style (see Docs/CodingStyle)
for example here:
> +			if(parser_ret_val < 0) error = GN_ERR_WRONGDATAFORMAT;
> +			else if(parser_ret_val == 1) goto out; // no more entry


> Side note: I got useful working features with the good old Sagem MyX-2
> (no-slider model = no breakage).
> Tips are documented here [1] though nothing really new as this model
> was already supported by gammu.
> But media AT commands (of limited use in these models) seem
> proprietary and WAP has not been tested.
>
>
> Unrelated question: is there any existing plan to enhance the
> "find-free" option of writephonebook ?

I think nobody complained yet loudly

> It's a pain to use as it starts the location counter back to 2 for each
> entry. So in the best case `--writephonebook -f` ends up testing 85!
> (factorial) locations in order store 85 entries.

you are right, I think that the "if (find_free)" block should was
supposed to be outside of the "while (!feof(stdin))" loop and it
should use default_location as a starting point

I can't work on this today, feel free to look at it if you have time
and thank you for your help
-- 
Daniele Forsi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.