fix string handling in LEVEL_RAWSTR

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2550 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.9
Martin Ewing, AA6E 2009-01-03 20:58:32 +00:00
rodzic dec970e047
commit b18272f0e8
1 zmienionych plików z 13 dodań i 3 usunięć

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib TenTenc backend - TT-565 description
* Copyright (c) 2004-2008 by Stephane Fillod & Martin Ewing
*
* $Id: orion.c,v 1.26 2008-06-19 04:26:52 aa6e Exp $
* $Id: orion.c,v 1.27 2009-01-03 20:58:32 aa6e Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -1151,8 +1151,18 @@ int tt565_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
}
if (lvlbuf[2] == 'R') {
val->i = atoi(strchr(lvlbuf+3,
vfo == RIG_VFO_SUB ? 'S' : 'M')+1); /* check main/sub logic */
char *raw_field, *raw_field2;
/* response is @SRMnnnSnnn, incl main & sub rx. */
/* TT's spec indicates variable length data 1-3 digits */
if (vfo==RIG_VFO_SUB) { /* look at sub rx info */
raw_field = strchr(lvlbuf+3, 'S')+1; /* length may vary */
}
else { /* look at main rx info */
raw_field = lvlbuf+4;
raw_field2 = strchr(raw_field,'S'); /* position may vary */
if (raw_field2) *raw_field2 = '\0'; /* valid string */
}
val->i = atoi(raw_field); /* get raw value */
}
else val->i = 0; /* S-meter in xmit = 0 */
break;