Skip to contentSkip to conversation

gp8psk: Implement gp8psk_fe_read_ber

PATCH New Chris Lee 1 participant 1 message Jul 23, 2013 Media (V4L/DVB)

lore
Share & tools
lore

Chris Lee

author
#0 lore raw

PATCH 1/1 gp8psk: Implement gp8psk_fe_read_ber

---
 drivers/media/usb/dvb-usb/gp8psk-fe.c | 13 ++++++++++---
 drivers/media/usb/dvb-usb/gp8psk.h    |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/media/usb/dvb-usb/gp8psk-fe.c +10 -3
index 5864f37..223a3ca 100644
@@ -68,11 +68,18 @@ static int gp8psk_fe_read_status(struct dvb_frontend* fe, fe_status_t *status)
 	return 0;
 }
 
-/* not supported by this Frontend */
 static int gp8psk_fe_read_ber(struct dvb_frontend* fe, u32 *ber)
 {
-	(void) fe;
-	*ber = 0;
+	struct gp8psk_fe_state *st = fe->demodulator_priv;
+
+	u8 buf[4];
+
+	if (gp8psk_usb_in_op(st->d, GET_BER_RATE, 0, 0, buf, 4)) {
+		return -EINVAL;
+	}
+
+	*ber = (buf[3] << 24) + (buf[2] << 16) + (buf[1] << 8) + buf[0];
+
 	return 0;
 }
 
drivers/media/usb/dvb-usb/gp8psk.h +1 -0
index ed32b9d..ff6bb3c 100644
@@ -52,6 +52,7 @@ extern int dvb_usb_gp8psk_debug;
 #define GET_SERIAL_NUMBER               0x93    /* in */
 #define USE_EXTRA_VOLT                  0x94
 #define GET_FPGA_VERS			0x95
+#define GET_BER_RATE			0x9B
 #define CW3K_INIT			0x9d
 
 /* PSK_configuration bits */
Signature · 1 line
1.8.1.2