Changeset 41054


Ignore:
Timestamp:
10/27/17 18:54:53 (6 years ago)
Author:
gost
Message:

[titan] fix hybrit tuner and more then one loop tuner

Location:
titan/titan
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/frontenddev.h

    r41048 r41054  
    260260        char* tmpstr = NULL, *tmpnr = NULL, *aktnr = NULL;
    261261        int i, orbitalpos = 0, band = 0;
    262 
     262        int found = 0;
     263        //char *CharPtrTmp[20];
     264        struct dvbdev* CharPtrTmp[20];
     265       
    263266        if(dvbfirst != NULL)
    264267                dvbnode = dvbfirst;
     
    284287                        continue;
    285288                }
    286 
     289                //if(flag != 1) printf("****** test tuner0 %s\n", dvbnode->feshortname);
    287290                if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == tpnode->fetype)
    288291                {
     
    298301                                dvbnode->feakttransponder = tpnode;
    299302                                if(flag != 1) debug(200, "found tuner with same orbitalpos/frequency/pol/band %s", dvbnode->feshortname);
     303                                //if(flag != 1) printf("------ found tuner with same orbitalpos/frequency/pol/band %s\n", dvbnode->feshortname);
    300304                                return(dvbnode);
    301305                        }
     
    329333                        }
    330334
     335                        found = 0;
     336                        //check if tuner is main tuner
     337                        if(getconfig(dvbnode->feshortname, NULL) != NULL)
     338                        {
     339                                dvbnode = dvbnode->next;
     340                                continue;                               
     341                        }
    331342                        //check if tuner is loop and looptuner is locked
    332343                        tmpstr = getconfigbyval(dvbnode->feshortname, NULL);
    333                         if(tmpstr != NULL) //found loop tuner
     344                        while(tmpstr != NULL) //found loop tuner
    334345                        {
    335346                                tmpdvbnode = fegetbyshortname(tmpstr);
     347                                //if(flag != 1) printf("****** test tuner1 %s -> %s\n", dvbnode->feshortname, tmpdvbnode->feshortname);
    336348                                if(tmpdvbnode != NULL && tmpdvbnode->feakttransponder != NULL && (tmpdvbnode->feaktpolarization != tpnode->polarization || tmpdvbnode->feakttransponder->orbitalpos != tpnode->orbitalpos) && (tmpdvbnode->felock != 0 || (flag == 2 && tmpdvbnode->felock == 0)))
    337349                                {
    338                                         dvbnode = dvbnode->next;
    339                                         continue;
     350                                        found = 0;
     351                                        break;
    340352                                }
     353                                else
     354                                {
     355                                        CharPtrTmp[found] = tmpdvbnode;
     356                                        found = found + 1;
     357                                }
     358                                tmpstr = getconfigbyval(tmpstr, NULL); //loop tuner also loop  ?
    341359                        }
    342 
     360                        CharPtrTmp[found] = NULL;
     361                               
     362                        if(found == 0)
     363                        {
     364                                dvbnode = dvbnode->next;
     365                                continue;
     366                        }
     367                       
    343368                        tmpstr = ostrcat(dvbnode->feshortname, "_sat", 0, 0);
    344369                        for(i = 1; i <= getmaxsat(dvbnode->feshortname); i++)
     
    354379                                        else
    355380                                                band = calclof(dvbnode, tpnode, aktnr, 1);
    356                                         if(tmpdvbnode != NULL && tmpdvbnode->feaktband != band && (tmpdvbnode->felock != 0 || (flag == 2 && tmpdvbnode->felock == 0)))
     381                                        found = 0;
     382                                        while(CharPtrTmp[found] != NULL)
    357383                                        {
     384                                                //if(flag != 1) printf("++++++ test band1 %s\n", CharPtrTmp[found]->feshortname);
     385                                                if(CharPtrTmp[found] != NULL && CharPtrTmp[found]->feaktband != band && (CharPtrTmp[found]->felock != 0 || (flag == 2 && CharPtrTmp[found]->felock == 0)))
     386                                                {
     387                                                        found = 99;
     388                                                        break;
     389                                                }
     390                                                found = found + 1;
     391                                        }
     392                                                //if(tmpdvbnode != NULL && tmpdvbnode->feaktband != band && (tmpdvbnode->felock != 0 || (flag == 2 && tmpdvbnode->felock == 0)))
     393                                                //{
     394                                                //      free(tmpnr); tmpnr = NULL;
     395                                                //      continue;
     396                                                //}
     397                                        if(found == 99)
     398                                        {
     399                                                found = 0;
    358400                                                free(tmpnr); tmpnr = NULL;
    359401                                                continue;
    360                                         }
     402                                        }       
    361403                                        if(flag == 1)
    362404                                        {
     
    382424                                        free(tmpnr); tmpnr = NULL;
    383425                                        if(flag != 1) debug(200, "found free tuner witch same orbitalpos %s", dvbnode->feshortname);
     426                                        //if(flag != 1) printf("------ found free tuner witch same orbitalpos %s\n", dvbnode->feshortname);
    384427                                        return dvbnode;
    385428                                }
     
    409452                        continue;
    410453                }
    411 
    412454                if(dvbnode->type == FRONTENDDEV && dvbnode->feinfo->type == tpnode->fetype && dvbnode->felock == 0)
    413455                {
     
    417459                                continue;
    418460                        }
    419 
     461                        if(getconfig(dvbnode->feshortname, NULL) == NULL)
     462                        {
     463                                dvbnode = dvbnode->next;
     464                                continue;                               
     465                        }
     466                        //check if tuner is loop and an other loopt is locked
     467                        found = 0;
     468                        tmpstr = getconfigbyval(dvbnode->feshortname, NULL);
     469                        while(tmpstr != NULL) //found loop tuner
     470                        {
     471                                tmpdvbnode = fegetbyshortname(tmpstr);
     472                                //if(flag != 1) printf("****** test tuner2 %s -> %s\n", dvbnode->feshortname, tmpdvbnode->feshortname);
     473                                if(tmpdvbnode != NULL && tmpdvbnode->feakttransponder != NULL && (tmpdvbnode->feaktpolarization != tpnode->polarization || tmpdvbnode->feakttransponder->orbitalpos != tpnode->orbitalpos) && (tmpdvbnode->felock != 0 || (flag == 2 && tmpdvbnode->felock == 0)))
     474                                {
     475                                        found = 0;
     476                                        break;
     477                                }
     478                                else
     479                                {
     480                                        CharPtrTmp[found] = tmpdvbnode;
     481                                        found = found + 1;
     482                                }
     483                                tmpstr = getconfigbyval(tmpstr, NULL); //loop tuner also loop  ?
     484                        }
     485                        if(found == 0)
     486                        {
     487                                dvbnode = dvbnode->next;
     488                                continue;
     489                        }       
    420490                        //check if tuner is loop an looptuner is locked
    421491                        tmpstr = getconfig(dvbnode->feshortname, NULL);
    422                         if(tmpstr != NULL) //found loop tuner
     492                        while(tmpstr != NULL) //found loop tuner
    423493                        {
    424494                                tmpdvbnode = fegetbyshortname(tmpstr);
     495                                //if(flag != 1) printf("****** test tuner1 %s -> %s\n", dvbnode->feshortname, tmpdvbnode->feshortname);
    425496                                if(tmpdvbnode != NULL && tmpdvbnode->feakttransponder != NULL && (tmpdvbnode->feaktpolarization != tpnode->polarization || tmpdvbnode->feakttransponder->orbitalpos != tpnode->orbitalpos) && (tmpdvbnode->felock != 0 || (flag == 2 && tmpdvbnode->felock == 0)))
    426497                                {
    427                                         dvbnode = dvbnode->next;
    428                                         continue;
     498                                        found = 0;
     499                                        break;
    429500                                }
     501                                else
     502                                {
     503                                        CharPtrTmp[found] = tmpdvbnode;
     504                                        found = found + 1;
     505                                }
     506                                tmpstr = getconfig(tmpstr, NULL);
    430507                        }
    431                         else
     508                        CharPtrTmp[found] = NULL;
     509                        if(found == 0)
    432510                        {
    433511                                dvbnode = dvbnode->next;
    434512                                continue;
    435513                        }
    436 
     514       
    437515                        tmpstr = ostrcat(tmpdvbnode->feshortname, "_sat", 0, 0);
    438516                        for(i = 1; i <= getmaxsat(tmpdvbnode->feshortname); i++)
     
    447525                                        else
    448526                                                band = calclof(dvbnode, tpnode, aktnr, 1);
    449                                         if(tmpdvbnode != NULL && tmpdvbnode->feaktband != band && (tmpdvbnode->felock != 0 || (flag >= 2 && tmpdvbnode->felock == 0)))
     527                                        found = 0;
     528                                        while(CharPtrTmp[found] != NULL)
    450529                                        {
     530                                                //if(flag != 1) printf("++++++ test band2 %s\n", CharPtrTmp[found]->feshortname);
     531                                                if(CharPtrTmp[found] != NULL && CharPtrTmp[found]->feaktband != band && (CharPtrTmp[found]->felock != 0 || (flag >= 2 && CharPtrTmp[found]->felock == 0)))     
     532                                                {
     533                                                        found = 99;
     534                                                        break;
     535                                                }
     536                                                found = found + 1;
     537                                                //if(tmpdvbnode != NULL && tmpdvbnode->feaktband != band && (tmpdvbnode->felock != 0 || (flag >= 2 && tmpdvbnode->felock == 0)))
     538                                                //{
     539                                                //      free(tmpnr); tmpnr = NULL;
     540                                                //      continue;
     541                                                //}
     542                                        }
     543                                        if(found == 99)
     544                                        {
     545                                                found = 0;
    451546                                                free(tmpnr); tmpnr = NULL;
    452547                                                continue;
    453548                                        }
     549                                               
    454550                                        if(flag == 1)
    455551                                        {
     
    473569                                        free(tmpstr); tmpstr = NULL;
    474570                                        free(tmpnr); tmpnr = NULL;
    475                                         if(flag != 1) debug(200, "found free looptuner witch same orbitalpos/polarization/band %s", dvbnode->feshortname);
     571                                        if(flag != 1) debug(200, "found free looptuner witch same orbitalpos/polarization/band %s main: %s", dvbnode->feshortname, tmpdvbnode->feshortname);
     572                                        //if(flag != 1) printf("------ found free looptuner witch same orbitalpos/polarization/band %s main: %s\n", dvbnode->feshortname, tmpdvbnode->feshortname);
    476573                                        return dvbnode;
    477574                                }
     
    18921989{
    18931990        int i, y, fd = -1, count = 0;
    1894         char *buf = NULL, *frontenddev = NULL, *fehyprid = NULL, *tmpstr = NULL;
     1991        char *buf = NULL, *frontenddev = NULL, *fehyprid = NULL, *tmpstr = NULL, *tmpstr1 = NULL;
    18951992        struct dvb_frontend_info* feinfo = NULL;
    18961993        struct dvbdev* dvbnode = NULL;
     
    19282025                                        tmpstr = ostrcat(tmpstr, oitoa(y), 1, 1);
    19292026                                        tmpstr = ostrcat(tmpstr, "_hyprid", 1, 0);
     2027                                        tmpstr1 = ostrcat(tmpstr, "_last", 0, 0);
     2028                                        addconfig(tmpstr1, "999"); //first set
     2029                                        free(tmpstr1), tmpstr1 = NULL;
    19302030#ifndef MIPSEL
    19312031                                        if(getconfig(tmpstr, NULL) != NULL)
     
    20362136        p[1].cmd = DTV_DELIVERY_SYSTEM;
    20372137        p[1].u.data = SYS_UNDEFINED;
    2038        
     2138        char* buf = NULL, *hypridtuner = NULL;
    20392139        int type = 0;
     2140        int ret = 0;
    20402141        char* realname = gethypridtunerchoicesvaluename(tuner->devnr, value);
    20412142       
    2042         //printf("**** > realname: %s\n", realname);
     2143       
     2144        printf("**** > realname: %s\n", realname);
    20432145       
    20442146        if(realname != NULL && ostrstr(realname, "DVB-S") != NULL)
     
    20922194        debug(200, "data %d",p[1].u.data );
    20932195        if (ioctl(tuner->fd, FE_SET_PROPERTY, &cmdseq) == -1)
    2094                 err("FE_SET_PROPERTY failed -> system tuner %d mode %s type %d ",tuner->devnr ,value, type);
    2095         return 1; //true
     2196        {
     2197                err("FE_SET_PROPERTY failed -> use procfs to switch delivery system tuner %d mode %s type %d",tuner->devnr ,value, type);
     2198                hypridtuner = getconfig("hypridtuner", NULL);
     2199                if(hypridtuner != NULL)
     2200                {
     2201                        buf = malloc(MINMALLOC);
     2202                        if(buf == NULL)
     2203                        {
     2204                                err("no memory");
     2205                                return 0;
     2206                        }
     2207                }
     2208                sprintf(buf, hypridtuner, tuner->devnr);
     2209                if(file_exist(buf))
     2210                {
     2211                        if(tuner->fd > -1)
     2212                        {
     2213                                feclose(tuner, -1);
     2214                                ret = writesys(buf, value, 0);
     2215                                tuner->fd = feopen(tuner, NULL);
     2216                        }
     2217                        else
     2218                                ret = writesys(buf, value, 0);
     2219                        printf("set %s to %s RC:%i\n", buf, value, ret);
     2220                }
     2221                err("set system tuner to %d ... file not found -> %s", value, buf);
     2222                free(buf); buf = NULL;
     2223                return 1; //true
     2224        }
     2225        return 0; //true
    20962226
    20972227#else //if DVB_API_VERSION < 5
     2228        printf("Hinweis -> DVB API kleiner Version 5\n");
     2229        if(sethypridtuner(tuner, value) == 0)
     2230                return 1;
    20982231        return 0; //false
    20992232#endif
  • titan/titan/global.h

    r41052 r41054  
    67366736        int ret = 0;
    67376737
    6738         char* buf = NULL, *hypridtuner = NULL, *tmpstr = NULL;
     6738        char* tmpstr = NULL;
    67396739        char* buf1 = NULL;
    6740 
    6741         hypridtuner = getconfig("hypridtuner", NULL);
    6742 
    6743         if(hypridtuner != NULL)
    6744         {
    6745                 buf = malloc(MINMALLOC);
    6746                 if(buf == NULL)
    6747                 {
    6748                         err("no memory");
    6749                         return 0;
    6750                 }
    6751         }
    6752 
    6753         sprintf(buf, hypridtuner, tuner->devnr);
    6754         if(buf != NULL)
    6755         {
    6756                 printf("set %s to %s\n", buf, value);
    6757                 if(file_exist(buf))
    6758                 {
     6740       
     6741        tmpstr = ostrcat(tuner->feshortname, "_hyprid_last", 0, 0);
     6742        if(ostrcmp(getconfig(tmpstr, NULL), value) == 0)
     6743        {
     6744                printf("set hyprid.. new value %s eq old value %s\n",getconfig(tmpstr, NULL), value);
     6745                free(tmpstr), tmpstr = NULL;
     6746                return 0;
     6747        }
     6748       
     6749        if(fechangetype(tuner, value) == 0)
     6750        {
     6751                if(getconfigint("need_delivery_system_workaround" , NULL) == 1)
     6752                {       
    67596753                        buf1 = readsys("/sys/module/dvb_core/parameters/dvb_shutdown_timeout",1);
    67606754                        ret = writesys("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "0", 1);
     
    67646758                        {
    67656759                                feclose(tuner, -1);
    6766                                 printf("set %s to %s\n", buf, value);
    6767                                 ret = writesys(buf, value, 0);
    67686760                                tuner->fd = feopen(tuner, NULL);
    6769                         }
    6770                         else
    6771                         {
    6772                                 printf("set %s to %s\n", buf, value);
    6773                                 ret = writesys(buf, value, 0);
    67746761                        }
    67756762                        writesys("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", buf1, 1);     
     
    67786765                }
    67796766                else
    6780                 {
    6781                         fechangetype(tuner, value);
    6782                         //return 0;
    6783                 }
    6784                 tmpstr = ostrcat(tuner->feshortname, "_hyprid", 0, 0);
    6785                 addconfigtmp(tmpstr, value);
    6786                 free(tmpstr); tmpstr = NULL;
    6787         }
    6788         free(buf); buf = NULL;
     6767                        printf("Hinweis -> hypridtuner workaround NOT active\n");
     6768        }
     6769       
     6770        addconfig(tmpstr, value);
     6771        free(tmpstr), tmpstr = NULL;
    67896772
    67906773        return 0;
     
    68146797        if(buf != NULL)
    68156798        {
    6816                 printf("set %s to %s\n", buf, value);
     6799                printf("old -> set %s to %s\n", buf, value);
    68176800                ret = writesys(buf, value, 0);
    68186801                free(tmpstr); tmpstr = NULL;
Note: See TracChangeset for help on using the changeset viewer.