Hello community, here is the log from the commit of package gigaset-frontend for openSUSE:Factory checked in at 2015-01-29 09:56:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gigaset-frontend (Old) and /work/SRC/openSUSE:Factory/.gigaset-frontend.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gigaset-frontend" Changes: -------- --- /work/SRC/openSUSE:Factory/gigaset-frontend/gigaset-frontend.changes 2011-09-23 01:59:43.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.gigaset-frontend.new/gigaset-frontend.changes 2015-01-29 09:56:23.000000000 +0100 @@ -1,0 +2,14 @@ +Wed Jan 14 22:55:02 UTC 2015 - [email protected] + +- Update to version 0.7.1 + + build improvements +- Changes from version 0.7.0 + + phonebook function improvements + + documentation improvements + + add gigaconf and gigacontr --version option +- Remove redundant %clean section +- Specfile cleanup +- Remove gigaset-frontend-fix_uninitialized.patch; merged on upstream + release + +------------------------------------------------------------------- Old: ---- gigaset-frontend-0.6.0.tar.gz gigaset-frontend-fix_uninitialized.patch New: ---- gigaset-frontend-0.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gigaset-frontend.spec ++++++ --- /var/tmp/diff_new_pack.gn4aJL/_old 2015-01-29 09:56:24.000000000 +0100 +++ /var/tmp/diff_new_pack.gn4aJL/_new 2015-01-29 09:56:24.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package gigaset-frontend # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,27 +18,22 @@ Name: gigaset-frontend -Version: 0.6.0 -Release: 1 +Version: 0.7.1 +Release: 0 Summary: Siemens Gigaset configuration software Source: http://prdownloads.sourceforge.net/gigaset307x/gigaset-frontend-%{version}.tar.gz Source1: gigaset-frontend.desktop Patch1: gigaset-frontend-optflags.patch -Patch2: gigaset-frontend-fix_uninitialized.patch Source99: gigaset-frontend-rpmlintrc Url: http://gigaset307x.sourceforge.net/frontend.html Group: Hardware/ISDN License: GPL-2.0 BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} == 0 -BuildRequires: kernel-source -%else %if 0%{?suse_version} > 1120 BuildRequires: linux-glibc-devel %else BuildRequires: linux-kernel-headers -%endif #1120 -%endif #0 +%endif BuildRequires: libqt4-devel BuildRequires: libexpat-devel BuildRequires: gcc gcc-c++ glibc-devel make pkgconfig @@ -49,8 +44,6 @@ ISDN devices. %package qt - - Summary: Siemens Gigaset configuration software (GUI) Group: Hardware/ISDN @@ -61,7 +54,6 @@ %prep %setup -q %patch1 -%patch2 %build # not autotools: @@ -112,9 +104,6 @@ %__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop" %suse_update_desktop_file -r "%{name}" Settings HardwareSettings -%clean -%{?buildroot:%__rm -rf "%{buildroot}"} - %files %defattr(-,root,root) %doc COPYING README TODO Release.notes known_bugs.txt ++++++ gigaset-frontend-0.6.0.tar.gz -> gigaset-frontend-0.7.1.tar.gz ++++++ ++++ 1622 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/Makefile new/gigaset-frontend-0.7.1/Makefile --- old/gigaset-frontend-0.6.0/Makefile 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/Makefile 2013-05-12 23:19:53.000000000 +0200 @@ -14,7 +14,7 @@ # default: "PREFIX/man" PACKAGE = gigaset-frontend -VERSION = 0.6.0 +VERSION = 0.7.1 export VERSION distdir = $(PACKAGE)-$(VERSION) @@ -29,6 +29,8 @@ -include Makefile.config +export QTDIR + ifndef PREFIX PREFIX := /usr/local endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/README new/gigaset-frontend-0.7.1/README --- old/gigaset-frontend-0.6.0/README 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/README 2013-05-12 23:19:53.000000000 +0200 @@ -1,9 +1,9 @@ -Front-end for GigaSet 307x Device Driver (Version 0.6.0) +Front-end for GigaSet 307x Device Driver (Version 0.7.1) ======================================================== 0. Warning ------- - The front-end utilities gigacontr, qgigaset and gigaconf are still very + The front-end utilities gigacontr, qgigaset and gigaconf are still experimental. Use at your own risk. @@ -14,10 +14,10 @@ installed before building the front-ends. The front-end tool "gigaconf" requires the "expat" XML parser library - (Version 1.x). For (open)SUSE 9.x and later, the necessary package - "expat" is part of the default selection, but you may still want to - check it is there. For Debian, do an "apt-get install libexpat1-dev". - The front-end tool "qgigaset" requires Qt4. + (Version 1.x). For openSUSE, the necessary package "expat" is part of + the default selection, but you may still want to check it is there. + For Debian, do an "apt-get install libexpat1-dev". The front-end tool + "qgigaset" requires Qt4. You can only use these programs when the kernel modules are loaded and the device nodes have been created (see README of the driver). @@ -30,17 +30,23 @@ 2.1. Binary packages (rpm) --------------------- - We provide rpms for some distributions (currently SuSE; if you want to - provide packages for your distribution, please let us know). You can + We provide rpms for some distributions (currently openSUSE; if you want + to provide packages for your distribution, please let us know). You can install them using rpm -i gigaset-frontend-<version>.rpm or with some graphical front-end. - If the installation fails because libexpat.so.0 is missing (notably on - SuSE 10.1) you can add the option "--nodeps" to the rpm command: + If the installation fails because libexpat.so.0 is missing you can add + the option "--nodeps" to the rpm command: rpm -i --nodeps gigaset-frontend-<version>.rpm You won't be able to run "gigaconf", but "gigacontr" will work fine. + The command line utilities gigacontr and gigaconf are installed as + system utilities in the system binary directory /usr/sbin. You can run + them as a non-root user if that user has write permission on the + Gigaset device file /dev/ttyG*. On openSUSE this can be achieved by + granting that user membership in the "dialout" group. + 2.2. Build rpm packages from source rpms ----------------------------------- If you didn't find a binary rpm matching your system, or for some other @@ -94,7 +100,7 @@ tar -xjvf gigaset-frontend-VERSION.tar.bz2 will create a directory gigaset-frontend-VERSION containing the sources - (VERSION is currently 0.6.0). + (VERSION is currently 0.7.1). After changing to this directory with cd gigaset-frontend-VERSION @@ -121,10 +127,9 @@ --without-qt don't build qgigaset (default) --with-debug - build debug version of qgigaset (default, requires installed Qt4 - debug libraries) + build debug version of qgigaset (requires Qt4 debug libraries) --without-debug - build release version (use if Qt4 debug libraries aren't installed) + build release version (default) --with-qtlibs build and install private Qt4 libraries (not yet implemented) --without-qtlibs @@ -213,10 +218,10 @@ 5. Feedback -------- - If you can't solve problems with the programs on your own, feel free to - use one of the forums, bug trackers, or mailing lists on + If you encounter a problem with the programs you can't solve on your own, + feel free to use one of the forums, bug trackers, or mailing lists on http://sourceforge.net/projects/gigaset307x - or write an electronic mail to <[email protected]>. + or write a mail to <[email protected]>. Try to provide as much information as possible, such as - distribution @@ -238,13 +243,16 @@ Things that work reasonably well at this stage: - reading out the call journal (log) of the base + - uploading and downloading phonebooks to/from the handsets + - dialing a call for a handset from the PC - registering M101 and M105 to a base - basic parameter queries (device type, firmware version ...) Things that are unfinished but harmless: - sending and receiving SMS messages (but watch your phone bill ...) - downloading and uploading answering machine messages (not much use - as you can neither listen to them nor record new ones on the PC) + as you can neither listen to them nor record new ones on the PC, + due to the undocumented codec) Things that could be dangerous: - fiddling with the configuration values of the base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/Release.notes new/gigaset-frontend-0.7.1/Release.notes --- old/gigaset-frontend-0.6.0/Release.notes 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/Release.notes 2013-05-12 23:19:53.000000000 +0200 @@ -8,6 +8,16 @@ uw - Uwe Wendt +2013-05-12 + 0.7.1 + - build improvements + +2013-05-08 + 0.7.0 + - phonebook function improvements + - documentation improvements + - add gigaconf and gigacontr --version option + 2011-02-06 0.6.0 - move development repository from CVS to git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/TODO new/gigaset-frontend-0.7.1/TODO --- old/gigaset-frontend-0.6.0/TODO 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/TODO 2013-05-12 23:19:53.000000000 +0200 @@ -4,6 +4,7 @@ -> fix SMS chaining problem (differing timestamps?) -> win32: fix configuration mode for M105 -> move from sbin / man8 to bin / man1 + -> add device ID 10 (SX353 built-in phone) where necessary (docs, range checks) lib: gigaconf: -> solve expat problem @@ -13,7 +14,6 @@ gigacontr: -> log dump for firmware 1.x -> config-values: names for pids - -> phonebook: set supp.data (melody, alarm) -> sms: UCS2 -> sms: encoding: better error messages -> mregister: check timeout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/console/Makefile new/gigaset-frontend-0.7.1/console/Makefile --- old/gigaset-frontend-0.6.0/console/Makefile 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/console/Makefile 2013-05-12 23:19:53.000000000 +0200 @@ -30,6 +30,12 @@ endif +ifdef VERSION +CFLAGS += -DVERSION=$(VERSION) +else +CFLAGS += -DVERSION=unknown +endif + all: $(ALL) ifdef MINGW diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/console/gigaconf.8 new/gigaset-frontend-0.7.1/console/gigaconf.8 --- old/gigaset-frontend-0.6.0/console/gigaconf.8 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/console/gigaconf.8 2013-05-12 23:19:53.000000000 +0200 @@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -t -Tascii gigaconf.8 .\" -.TH gigaconf 8 "2005\-11\-06" gigaset\-0.5.0 "Linux System Administration" +.TH gigaconf 8 "2013\-05\-12" gigaset\-0.7.1 "Linux System Administration" .SH NAME gigaconf \- Gigaset base configuration .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/console/gigaconf.c new/gigaset-frontend-0.7.1/console/gigaconf.c --- old/gigaset-frontend-0.6.0/console/gigaconf.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/console/gigaconf.c 2013-05-12 23:19:53.000000000 +0200 @@ -29,6 +29,9 @@ #define BUFFSIZE 8192 #define MAXKEYS 4 +#define stringify(x) str(x) +#define str(x) #x + /* XML attribute names */ const char *attrtab[] = { "id", @@ -616,13 +619,14 @@ } /* command line options */ -const char *optstring = "hvqd:e:o:x:"; +const char *optstring = "hVvqd:e:o:x:"; const struct option longopts[] = { { "help", no_argument, NULL, 'h' }, { "device", required_argument, NULL, 'd' }, { "extension", required_argument, NULL, 'e' }, { "output", required_argument, NULL, 'o' }, { "homerpar", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'V' }, { "verbose", no_argument, NULL, 'v' }, { "quiet", no_argument, NULL, 'q' }, { NULL, 0, NULL, 0 } @@ -645,6 +649,7 @@ "\n -x, --homerpar=<file> set location of homerpar.xml file" "\n (default: %s)" "\n -h, --help show this message" + "\n -V, --version show version number" "\n -v, --verbose show more details about operations" "\n -q, --quiet show less details about operations" "\n\n", @@ -794,6 +799,12 @@ else gl.verb = 0; break; + case 'V': /* version */ + fprintf(stderr, + "%s: gigaset-frontend release " stringify(VERSION) "\n" + "Copyright (C) 2011 Tilman Schmidt\n", + argv[0]); + exit(0); case 'h': /* help */ usage(argv[0]); exit(0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/console/gigacontr.8 new/gigaset-frontend-0.7.1/console/gigacontr.8 --- old/gigaset-frontend-0.6.0/console/gigacontr.8 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/console/gigacontr.8 2013-05-12 23:19:53.000000000 +0200 @@ -1,7 +1,7 @@ .\" Process this file with .\" groff -man -t -Tascii gigacontr.8 .\" -.TH gigacontr 8 "2011\-02\-06" gigaset\-frontend\-0.6.0 "Linux System Administration" +.TH gigacontr 8 "2013\-05\-12" gigaset\-frontend\-0.7.1 "Linux System Administration" .SH NAME gigacontr \- access to the Gigaset devices and drivers .SH SYNOPSIS @@ -370,7 +370,8 @@ .B This might be changed to utf\-8. .IP "\-\-pbdump \fIid\fR \fImode\fR" Receive phonebook entries from handset -.IR id . +.I id +and dump them to the standard output. .br If .I mode @@ -391,23 +392,32 @@ .BR 0 , the command uses "new mode" for handsets which support it, and "old mode" for all others. -.IP "\-\-pbent \fIname\fR \fInumber\fR \fIid\fR" -Send phonebook entry to handset -.IR id . .IP "\-\-pbfile \fIfile\fR \fIid\fR" Send phonebook entries from .I file (`\-' means standard input) to handset .IR id . - -File format: -.I name -.B tab -.I number -.B newline ... +.IP "\-\-pbent \fIname\fR \fInumber\fR \fIid\fR" +Send a single phonebook entry to handset +.IR id . .IP "\-\-pbdel \fIid\fR" Delete all phonebook entries from handset .IR id . +.PP +The data format for the \-\-pbfile and \-\-pbdump commands is +one line per entry, with fields separated by tab characters. +The fields are, in order: +.IR name , +.IR number , +.I melody +(0..10), +.I alert +flag (0 or 1), +.I time +(hh:mm), +.I date +(yy\-mm\-dd). +Unused fields may be omitted. .SS CONFIGURATION .B Warning: Using wrong parameter ids and data types can cause serious problems. .IP "\-\-cfgread \fIpid\fR \fIid\fR \fItype\fR" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/console/gigacontr.c new/gigaset-frontend-0.7.1/console/gigacontr.c --- old/gigaset-frontend-0.6.0/console/gigacontr.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/console/gigacontr.c 2013-05-12 23:19:53.000000000 +0200 @@ -33,6 +33,11 @@ #include <gigaset/m10x.h> #include <gigaset/log.h> +#define stringify(x) str(x) +#define str(x) #x + +#define MAXLINE 256 +#define MAXFIELDS 6 #define CF_OPEN 0x0001 #define CF_LOCK 0x0002 @@ -135,7 +140,6 @@ { struct glog gl; struct gstatus *gs; /* NULL while !(cs.pflags & CF_OPEN) */ - //const char * procpath; const char * interface; unsigned pflags; int abort; @@ -154,7 +158,6 @@ struct gigaset_sm * messages; struct gigaset_sm_chain * send_chain; struct gigaset_sm * send_messages; - //int havelist; /* at most one of these can be selected */ struct gigaset_sm_chain * selected_chain; @@ -520,25 +523,11 @@ set_error_num_msg(cs, -ERR_PARAMINVALID, 0, argv[0]); } -#if 0 -static void cmd_nodev(struct contr_state*cs, char**argv, unsigned long data) -{ - cs->interface=NULL; -} -#endif - static void cmd_dev(struct contr_state*cs, char**argv, unsigned long data) { cs->interface=argv[0]; } -#if 0 -static void cmd_path(struct contr_state*cs, char**argv, unsigned long data) -{ - cs->procpath=argv[0]; -} -#endif - static void cmd_mreset(struct contr_state*cs, char**argv, unsigned long data) { int r; @@ -684,6 +673,7 @@ set_error_msg(cs, r, "setting auto release timer"); } +/* process a file of phonebook entries */ static void cmd_pbfile(struct contr_state *cs, char **argv, unsigned long data) { FILE *f; @@ -691,6 +681,8 @@ char *s; char *buf = NULL; size_t n; + char *field[MAXFIELDS]; + int nfields; gigaset_log(&cs->gl, GLOG_APPDBG, "PBFILE %s %s\n", argv[0], argv[1]); if (!strcmp(argv[0],"-")) @@ -704,12 +696,13 @@ } for(;;) { - buf=malloc(256); + /* read next line */ + buf = malloc(MAXLINE); if (!buf) { set_error_num_msg(cs, -ERR_MEM, 0, "reading phonebook file"); break; } - if (!fgets(buf,256,f)) { /* we cannot handle long lines... */ + if (!fgets(buf, MAXLINE, f)) { /* EOF or error */ if (ferror(f)) set_error_num_msg(cs, -ERR_FILEREAD, errno, argv[0]); @@ -717,33 +710,119 @@ } n=strlen(buf); if (!n||buf[n-1]!='\n') { - gigaset_log(&cs->gl, GLOG_APPERR, "line does not end in newline!\n"); + gigaset_log(&cs->gl, GLOG_APPERR, "line too long or missing newline!\n"); set_error_num(cs, -ERR_DATA, 0); break; } buf[n-1]='\0'; - s=memchr(buf,(unsigned char)'\t',n); - if(!s) { + + /* split on tabs */ + for (s = buf, nfields = 1; nfields <= MAXFIELDS; nfields++) { + field[nfields-1]=s; + s=strchr(s,'\t'); + if (!s) break; + *s++='\0'; + } + + if (nfields < 2) { gigaset_log(&cs->gl, GLOG_APPERR, "tab not found!\n"); set_error_num(cs, -ERR_DATA, 0); break; } - *s='\0'; - while(*++s=='\t'); - pbcur = malloc (sizeof *pbcur); + /* build entry */ + pbcur = calloc(1, sizeof *pbcur); if (!pbcur) { set_error_num_msg(cs, -ERR_MEM, 0, "reading phonebook file"); break; } + pbcur->name = field[0]; + pbcur->number = field[1]; + if (nfields >= 3) { + pbcur->melody = strtol(field[2], &s, 10); + if (*s || pbcur->melody < 0 || pbcur->melody > 10) { + gigaset_log(&cs->gl, GLOG_APPERR, "bad melody number %s!\n", field[2]); + set_error_num(cs, -ERR_DATA, 0); + break; + } + } else { + pbcur->melody = -1; + } + if (nfields >= 6) { + pbcur->alert = strtol(field[3], &s, 10); + if (*s || pbcur->alert < 0 || pbcur->alert > 1) { + gigaset_log(&cs->gl, GLOG_APPERR, "bad alert flag %s!\n", field[3]); + set_error_num(cs, -ERR_DATA, 0); + break; + } + pbcur->hour = strtol(field[4], &s, 10); + if (!*s) { + /* hhmm */ + pbcur->minute = pbcur->hour % 100; + pbcur->hour /= 100; + } else if (*s++ == ':') { + /* hh:mm */ + pbcur->minute = strtol(s, &s, 10); + } + if (*s || pbcur->hour < 0 || pbcur->hour > 23 || pbcur->minute < 0 || pbcur->minute > 59) { + gigaset_log(&cs->gl, GLOG_APPERR, "bad alert time %s!\n", field[4]); + set_error_num(cs, -ERR_DATA, 0); + break; + } + + pbcur->year = strtol(field[5], &s, 10); + switch (*s) { + case '\0': + /* [yy]mmdd */ + pbcur->day = pbcur->year % 100; + pbcur->year /= 100; + pbcur->month = pbcur->year % 100; + pbcur->year /= 100; + break; + case '-': + s++; + pbcur->month = strtol(s, &s, 10); + if (!*s) { + /* mm-dd */ + pbcur->day = pbcur->month; + pbcur->month = pbcur->year; + pbcur->year = 0; + } else if (*s++ == '-') + /* yy-mm-dd */ + pbcur->day = strtol(s, &s, 10); + break; + case '.': + /* dd.mm.[yy] */ + pbcur->day = pbcur->year; + s++; + pbcur->month = strtol(s, &s, 10); + if (!*s) + pbcur->year = 0; + else if (*s++ == '.') + pbcur->year = strtol(s, &s, 10); + } + if (*s || pbcur->year < 0 || pbcur->year > 99 || pbcur->month < 1 || pbcur->month > 12 || pbcur->day < 1 || pbcur->day > 31) { + gigaset_log(&cs->gl, GLOG_APPERR, "bad alert date %s!\n", field[5]); + set_error_num(cs, -ERR_DATA, 0); + break; + } + if (nfields > 6) { + gigaset_log(&cs->gl, GLOG_WARN, "%d extra fields ignored!\n", nfields-6); + } + } else { + pbcur->alert = -1; + if (nfields > 3) { + gigaset_log(&cs->gl, GLOG_WARN, "incomplete alert (%d fields) ignored!\n", nfields-3); + } + } + + /* put onto chain */ if (cs->pblast) cs->pblast->next=pbcur; else cs->pbfirst=pbcur; cs->pblast=pbcur; pbcur->next=NULL; - pbcur->name=buf; - pbcur->number=s; pbcur->pnr=argv[1]; pbcur->buffer=buf; buf=NULL; @@ -752,6 +831,7 @@ free(buf); } +/* queue one phonebook entry for transmission to handset */ static void cmd_pbent(struct contr_state *cs, char **argv, unsigned long data) { struct gphonebook *pbcur; @@ -1541,35 +1621,6 @@ } } -#if 0 -static void cmd_testfile(struct contr_state*cs, char**argv, unsigned long data) -{ - FILE *f; - ssize_t s; - char *buf; - int from_stdin; - - f = open_file(argv[0], "rb", &from_stdin, stdin); - if (f == NULL) { - set_error_num_msg(cs, -ERR_FILEOPEN, errno, NULL); - return; - } - - s = read_file(f, &buf); - if (s < 0) { - set_error_num_msg(cs, s, errno, NULL); - close_file(f, from_stdin); - return; - } - - close_file(f, from_stdin); - - fwrite(buf, 1, s, stdout); - - free(buf); -} -#endif - static void cmd_amput(struct contr_state*cs, char**argv, unsigned long data) { FILE *f; @@ -1796,52 +1847,7 @@ return -1; } } -#if 0 -static int * fwver (struct gstatus * gs) -{ - static int ver[4]={-1}; - char * s, * p, * buf; - int r, i; - - if(ver[0]>=0) return ver; - - r=gigaset_version(gs,&buf); - if (r<0) - { - ver[0]=-2; - return ver; - } - - s=buf; - for (i=0;i<3;++i) - { - p=strchr(s,'.'); - if (!p) goto error; - *p=0; - if ((ver[i]=tointext(s,0,INT_MAX,-1,10))<0) goto error; - s=p+1; - } - if ((ver[3]=tointext(s,0,INT_MAX,-1,10))<0) goto error; - free(buf); - return ver; - -error: - ver[0]=-2; - free(buf); - return ver; -} -#endif -#if 0 - ssize_t l; - size_t pos,n; - const char * path; - unsigned long handle, flags; - int32_t num; - unsigned u; - int datatype; - int newstyle; -#endif static void cmd_cfgread(struct contr_state *cs, char **argv, unsigned long data) { unsigned id; @@ -2274,6 +2280,13 @@ } } +static void cmd_progversion(struct contr_state *cs, char **argv, unsigned long data) +{ + fprintf(stderr, + "gigacontr: gigaset-frontend release " stringify(VERSION) "\n" + "Copyright (C) 2011 Tilman Schmidt\n"); +} + static struct cmd_def commands[]; static void cmd_usage(struct contr_state *cs, char **argv, unsigned long data) @@ -2399,6 +2412,8 @@ {{"--help","-h","-?"}, 0, PF_OVERWRITE|PF_ABORT, 0,0, cmd_help, 0, NULL, "show this usage message"}, {{"--usage"}, 0, PF_OVERWRITE|PF_ABORT, 0,0, cmd_usage, 0}, + {{"--version","-V"}, 0, PF_OVERWRITE|PF_ABORT, 0,0, cmd_progversion, 0, NULL, + "show program version"}, {{"-q","--quiet"}, 0, 0, CF_ANY, 0, cmd_verbosity, 0, NULL, "supress error messages"}, {{"--show-errors"}, 0, 0, CF_ANY, 0, cmd_verbosity, 1, NULL, @@ -2409,7 +2424,6 @@ "show debug messages"}, {{"--dev"}, 1, 0, 0, 0, cmd_dev, 0, "FILE", "use the given device node"}, -// {{"--nodev"}, 0, 0, 0, 0, cmd_nodev}, {{"--mode"}, 1, PF_LAST, CF_ANY, 0, cmd_mode, 0, "MODE", "set operation mode"}, {{"--sleep"}, 1, 0, CF_ANY, 0, cmd_sleep, 0, "SECONDS", @@ -2456,8 +2470,6 @@ "list all audio messages in phone memory"}, {{"--amget"}, 2, 0, CF_AB, CF_AB, cmd_amget, 0, "ID FILE", "archive message in file"}, -// {{"--testfile"}, 1, 0, CF_ANY, 0, cmd_testfile, 0, "FILE", -// "copy file to stdout"}, {{"--amput"}, 1, 0, CF_AB, CF_AB, cmd_amput, 0, "FILE", "transfer message from file to phone memory"}, {{"--amdel"}, 1, 0, CF_AB, CF_AB, cmd_amdel, 0, "ID", @@ -2648,83 +2660,7 @@ return *interface; } -#if 0 -static char * get_procpath (const char ** path, const char ** interface, const char * name) -{ - static const char * const list[] = {"/proc/driver/ser_gigaset","/proc/driver/bas_gigaset","/proc/driver/usb_gigaset", "/proc/driver/gigaset_hw",NULL}; - - struct stat buf; - const char * const * p; /* <- funny syntax. hl just found out, that it works ;)*/ - char * result; - size_t l1,l2; - - if (!path||!interface) - { - gigaset_log(&cs->gl, GLOG_APPERR, "get_procpath: path==NULL or interface==NULL\n"); - return NULL; - } - if (!*path) /* search only if not found/set before*/ - { - for (p=list;*p;++p) - if(stat(*p, &buf)==0) - break; /* found => abort loop;*/ - if (!*p) return NULL; - *path = *p; - } - if (!*interface) - { - if (stat("/dev/ttyG",&buf)==0) - *interface="/dev/ttyG"; - else - *interface=NULL; - } - - l1=strlen(*path); - if (name) - { - if (!strcmp(name,"interface")&&*interface) - { - l1=strlen(*interface); - result=malloc(l1+1); - if (result) memcpy(result,*interface,l1+1); /* copy _with_ zero-byte*/ - } - else - { - l2=strlen(name); - result=malloc(l1+1+l2+1); - if (result) - { - memcpy(result,*path,l1); - result[l1]='/'; - memcpy(result+l1+1,name,l2+1); /* copy _with_ zero-byte*/ - } - } - } - else - { - result=malloc(l1+1); - if (result) memcpy(result,*path,l1+1); /* copy _with_ zero-byte*/ - } - return result; -} -#endif - -#if 0 -static int get_procfile (const char *path) -{ - FILE *fp; - char readbuffer[512]; - - fp=fopen(path, "r"); - if (!fp) return -1; - while (fgets(readbuffer, sizeof readbuffer, fp)) - fputs(readbuffer, stdout); - if (ferror(fp)) return -1; - if (fclose(fp)) return -1; - return 0; -} -#endif - +/* clear a state flag, processing queued operations for that state */ static int clearflag (struct contr_state * cs, unsigned flag) { struct gphonebook * pbcur; @@ -2999,7 +2935,6 @@ static int keepflag (struct contr_state * cs, unsigned flag) { int r;//FIXME - //ssize_t ss; switch (flag) { @@ -3121,7 +3056,6 @@ cs.gs = NULL; cs.abort=0; cs.pflags=0; - //cs.procpath=NULL; cs.interface=NULL; cs.pbfirst=cs.pblast=NULL; //cs.list=NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/frontend.spec new/gigaset-frontend-0.7.1/frontend.spec --- old/gigaset-frontend-0.6.0/frontend.spec 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/frontend.spec 2013-05-12 23:19:53.000000000 +0200 @@ -1,54 +1,59 @@ -Version: 0.6.0 -Release: 1 +Name: gigaset-frontend +Version: 0.7.1 +Release: 1 +Summary: Gigaset configuration software +Source: http://prdownloads.sourceforge.net/gigaset307x/gigaset-frontend-%{version}.tar.gz +URL: http://gigaset307x.sourceforge.net/frontend.html +Group: Hardware/ISDN +License: GPL-2.0 +BuildRoot: %{_tmppath}/%{name}-%{version}-build +Provides: %{name} = %{version}-%{release} %{?ccomp: %{expand: %%define cc_option CC=%ccomp}} %{!?_with_qt: %{!?_without_qt: %define _without_qt --without-qt}} %{!?_with_qtlibs: %{!?_without_qtlibs: %define _without_qtlibs --without-qtlibs}} -%{!?_with_debug: %{!?_without_debug: %define _with_debug --with-debug}} +%{!?_with_debug: %{!?_without_debug: %define _without_debug --without-debug}} %{!?_with_expat: %{!?_without_expat: %define _with_expat --with-expat}} -Summary : Siemens Gigaset configuration software -Name : gigaset-frontend -Vendor : gigaset307x -Source0 : http://telia.dl.sourceforge.net/sourceforge/gigaset307x/gigaset-frontend-%{version}.tar.gz -Buildroot : %{_tmppath}/%{name}-root -License : GPL -Group : System Environment/Kernel -Provides : %{name} = %{version}-%{release} - -#Removed because of the differences among the distributions: -#Requires : kernel = %{kernel_version} - -URL : http://gigaset307x.sourceforge.net/ - %description -This package contains user space configuration programs for Siemens Gigaset ISDN devices. +This package contains user space programs for configuring and controlling +Gigaset ISDN devices. %package qt -Summary : Siemens Gigaset configuration software (GUI) -Group : System Environment/Kernel + +Summary: Gigaset configuration software (GUI) +Group: Hardware/ISDN + %description qt -This package contains qgigaset, a graphical user space configuration program for Siemens Gigaset ISDN devices. +This package contains qgigaset, a graphical user space program for +configuring and controlling Gigaset ISDN devices. %package qt-lib -Summary : Qt4 libs for qgigaset -Group : System Environment/Kernel + +Summary: Qt4 libs for qgigaset +Group: Hardware/ISDN + %description qt-lib -This package contains Qt4 libs for qgigaset, a graphical user space configuration program for Siemens Gigaset ISDN devices. +This package contains Qt4 libs for qgigaset, a graphical user space program for +configuring and controlling Gigaset ISDN devices. %prep -[ %{buildroot} != / ] && [ -d %{buildroot} ] && rm -rf %{buildroot} %setup -./configure --destdir=%{buildroot} --mandir=%{_mandir} --prefix=%{_prefix} --libdir=%{_libdir} --datadir=%{_datadir} \ + +%build +./configure \ + --destdir=%{buildroot} \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --datadir=%{_datadir} \ + %{?_with_expat} %{?_without_expat} \ %{?_with_debug} %{?_without_debug} \ %{?_with_qt} %{?_without_qt} \ %{?_with_qtlibs} %{?_without_qtlibs} - -%build make %{?cc_option} %install -[ %{buildroot} != / ] && [ -d %{buildroot} ] && rm -rf %{buildroot} make %{?cc_option} install %clean @@ -80,6 +85,14 @@ ldconfig %changelog +* Sun May 12 2013 Tilman Schmidt <[email protected]> +- version 0.7.1 +- partially adapt formatting to openSUSE +- default to --without debug + +* Wed May 08 2013 Tilman Schmidt <[email protected]> +- version 0.7.0 + * Sat Feb 06 2011 Tilman Schmidt <[email protected]> - version 0.6.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/known_bugs.txt new/gigaset-frontend-0.7.1/known_bugs.txt --- old/gigaset-frontend-0.6.0/known_bugs.txt 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/known_bugs.txt 2013-05-12 23:19:53.000000000 +0200 @@ -4,7 +4,7 @@ The following bugs are known and need not be reported again. Fixes are of course always welcome! :) -V 0.6.0 (unfixed) +V 0.7.1 (unfixed) ------- - The gigacontr commands --smslist, --smsdump and --smsdumpext for @@ -25,9 +25,18 @@ specified message does not exist, because of an "unusual" response of the device. -- gigacontr: An answering machine command after --amput does not - work at the moment. The device does not work as described in the - specs. +- gigacontr: An answering machine command after --amput currently does + not work. The device does not behave as described in the specs. + + +V 0.7.0 (fixed in V 0.7.1) +------- + +- Compiling qgigaset without QTDIR set fails if Qt doesn't happen to + be installed in /bin (ie. QTDIR=/). + +- Compiling qgigaset assumes debug build by default, failing if Qt + debug libraries are not installed. V 0.5.3 (fixed in V 0.6) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/basemisc.c new/gigaset-frontend-0.7.1/lib/basemisc.c --- old/gigaset-frontend-0.6.0/lib/basemisc.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/basemisc.c 2013-05-12 23:19:53.000000000 +0200 @@ -36,7 +36,10 @@ r=gigaset_expectresponse(gs, "OK", 2+1, NULL, 30); if (r<0) return r; r=gigaset_expectresponse(gs, rsp, l, buf, 30); - if (r<0) return r; + if (r<0) { + free(*buf); + return r; + } memmove(*buf,*buf+l,strlen(*buf)-l+1); return 0; } @@ -176,8 +179,10 @@ if (r < 0) goto APD0; r = gigaset_expectresponse(gs, "ZGACI=", 6, &buf, 30); - if (r < 0) + if (r < 0) { + free(buf); goto APD0; + } errno = 0; cid = strtoul(buf+6, &end, 10); @@ -231,15 +236,19 @@ gs->may_interrupt = 1; r = gigaset_expectcidresponse(gs, "ZSAU=", 5, cid, &buf, GIG_INFTY); gs->may_interrupt = 0; - if (r < 0) + if (r < 0) { + free(buf); goto rmcid; + } if (!strcmp(buf, "ZSAU=CALL_DELIVERED")) { free(buf); gs->may_interrupt = 1; r = gigaset_expectcidresponse(gs, "ZSAU=", 5, cid, &buf, GIG_INFTY); gs->may_interrupt = 0; - if (r < 0) + if (r < 0) { + free(buf); goto rmcid; + } } if (strcmp(buf, "ZSAU=ACTIVE")) { //FIXME return codes for local hup, remote hup, success, error? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/block.c new/gigaset-frontend-0.7.1/lib/block.c --- old/gigaset-frontend-0.6.0/lib/block.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/block.c 2013-05-12 23:19:53.000000000 +0200 @@ -216,12 +216,14 @@ r = gigaset_expectresponse(gs, "ZBDAT=", 6, &s, tout); tout=30; /* 1s is not enough, although suggested by the specs */ - if (r == -FILTER_ZBABORT) { - doabort = 0; - r = -ERR_ABORT; + if (r<0) { + if (r == -FILTER_ZBABORT) { + doabort = 0; + r = -ERR_ABORT; + } + free(s); break; } - if (r<0) break; r=gigaset_blockdecode (&curtype, &cursize, &curseq, &curdatatype, &curblock, s+6); free(s); @@ -313,10 +315,10 @@ char * s; int tout=50; // FIXME: initial timeout guessed int doabort=1; - uint32_t totsize; + uint32_t totsize = 0; char * curblock; - char * pos; - size_t cursize, bytesleft; + char * pos = 0; + size_t cursize, bytesleft = 0; uint8_t curseq, curtype, curdatatype; char * dest=NULL; int badblocks=0; @@ -334,12 +336,14 @@ gigaset_log(gs->gl, GLOG_DEBUG, " status: datatype==0x%02x/phase==%d/seq==%d\n", datatype,phase,seq); r = gigaset_expectresponse(gs, "ZBDAT=", 6, &s, tout); tout=30; /* 3 secs */ - if (r == -FILTER_ZBABORT) { - doabort = 0; - r = -ERR_ABORT; + if (r<0) { + if (r == -FILTER_ZBABORT) { + doabort = 0; + r = -ERR_ABORT; + } + free(s); break; } - if (r<0) break; gigaset_logstr (gs->gl, GLOG_DEBUG, " response: ", s); r=gigaset_blockdecode (&curtype, &cursize, &curseq, &curdatatype, &curblock, s+6); free(s); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/conf.c new/gigaset-frontend-0.7.1/lib/conf.c --- old/gigaset-frontend-0.6.0/lib/conf.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/conf.c 2013-05-12 23:19:53.000000000 +0200 @@ -146,8 +146,11 @@ //if (r<0) return r; r=gigaset_expectresponse(gs, "ZCFGR=", 6, &s, 30); - if (r==-FILTER_ZCFGERR) r=-ERR_ABORT; - if (r<0) goto exit; + if (r<0) { + if (r==-FILTER_ZCFGERR) r=-ERR_ABORT; + free(s); + goto exit; + } l=strlen(s+6)-4; fcs=gigaset_fromhex4(s+6+l); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/interf-private.h new/gigaset-frontend-0.7.1/lib/interf-private.h --- old/gigaset-frontend-0.6.0/lib/interf-private.h 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/interf-private.h 2013-05-12 23:19:53.000000000 +0200 @@ -102,8 +102,6 @@ int gigaset_sendcommand(struct gstatus *gs, const char *s); ssize_t gigaset_getresponse(struct gstatus *gs, char **p, int timeout); -ssize_t gigaset_getfilteredresponse(struct gstatus *gs, char **p, int timeout, - int cid, const char *str, size_t len, const char *prefix, size_t preflen); ssize_t gigaset_expectcidresponse(struct gstatus *gs, const char *s, size_t l, unsigned cid, char **p, int timeout); ssize_t gigaset_expectresponse(struct gstatus *gs, const char *s, size_t l, char **p, int timeout); ssize_t gigaset_expectconfigresponse(struct gstatus *gs, const char *s, size_t l, char **p, int timeout); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/interf.c new/gigaset-frontend-0.7.1/lib/interf.c --- old/gigaset-frontend-0.6.0/lib/interf.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/interf.c 2013-05-12 23:19:53.000000000 +0200 @@ -266,6 +266,7 @@ * gs status structure * p pointer to a pointer variable which will be set to a malloc'd * copy of the actually received response or NULL on return + * (may be NULL) * timeout maximum time to wait, in 1/10 sec. * cid if >0, only consider responses with this call ID * str expected normal response (NULL: only previously added filters) @@ -274,12 +275,10 @@ * preflen number of characters in prefix * Return value: * length of response (>0) if response specified in str received - * (*p points to response) * -(filter return value of response) if other expected response received - * (*p set to NULL) * error codes: -ERR_TIMEOUT, -ERR_SIGINT, -ERR_MEM, -ERR_READ */ -ssize_t gigaset_getfilteredresponse(struct gstatus *gs, char **p, int timeout, int cid, const char *str, size_t len, const char *prefix, size_t preflen) +static ssize_t gigaset_getfilteredresponse(struct gstatus *gs, char **p, int timeout, int cid, const char *str, size_t len, const char *prefix, size_t preflen) { struct resp_filter *tempfilter = NULL; int match; @@ -290,18 +289,20 @@ struct resp_buf *resp, *next; int r; + if (p) *p = NULL; + if (gs->locked != 1) return -ERR_LOCK; - if (!p) - return -ERR_PARAMINVALID; - *p = NULL; if (cid > CID_MAX) return -ERR_PARAMINVALID; if (str) { + gigaset_logstr(gs->gl, GLOG_DEBUG, "expecting: ", str); tempfilter = gigaset_addfilter(gs, FILTER_CURRENT, len, str, preflen, prefix); if (!tempfilter) return -ERR_MEM; } + else + gigaset_log(gs->gl, GLOG_DEBUG, "expecting response\n"); if (cid > 0) { cidptr = cidbuf + sizeof cidbuf; *--cidptr = 0; @@ -356,13 +357,17 @@ resp->len -= preflen + 2; memmove(resp->str, resp->str + preflen + 2, resp->len + 1); } - *p = resp->str; + gigaset_logstr(gs->gl, GLOG_DEBUG, "got: ", resp->str); retval = resp->len; - free_resp(gs, resp, 0); } else { + gigaset_log(gs->gl, GLOG_DEBUG, "matched: %d\n", match); retval = -match; - free_resp(gs, resp, 1); } + if (p) { + *p = resp->str; + free_resp(gs, resp, 0); + } else + free_resp(gs, resp, 1); exit: if (tempfilter) @@ -494,42 +499,15 @@ * timeout maximum time to wait, in 1/10 sec. * Return value: * length of response (>0) if response specified in s received - * (*p points to response) * -(filter return value of response) if other expected response received - * (*p set to NULL) * error codes: -ERR_TIMEOUT, -ERR_SIGINT, -ERR_MEM, -ERR_READ */ ssize_t gigaset_expectcidresponse(struct gstatus *gs, const char *s, size_t l, unsigned cid, char **p, int timeout) /* if p!=NULL => return string in *p, if response is found (retval>=0) */ { - ssize_t r; - char *b; - char **p2; - if (cid < 1 || cid > CID_MAX) return -ERR_PARAMINVALID; - - if (p) - p2 = p; - else - p2 = &b; - - if (s) - gigaset_logstr(gs->gl, GLOG_DEBUG, "expecting: ", s); - else - gigaset_log(gs->gl, GLOG_DEBUG, "expecting response\n"); - r = gigaset_getfilteredresponse(gs, p2, timeout, cid, s, l, NULL, 0); - if (r < 0) - return r; - - gigaset_logstr(gs->gl, GLOG_DEBUG, "got: ", *p2); - - if (!p) { - free(*p2); - *p2 = NULL; - } - - return r; + return gigaset_getfilteredresponse(gs, p, timeout, cid, s, l, NULL, 0); } /* read from device until the expected response or one of the previously added @@ -540,75 +518,40 @@ * l number of characters in s * p pointer to a pointer variable which will be set to a malloc'd * copy of the actually received response or NULL on return + * (may be NULL) * timeout maximum time to wait, in 1/10 sec. * Return value: * length of response (>0) if response specified in s received - * (*p points to response) * -(filter return value of response) if other expected response received - * (*p set to NULL) * error codes: -ERR_TIMEOUT, -ERR_SIGINT, -ERR_MEM, -ERR_READ */ ssize_t gigaset_expectresponse(struct gstatus *gs, const char *s, size_t l, char **p, int timeout) /* if p!=NULL => return string in *p, if response is found (retval>=0) */ { - ssize_t r; - char *b; - char **p2; - - if (p) - p2 = p; - else - p2 = &b; - - if (s) - gigaset_logstr(gs->gl, GLOG_DEBUG, "expecting: ", s); - else - gigaset_log(gs->gl, GLOG_DEBUG, "expecting response\n"); - r = gigaset_getfilteredresponse(gs, p2, timeout, -1, s, l, NULL, 0); - if (r < 0) - return r; - - gigaset_logstr(gs->gl, GLOG_DEBUG, "got: ", *p2); - - if (!p) { - free(*p2); - *p2 = NULL; - } - - return r; + return gigaset_getfilteredresponse(gs, p, timeout, -1, s, l, NULL, 0); } +/* read from device until the expected response or one of the previously added + * filter responses turns up in M10x configuration mode + * Parameters: + * gs status structure + * s expected response (may be NULL) + * l number of characters in s + * p pointer to a pointer variable which will be set to a malloc'd + * copy of the actually received response or NULL on return + * (may be NULL) + * timeout maximum time to wait, in 1/10 sec. + * Return value: + * length of response (>0) if response specified in s received + * -(filter return value of response) if other expected response received + * error codes: -ERR_TIMEOUT, -ERR_SIGINT, -ERR_MEM, -ERR_READ + */ ssize_t gigaset_expectconfigresponse(struct gstatus *gs, const char *s, size_t l, char **p, int timeout) /* if p!=NULL => return string in *p, if response is found (retval>=0) */ { - ssize_t r; - char *b; - char **p2; - if (gs->config != 1) return -1; - - if (p) - p2 = p; - else - p2 = &b; - - if (s) - gigaset_logstr(gs->gl, GLOG_DEBUG, "expecting: ", s); - else - gigaset_log(gs->gl, GLOG_DEBUG, "expecting response\n"); - r = gigaset_getfilteredresponse(gs, p2, timeout, -1, s, l, gs->prefix, gs->preflen); - if (r < 0) - return r; - - gigaset_logstr(gs->gl, GLOG_DEBUG, "got: ", *p2); - - if (!p) { - free(*p2); - *p2 = NULL; - } - - return r; + return gigaset_getfilteredresponse(gs, p, timeout, -1, s, l, gs->prefix, gs->preflen); } /* send command in configuration mode and collect response diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/log.c new/gigaset-frontend-0.7.1/lib/log.c --- old/gigaset-frontend-0.6.0/lib/log.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/log.c 2013-05-12 23:19:53.000000000 +0200 @@ -20,7 +20,6 @@ int gigaset_logdel(struct gstatus *gs) { int r; - char *buf; int newstyle; if (!gs->have_ver_fwbase) @@ -34,10 +33,9 @@ r = gigaset_sendcommand(gs, "AT^SLOG=RESET"); // => ZLOG=0000 if (r < 0) return r; - r = gigaset_expectresponse(gs, "ZLOG=", 5, &buf, 30); + r = gigaset_expectresponse(gs, "ZLOG=", 5, NULL, 30); if (r < 0) return r; - free(buf); return 0; } @@ -70,8 +68,10 @@ if (r < 0) return r; l = gigaset_expectresponse(gs, "ZLOG=", 5, &buf, 30); - if (l < 0) + if (l < 0) { + free(buf); return l; + } r = gigaset_unstuffbuf((char*) &dst, buf+5, l-5, 0x7d, 6); free(buf); @@ -161,8 +161,10 @@ resplen = 5; } l = gigaset_expectresponse(gs, resp, resplen, &buf, 30); - if (l < 0) + if (l < 0) { + free(buf); return l; + } entry = buf + resplen; l -= resplen; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/phonebook.c new/gigaset-frontend-0.7.1/lib/phonebook.c --- old/gigaset-frontend-0.6.0/lib/phonebook.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/phonebook.c 2013-05-12 23:19:53.000000000 +0200 @@ -60,6 +60,44 @@ } #endif +static const struct pbcau_desc { + unsigned type, value, level; + const char *text; +} pbcau_table[] = { + { 0, 0x10, GLOG_DEBUG, "normal call clearing" } +}; + +#define pbcau_table_END (pbcau_table + sizeof(pbcau_table)/sizeof((pbcau_table)[0])) + + +static void gigaset_logpbcau(struct glog *gl, const char *s) +{ + unsigned type, value; + char * vptr; + const struct pbcau_desc * ppd; + + if (memcmp(s, "ZPBCAU=", 7)) { + gigaset_log(gl, GLOG_ERR, "invalid cause code: %s\n", s); + return; + } + type = strtoul(s+7, &vptr, 16); + if (*vptr != ',') { + gigaset_log(gl, GLOG_ERR, "invalid cause code: %s\n", s); + return; + } + value = strtoul(vptr+1, &vptr, 16); + if (*vptr) { + gigaset_log(gl, GLOG_ERR, "invalid cause code: %s\n", s); + return; + } + for (ppd = pbcau_table; ppd < pbcau_table_END; ppd++) + if (type == ppd->type && value == ppd->value) { + gigaset_log(gl, ppd->level, "cause code: %s\n", ppd->text); + return; + } + gigaset_log(gl, GLOG_WARN, "cause code: %x,%x\n", type, value); +} + static int pbinit(struct gstatus *gs, struct resp_filter *filter[3]) { filter[0] = gigaset_addfilter(gs, FILTER_ZPBEND, 6+1, "ZPBEND", 0, NULL); @@ -86,31 +124,33 @@ static int gigaset_pbend (struct gstatus * gs) { int r, needok, needend; + char * resp; r = gigaset_sendcommand(gs, "AT^SPBEND"); - if (r < 0) return r; - for (needok = needend = 1; needok || needend; ) + for (needok = needend = 1; r >= 0 && (needok || needend); ) { - r = gigaset_expectresponse(gs, "OK", 2+1, NULL, 30); + r = gigaset_expectresponse(gs, "OK", 2+1, &resp, 30); if (r > 0) needok = 0; - else if (r == -FILTER_ZPBEND) + else if (r == -FILTER_ZPBEND) { needend = 0; - else if (r == -FILTER_ZPBCAU) - gigaset_log(gs->gl, GLOG_WARN, "ZPBCAU received\n"); - else - return r; + r = 0; + } else if (r == -FILTER_ZPBCAU) { + gigaset_logpbcau(gs->gl, resp); + r = 0; + } + free(resp); } - return 0; + return r; } static int gigaset_pbstart (struct gstatus * gs, const char * nmbr, char mode) { size_t l; ssize_t r; - char * cmd; + char * cmd, * resp; l=strlen(nmbr); cmd=malloc(12+l+2+1); @@ -128,23 +168,25 @@ if (r < 0) return r; gs->may_interrupt = 1; - r = gigaset_expectresponse(gs, "ZPBCONN", 7+1, NULL, 30); - if (r >= 0) r = gigaset_expectresponse(gs, "ZPBREADY", 8+1, NULL, 30); + r = gigaset_expectresponse(gs, "ZPBCONN", 7+1, &resp, 150); + if (r >= 0) { + free(resp); + r = gigaset_expectresponse(gs, "ZPBREADY", 8+1, &resp, 600); + } gs->may_interrupt = 0; - if (r>=0) return 0; - - if (r == -FILTER_ZPBEND) - return -ERR_ABORT; - if (r == -FILTER_ZPBCAU) { - r = gigaset_expectresponse(gs, "ZPBEND", 6+1, NULL, 0); - if (r >= 0) - return -ERR_ABORT; - r = -ERR_ABORT; + gigaset_logpbcau(gs->gl, resp); + r = gigaset_expectresponse(gs, NULL, 0, NULL, 0); + if (r != -FILTER_ZPBEND) + r = -ERR_ABORT; } - gigaset_pbend(gs); + free(resp); + if (r == -FILTER_ZPBEND) + return -ERR_ABORT; + if (r < 0) + gigaset_pbend(gs); return r; } @@ -162,7 +204,7 @@ if (r < 0) error = r; - r = gigaset_expectresponse(gs, NULL, 6+1, NULL, 30); + r = gigaset_expectresponse(gs, NULL, 0, NULL, 30); if (r != -FILTER_ZPBEOT) error = r; @@ -246,7 +288,7 @@ } /* supplementary data */ - if (cur->alert == 1) { + if (cur->melody >= 0) { gigaset_log(gs->gl, GLOG_DEBUG, "cur: %.2i\t%.2i\t%.2i:%.2i\t%.2i-%.2i-%.2i\n", cur->melody, cur->alert, cur->hour, cur->minute, @@ -280,7 +322,6 @@ if (error < 0) continue; //ZPBREPLY may take 7-8 sec to arrive, set ample timeout error=gigaset_expectresponse(gs, "ZPBRPLY=", 8, &s, 150); - if (error < 0) continue; //FIXME test ZPBRPLY value for 0000 free(s); } @@ -457,7 +498,7 @@ if (error >= 0) error = gigaset_expectresponse(gs, "OK", 2+1, NULL, 30); } else if (method==PB_TRANSFER_NEW) { - timeout = 30; /* no user action necessary */ + timeout = 150; /* no user action necessary */ error = gigaset_pbstart(gs, pnmbr, 'R'); } else return -ERR_PARAMINVALID; @@ -476,24 +517,23 @@ gs->may_interrupt = 0; if (len < 0) { if (len == -FILTER_ZPBCAU) { + gigaset_logpbcau(gs->gl, s); send_pbend = 1; - len = gigaset_expectresponse(gs, "ZPBEND", 7, NULL, 30); - if (len >=0) /* hangup and zpbend? */ - send_pbend = 0; - break; //FIXME + len = gigaset_expectresponse(gs, NULL, 0, NULL, 30); } + free(s); if (len == -FILTER_ZPBEND) { send_pbend = 0; } else if (len == -FILTER_ZPBEOT) { send_pbend = 1; - len = gigaset_expectresponse(gs, "ZPBCAU=", 7, NULL, 5); - if (len >=0) { - len = gigaset_expectresponse(gs, "ZPBEND", 7, NULL, 5); - if (len >=0) { /* hangup and zpbend? */ + len = gigaset_expectresponse(gs, NULL, 0, &s, 5); + if (len == -FILTER_ZPBCAU) { + gigaset_logpbcau(gs->gl, s); + len = gigaset_expectresponse(gs, NULL, 0, NULL, 5); + if (len == -FILTER_ZPBEND) /* hangup and zpbend? */ send_pbend = 0; - break; - } } + free(s); } else if (error >= 0) error = len; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/lib/sms.c new/gigaset-frontend-0.7.1/lib/sms.c --- old/gigaset-frontend-0.6.0/lib/sms.c 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/lib/sms.c 2013-05-12 23:19:53.000000000 +0200 @@ -44,7 +44,7 @@ #ifndef GIG_TEST int gigaset_smsend (struct gstatus * gs) { - ssize_t r; + ssize_t r = 0; unsigned zsmend; zsmend = gs->temp_filter[FLT_ZSMEND]->status; @@ -262,8 +262,10 @@ { ssize_t r; r=gigaset_smscommand(gs,cmd,rsp,rsplen,buf); - if (r < 0) return r; - if (r < rsplen) return -ERR_RESPINVALID; + if (r < rsplen) { + free(*buf); + return r<0 ? r : -ERR_RESPINVALID; + } r -= rsplen; memmove(*buf, *buf+rsplen, r+1); return r; @@ -274,7 +276,10 @@ char * buf; ssize_t r; r=gigaset_smscommand(gs,cmd,rsp,rsplen,&buf); - if (r<0) return r; + if (r < 0) { + free(buf); + return r; + } r=gigaset_32fromdec (num,buf+rsplen); //if (r<0) r=-1; //FIXME return r; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gigaset-frontend-0.6.0/qt/dial.cc new/gigaset-frontend-0.7.1/qt/dial.cc --- old/gigaset-frontend-0.6.0/qt/dial.cc 2011-02-06 15:00:45.000000000 +0100 +++ new/gigaset-frontend-0.7.1/qt/dial.cc 2013-05-12 23:19:53.000000000 +0200 @@ -165,7 +165,7 @@ case 1: type = GIG_TYPE_EXTERNAL; break; - case -1: + default: return; //FIXME msg } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
