static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) { struct smsdvb_client_t *client = container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) *snr = client->fe_snr; return rc; }
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { struct smsdvb_client_t *client = container_of(fe, struct smsdvb_client_t, frontend); int rc = smsdvb_send_statistics_request(client); if (!rc) *ucblocks = client->fe_unc; return rc; }
static int smsdvb_read_status(struct dvb_frontend *fe, enum fe_status *stat) { int rc; struct smsdvb_client_t *client; client = container_of(fe, struct smsdvb_client_t, frontend); rc = smsdvb_send_statistics_request(client); *stat = client->fe_status; led_feedback(client); return rc; }
static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber) { int rc; struct smsdvb_client_t *client; client = container_of(fe, struct smsdvb_client_t, frontend); rc = smsdvb_send_statistics_request(client); *ber = client->legacy_ber; led_feedback(client); return rc; }
static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) { int rc; struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct smsdvb_client_t *client; client = container_of(fe, struct smsdvb_client_t, frontend); rc = smsdvb_send_statistics_request(client); *ucblocks = c->block_error.stat[0].uvalue; led_feedback(client); return rc; }
static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; int rc; struct smsdvb_client_t *client; client = container_of(fe, struct smsdvb_client_t, frontend); rc = smsdvb_send_statistics_request(client); /* Preferred scale for SNR with legacy API: 0.1 dB */ *snr = ((u32)c->cnr.stat[0].svalue) / 100; led_feedback(client); return rc; }
static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; int rc; s32 power = (s32) c->strength.stat[0].uvalue; struct smsdvb_client_t *client; client = container_of(fe, struct smsdvb_client_t, frontend); rc = smsdvb_send_statistics_request(client); if (power < -95) *strength = 0; else if (power > -29) *strength = 65535; else *strength = (power + 95) * 65535 / 66; led_feedback(client); return rc; }