int tune::start_scan(unsigned int mode, bool epg, scan_progress_callback progress_cb, void *progress_context) { scan_progress_cb = progress_cb; scan_progress_context = progress_context; if (mode != SCAN_QAM) mode = SCAN_VSB; scan_mode = mode; scan_epg = epg; int fd = open_fe(); if (fd < 0) return fd; scan_complete = false; f_kill_thread = false; int ret = pthread_create(&h_thread, NULL, scan_thread, this); if (0 != ret) { perror("pthread_create() failed"); close_fe(); } return ret; }
/** @brief : List the capabilities of one card * * */ void show_card_capabilities( int card, int tuner ) { int frontend_fd; int i_ret; int display_sr; int frequency_factor; /** The path of the card */ char card_dev_path[256]; sprintf(card_dev_path,DVB_DEV_PATH,card); //Open the frontend if(!open_fe (&frontend_fd, card_dev_path, tuner)) return; //if(ioctl(fd_frontend,FE_READ_STATUS,&festatus) >= 0) //print_status(festatus); //get frontend info struct dvb_frontend_info fe_info; if ( (i_ret = ioctl(frontend_fd,FE_GET_INFO, &fe_info) < 0)){ log_message( log_module, MSG_ERROR, "FE_GET_INFO: %s \n", strerror(errno)); return; } log_message( log_module, MSG_INFO, "=========== Card %d - Tuner %d ===========\n", card, tuner); log_message( log_module, MSG_INFO, " Frontend : %s\n", fe_info.name); display_sr=0; switch(fe_info.type) { case FE_OFDM: log_message( log_module, MSG_INFO, " Terrestrial (DVB-T) card\n"); break; case FE_QPSK: log_message( log_module, MSG_INFO, " Satellite (DVB-S) card\n"); display_sr=1; break; case FE_QAM: log_message( log_module, MSG_INFO, " Cable (DVB-C) card\n"); display_sr=1; break; case FE_ATSC: log_message( log_module, MSG_INFO, " ATSC card\n"); break; } if(fe_info.type==FE_QPSK) frequency_factor=1000; else frequency_factor=1; if (frequency_factor!=0) log_message( log_module, MSG_INFO, " Frequency: %d kHz to %d kHz\n",(int) fe_info.frequency_min/1000*frequency_factor,(int) fe_info.frequency_max/1000*frequency_factor); else log_message( log_module, MSG_WARN, " frequency_factor=0\n"); if(display_sr) log_message( log_module, MSG_INFO, " Symbol rate: %d k symbols/s to %d k symbols/s \n", (int)fe_info.symbol_rate_min/1000, (int)fe_info.symbol_rate_max/1000); log_message( log_module, MSG_DETAIL, " == Card capabilities =="); log_message( log_module, MSG_DEBUG, "caps 0x%x\n",fe_info.caps); frontend_cap_t caps[]={ {0x1,"FE_CAN_INVERSION_AUTO"}, {0x2,"FE_CAN_FEC_1_2"}, {0x4,"FE_CAN_FEC_2_3"}, {0x8,"FE_CAN_FEC_3_4"}, {0x10,"FE_CAN_FEC_4_5"}, {0x20,"FE_CAN_FEC_5_6"}, {0x40,"FE_CAN_FEC_6_7"}, {0x80,"FE_CAN_FEC_7_8"}, {0x100,"FE_CAN_FEC_8_9"}, {0x200,"FE_CAN_FEC_AUTO"}, {0x400,"FE_CAN_QPSK"}, {0x800,"FE_CAN_QAM_16"}, {0x1000,"FE_CAN_QAM_32"}, {0x2000,"FE_CAN_QAM_64"}, {0x4000,"FE_CAN_QAM_128"}, {0x8000,"FE_CAN_QAM_256"}, {0x10000,"FE_CAN_QAM_AUTO"}, {0x20000,"FE_CAN_TRANSMISSION_MODE_AUTO"}, {0x40000,"FE_CAN_BANDWIDTH_AUTO"}, {0x80000,"FE_CAN_GUARD_INTERVAL_AUTO"}, {0x100000,"FE_CAN_HIERARCHY_AUTO"}, {0x200000,"FE_CAN_8VSB"}, {0x400000,"FE_CAN_16VSB"}, {0x800000,"FE_HAS_EXTENDED_CAPS /* We need more bitspace for newer APIs, indicate this. */"}, {0x10000000,"FE_CAN_2G_MODULATION /* frontend supports '2nd generation modulation' (DVB-S2) */"}, {0x20000000,"FE_NEEDS_BENDING /* not supported anymore */"}, {0x40000000,"FE_CAN_RECOVER /* frontend can recover from a cable unplug automatically */"}, {0x80000000,"FE_CAN_MUTE_TS /* frontend can stop spurious TS data output */"}, }; int numcaps=28; int i; //todo : do a loop on a structure which contains the capabilities for(i=0;i<numcaps;i++) if(fe_info.caps & caps[i].flag) log_message( log_module, MSG_DETAIL, "%s\n", caps[i].descr); close (frontend_fd); log_message( log_module, MSG_INFO, "\n"); }