Changeset 39752


Ignore:
Timestamp:
01/14/17 15:08:41 (7 years ago)
Author:
gost
Message:

arm.. fix signal display

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/frontenddev.h

    r39653 r39752  
    11981198{
    11991199        uint16_t snr = 0;
    1200 
    12011200        if(node == NULL)
    12021201        {
     
    12041203                return 0;
    12051204        }
    1206 
     1205       
     1206#ifdef ARM
     1207        int signalquality = 0;
     1208        int signalqualitydb = 0;
     1209       
     1210        struct dtv_property prop[1];
     1211        prop[0].cmd = DTV_STAT_CNR;
     1212        struct dtv_properties props;
     1213        props.props = prop;
     1214        props.num = 1;
     1215       
     1216        if(ioctl(node->fd, FE_GET_PROPERTY,  &props) < 0)
     1217        {
     1218                perr("FE_GET_PROPERTY");
     1219        }
     1220        for(unsigned int i=0; i<prop[0].u.st.len; i++)
     1221        {
     1222                if (prop[0].u.st.stat[i].scale == FE_SCALE_DECIBEL)
     1223                        signalqualitydb = prop[0].u.st.stat[i].svalue / 10;
     1224                else if (prop[0].u.st.stat[i].scale == FE_SCALE_RELATIVE)
     1225                        signalquality = prop[0].u.st.stat[i].svalue;
     1226        }
     1227        if(!signalquality && !signalqualitydb)
     1228        {
     1229                int ret = 0x12345678;
     1230                int sat_max = 1600; // we assume a max of 16db here
     1231                int ter_max = 2900; // we assume a max of 29db here
     1232                int cab_max = 4200; // we assume a max of 42db here
     1233                //int atsc_max = 4200; // we assume a max of 42db here
     1234               
     1235                ioctl(node->fd, FE_READ_SNR, &snr);
     1236                               
     1237                printf("++++ short:%s\n", node->feinfo->name);
     1238                if(ostrstr(node->feinfo->name, "Si2166B") != NULL)
     1239                        ret = (snr * 240) >> 8;
     1240               
     1241                signalqualitydb = ret;
     1242                if (ret == 0x12345678) // no snr db calculation avail.. return untouched snr value..
     1243                {
     1244                        signalquality = snr;
     1245                }
     1246                printf("++++ %i %i\n",node->feinfo->type, FE_QPSK); 
     1247                if(node->feinfo->type == FE_QPSK)
     1248                        signalquality = (ret >= sat_max ? 65536 : ret * 65536 / sat_max);
     1249                else if(node->feinfo->type == FE_QAM)
     1250                        signalquality = (ret >= cab_max ? 65536 : ret * 65536 / cab_max);
     1251                else if(node->feinfo->type == FE_OFDM)
     1252                        signalquality = (ret >= ter_max ? 65536 : ret * 65536 / ter_max);
     1253        }
     1254        debug(200, "frontend snr = %02x", (signalquality * 100) / 0xffff);
     1255        return signalquality;
     1256#else   
    12071257        ioctl(node->fd, FE_READ_SNR, &snr);
    12081258        debug(200, "frontend snr = %02x", (snr * 100) / 0xffff);
    12091259        return snr;
     1260#endif
     1261       
    12101262}
    12111263
     
    12191271                return 0;
    12201272        }
    1221 
     1273       
     1274#ifdef ARM             
     1275        struct dtv_property prop[1];
     1276        prop[0].cmd = DTV_STAT_SIGNAL_STRENGTH;
     1277        struct dtv_properties props;
     1278        props.props = prop;
     1279        props.num = 1;
     1280        ioctl(node->fd, FE_GET_PROPERTY, &props);
     1281        for(unsigned int i=0; i<prop[0].u.st.len; i++)
     1282        {
     1283                if (prop[0].u.st.stat[i].scale == FE_SCALE_RELATIVE)
     1284                        signal = prop[0].u.st.stat[i].uvalue;
     1285        }
     1286        if (!signal)
     1287        {
     1288                ioctl(node->fd, FE_READ_SIGNAL_STRENGTH, &signal);
     1289                if(ostrstr(node->feinfo->name, "Si2166B") != NULL)
     1290                        signal = signal * 1000;
     1291                debug(200, "frontend signal = %02x", (signal * 100) / 0xffff);
     1292        }
     1293        return signal;
     1294#else   
    12221295        ioctl(node->fd, FE_READ_SIGNAL_STRENGTH, &signal);
    12231296        debug(200, "frontend signal = %02x", (signal * 100) / 0xffff);
    12241297        return signal;
     1298#endif
    12251299}
    12261300
  • titan/titan/skinfunc.h

    r39667 r39752  
    707707        uint16_t snr = 0;
    708708        char* buf = NULL, *buf1 = NULL;
    709 
    710        
    711709        snr = fereadsnr(status.aktservice->fedev);
    712710        snr = (snr * 100) / 0xffff;
    713        
     711
    714712        buf = malloc(MINMALLOC);
    715713        if(buf == NULL)
Note: See TracChangeset for help on using the changeset viewer.