Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e8750c2 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab
Browse files

[media] af9015: small RC change

parent c1e13971
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -479,9 +479,7 @@ static int af9015_init_endpoint(struct dvb_usb_device *d)
		ret = af9015_set_reg_bit(d, 0xd50b, 0);
		ret = af9015_set_reg_bit(d, 0xd50b, 0);
	else
	else
		ret = af9015_clear_reg_bit(d, 0xd50b, 0);
		ret = af9015_clear_reg_bit(d, 0xd50b, 0);
	if (ret)

		goto error;
	ret = af9015_write_reg(d, 0x98e9, 0xff);
error:
error:
	if (ret)
	if (ret)
		err("endpoint init failed:%d", ret);
		err("endpoint init failed:%d", ret);
@@ -614,6 +612,11 @@ static int af9015_init(struct dvb_usb_device *d)
	int ret;
	int ret;
	deb_info("%s:\n", __func__);
	deb_info("%s:\n", __func__);


	/* init RC canary */
	ret = af9015_write_reg(d, 0x98e9, 0xff);
	if (ret)
		goto error;

	ret = af9015_init_endpoint(d);
	ret = af9015_init_endpoint(d);
	if (ret)
	if (ret)
		goto error;
		goto error;
@@ -1041,11 +1044,14 @@ static int af9015_rc_query(struct dvb_usb_device *d)


	/* Only process key if canary killed */
	/* Only process key if canary killed */
	if (buf[16] != 0xff && buf[0] != 0x01) {
	if (buf[16] != 0xff && buf[0] != 0x01) {
		/* Reset the canary */
		af9015_write_reg(d, 0x98e9, 0xff);
		deb_rc("%s: key pressed %02x %02x %02x %02x\n", __func__,
		deb_rc("%s: key pressed %02x %02x %02x %02x\n", __func__,
			buf[12], buf[13], buf[14], buf[15]);
			buf[12], buf[13], buf[14], buf[15]);


		/* Reset the canary */
		ret = af9015_write_reg(d, 0x98e9, 0xff);
		if (ret)
			goto error;

		/* Remember this key */
		/* Remember this key */
		memcpy(priv->rc_last, &buf[12], 4);
		memcpy(priv->rc_last, &buf[12], 4);
		if (buf[14] == (u8) ~buf[15]) {
		if (buf[14] == (u8) ~buf[15]) {
@@ -1058,6 +1064,7 @@ static int af9015_rc_query(struct dvb_usb_device *d)
					buf[13] << 8 | buf[14];
					buf[13] << 8 | buf[14];
			}
			}
		} else {
		} else {
			/* 32 bit NEC */
			priv->rc_keycode = buf[12] << 24 | buf[13] << 16 |
			priv->rc_keycode = buf[12] << 24 | buf[13] << 16 |
					buf[14] << 8 | buf[15];
					buf[14] << 8 | buf[15];
		}
		}