879 |
879 |
signal_status_t sigstat;
|
880 |
880 |
streaming_message_t sm;
|
881 |
881 |
service_t *s;
|
882 |
|
int logit = 0, retune, e;
|
|
882 |
int logit = 0, retune, e, i;
|
883 |
883 |
uint32_t period = MINMAX(lfe->lfe_status_period, 250, 8000);
|
884 |
884 |
#if DVB_VER_ATLEAST(5,10)
|
885 |
885 |
struct dtv_property fe_properties[6];
|
... | ... | |
1031 |
1031 |
|
1032 |
1032 |
logit = tvhlog_limit(&lfe->lfe_status_log, 3600);
|
1033 |
1033 |
|
|
1034 |
/* Check if DVBv5 stats are available */
|
|
1035 |
gotprop = 0;
|
1034 |
1036 |
if(ioctl_check(lfe, 0) && !lfe->lfe_old_status &&
|
1035 |
1037 |
!ioctl(lfe->lfe_fe_fd, FE_GET_PROPERTY, &dtv_prop)) {
|
|
1038 |
|
|
1039 |
for (i = 0; i < dtv_prop.num; i++)
|
|
1040 |
if (fe_properties[i].u.st.len)
|
|
1041 |
break;
|
|
1042 |
if (i < dtv_prop.num)
|
|
1043 |
gotprop = 1;
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
if (gotprop) {
|
1036 |
1047 |
/* Signal strength */
|
1037 |
|
gotprop = 0;
|
1038 |
1048 |
if(ioctl_check(lfe, 1) && fe_properties[0].u.st.len > 0) {
|
1039 |
1049 |
if(fe_properties[0].u.st.stat[0].scale == FE_SCALE_RELATIVE) {
|
1040 |
1050 |
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_RELATIVE;
|
1041 |
1051 |
mmi->tii_stats.signal = sig_multiply(fe_properties[0].u.st.stat[0].uvalue, lfe->lfe_sig_multiplier);
|
1042 |
|
gotprop = 1;
|
1043 |
1052 |
}
|
1044 |
1053 |
else if(fe_properties[0].u.st.stat[0].scale == FE_SCALE_DECIBEL) {
|
1045 |
1054 |
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_DECIBEL;
|
1046 |
1055 |
mmi->tii_stats.signal = sig_multiply(fe_properties[0].u.st.stat[0].svalue, lfe->lfe_sig_multiplier);
|
1047 |
|
gotprop = 1;
|
1048 |
1056 |
}
|
1049 |
1057 |
else if(fe_properties[0].u.st.stat[0].scale == FE_SCALE_NOT_AVAILABLE) {
|
1050 |
1058 |
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
1051 |
|
gotprop = 1;
|
1052 |
|
}
|
1053 |
|
else {
|
1054 |
|
ioctl_bad(lfe, 1);
|
1055 |
|
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
1056 |
|
if (logit)
|
1057 |
|
tvhwarn(LS_LINUXDVB, "Unhandled signal scale: %d",
|
1058 |
|
fe_properties[0].u.st.stat[0].scale);
|
1059 |
1059 |
}
|
1060 |
1060 |
}
|
1061 |
|
if(!gotprop && ioctl_check(lfe, 2)) {
|
1062 |
|
/* try old API */
|
1063 |
|
if (!ioctl(lfe->lfe_fe_fd, FE_READ_SIGNAL_STRENGTH, &u16)) {
|
1064 |
|
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_RELATIVE;
|
1065 |
|
mmi->tii_stats.signal = sig_multiply(u16, lfe->lfe_sig_multiplier);
|
1066 |
|
}
|
1067 |
|
else {
|
1068 |
|
ioctl_bad(lfe, 2);
|
1069 |
|
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
1070 |
|
if (logit)
|
1071 |
|
tvhwarn(LS_LINUXDVB, "Unable to provide signal strength value.");
|
1072 |
|
}
|
|
1061 |
else {
|
|
1062 |
ioctl_bad(lfe, 1);
|
|
1063 |
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
|
1064 |
if (logit)
|
|
1065 |
tvhwarn(LS_LINUXDVB, "Unhandled signal scale: %d",
|
|
1066 |
fe_properties[0].u.st.stat[0].scale);
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
if(ioctl_check(lfe, 2)) {
|
|
1070 |
ioctl_bad(lfe, 2);
|
|
1071 |
mmi->tii_stats.signal_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
|
1072 |
if (logit)
|
|
1073 |
tvhwarn(LS_LINUXDVB, "Unable to provide signal strength value.");
|
1073 |
1074 |
}
|
1074 |
1075 |
|
1075 |
1076 |
/* ERROR_BIT_COUNT */
|
1076 |
|
gotprop = 0;
|
1077 |
1077 |
if(ioctl_check(lfe, 3) && fe_properties[1].u.st.len > 0) {
|
1078 |
1078 |
if(fe_properties[1].u.st.stat[0].scale == FE_SCALE_COUNTER) {
|
1079 |
1079 |
mmi->tii_stats.ec_bit = fe_properties[1].u.st.stat[0].uvalue;
|
1080 |
|
gotprop = 1;
|
1081 |
1080 |
}
|
1082 |
1081 |
else {
|
1083 |
1082 |
ioctl_bad(lfe, 3);
|
... | ... | |
1087 |
1086 |
}
|
1088 |
1087 |
}
|
1089 |
1088 |
/* TOTAL_BIT_COUNT */
|
1090 |
|
if(gotprop && (fe_properties[2].u.st.len > 0)) {
|
1091 |
|
gotprop = 0;
|
|
1089 |
if(fe_properties[2].u.st.len > 0) {
|
1092 |
1090 |
if(ioctl_check(lfe, 4) && fe_properties[2].u.st.stat[0].scale == FE_SCALE_COUNTER) {
|
1093 |
1091 |
mmi->tii_stats.tc_bit = fe_properties[2].u.st.stat[0].uvalue;
|
1094 |
|
gotprop = 1;
|
1095 |
1092 |
}
|
1096 |
1093 |
else {
|
1097 |
1094 |
ioctl_bad(lfe, 4);
|
... | ... | |
1101 |
1098 |
fe_properties[2].u.st.stat[0].scale);
|
1102 |
1099 |
}
|
1103 |
1100 |
}
|
1104 |
|
if(!gotprop && ioctl_check(lfe, 5)) {
|
1105 |
|
/* try old API */
|
1106 |
|
if (!ioctl(lfe->lfe_fe_fd, FE_READ_BER, &u32))
|
1107 |
|
mmi->tii_stats.ber = u32;
|
1108 |
|
else {
|
1109 |
|
ioctl_bad(lfe, 5);
|
1110 |
|
if (logit)
|
1111 |
|
tvhwarn(LS_LINUXDVB, "Unable to provide BER value.");
|
1112 |
|
}
|
1113 |
|
}
|
1114 |
1101 |
|
1115 |
1102 |
/* SNR */
|
1116 |
|
gotprop = 0;
|
1117 |
1103 |
if(ioctl_check(lfe, 6) && fe_properties[3].u.st.len > 0) {
|
1118 |
1104 |
if(fe_properties[3].u.st.stat[0].scale == FE_SCALE_RELATIVE) {
|
1119 |
1105 |
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_RELATIVE;
|
1120 |
1106 |
mmi->tii_stats.snr = sig_multiply(fe_properties[3].u.st.stat[0].uvalue, lfe->lfe_snr_multiplier);
|
1121 |
|
gotprop = 1;
|
1122 |
1107 |
}
|
1123 |
1108 |
else if(fe_properties[3].u.st.stat[0].scale == FE_SCALE_DECIBEL) {
|
1124 |
1109 |
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_DECIBEL;
|
1125 |
1110 |
mmi->tii_stats.snr = sig_multiply(fe_properties[3].u.st.stat[0].svalue, lfe->lfe_snr_multiplier);
|
1126 |
|
gotprop = 1;
|
1127 |
1111 |
}
|
1128 |
1112 |
else if(fe_properties[3].u.st.stat[0].scale == FE_SCALE_NOT_AVAILABLE) {
|
1129 |
1113 |
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
1130 |
|
gotprop = 1;
|
1131 |
1114 |
}
|
1132 |
1115 |
else {
|
1133 |
1116 |
ioctl_bad(lfe, 6);
|
... | ... | |
1137 |
1120 |
fe_properties[3].u.st.stat[0].scale);
|
1138 |
1121 |
}
|
1139 |
1122 |
}
|
1140 |
|
if(!gotprop && ioctl_check(lfe, 7)) {
|
1141 |
|
/* try old API */
|
1142 |
|
if (!ioctl(lfe->lfe_fe_fd, FE_READ_SNR, &u16)) {
|
1143 |
|
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_RELATIVE;
|
1144 |
|
mmi->tii_stats.snr = sig_multiply(u16, lfe->lfe_snr_multiplier);
|
1145 |
|
}
|
1146 |
|
else {
|
1147 |
|
ioctl_bad(lfe, 7);
|
1148 |
|
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
1149 |
|
if (logit)
|
1150 |
|
tvhwarn(LS_LINUXDVB, "Unable to provide SNR value.");
|
1151 |
|
}
|
|
1123 |
if(ioctl_check(lfe, 7)) {
|
|
1124 |
ioctl_bad(lfe, 7);
|
|
1125 |
mmi->tii_stats.snr_scale = SIGNAL_STATUS_SCALE_UNKNOWN;
|
|
1126 |
if (logit)
|
|
1127 |
tvhwarn(LS_LINUXDVB, "Unable to provide SNR value.");
|
1152 |
1128 |
}
|
1153 |
1129 |
|
1154 |
1130 |
/* ERROR_BLOCK_COUNT == Uncorrected blocks (UNC) */
|
1155 |
|
gotprop = 0;
|
1156 |
1131 |
if(ioctl_check(lfe, 8) && fe_properties[4].u.st.len > 0) {
|
1157 |
1132 |
if(fe_properties[4].u.st.stat[0].scale == FE_SCALE_COUNTER) {
|
1158 |
1133 |
atomic_set(&mmi->tii_stats.unc, fe_properties[4].u.st.stat[0].uvalue);
|
1159 |
1134 |
mmi->tii_stats.ec_block = fe_properties[4].u.st.stat[0].uvalue;
|
1160 |
|
gotprop = 1;
|
1161 |
1135 |
}
|
1162 |
1136 |
else {
|
1163 |
1137 |
ioctl_bad(lfe, 8);
|
... | ... | |
1168 |
1142 |
}
|
1169 |
1143 |
|
1170 |
1144 |
/* TOTAL_BLOCK_COUNT */
|
1171 |
|
if(gotprop && (fe_properties[5].u.st.len > 0)) {
|
1172 |
|
gotprop = 0;
|
|
1145 |
if(fe_properties[5].u.st.len > 0) {
|
1173 |
1146 |
if(ioctl_check(lfe, 9) && fe_properties[5].u.st.stat[0].scale == FE_SCALE_COUNTER) {
|
1174 |
1147 |
mmi->tii_stats.tc_block = fe_properties[5].u.st.stat[0].uvalue;
|
1175 |
|
gotprop = 1;
|
1176 |
1148 |
}
|
1177 |
1149 |
else {
|
1178 |
1150 |
ioctl_bad(lfe, 9);
|
... | ... | |
1184 |
1156 |
fe_properties[5].u.st.stat[0].scale);
|
1185 |
1157 |
}
|
1186 |
1158 |
}
|
1187 |
|
if(!gotprop && ioctl_check(lfe, 10)) {
|
1188 |
|
/* try old API */
|
1189 |
|
if (!ioctl(lfe->lfe_fe_fd, FE_READ_UNCORRECTED_BLOCKS, &u32)) {
|
1190 |
|
atomic_set(&mmi->tii_stats.unc, u32);
|
1191 |
|
gotprop = 1;
|
1192 |
|
}
|
1193 |
|
else {
|
1194 |
|
ioctl_bad(lfe, 10);
|
1195 |
|
if (logit)
|
1196 |
|
tvhwarn(LS_LINUXDVB, "Unable to provide UNC value.");
|
1197 |
|
}
|
|
1159 |
if(ioctl_check(lfe, 10)) {
|
|
1160 |
ioctl_bad(lfe, 10);
|
|
1161 |
if (logit)
|
|
1162 |
tvhwarn(LS_LINUXDVB, "Unable to provide UNC value.");
|
1198 |
1163 |
}
|
1199 |
1164 |
/* Older API */
|
1200 |
1165 |
} else
|