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

Commit f72a27b8 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

V4L/DVB: dvb-usb: prepare drivers for using rc-core



This is a big patch, yet trivial. It just move the RC properties
to a separate struct, in order to prepare the dvb-usb drivers to
use rc-core. There's no change on the behavior of the drivers.

With this change, it is possible to have both legacy and rc-core
based code inside the dvb-usb-remote, allowing a gradual migration
to rc-core, driver per driver.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 34abf219
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -146,10 +146,12 @@ static struct dvb_usb_device_properties a800_properties = {
	.power_ctrl       = a800_power_ctrl,
	.power_ctrl       = a800_power_ctrl,
	.identify_state   = a800_identify_state,
	.identify_state   = a800_identify_state,


	.rc.legacy = {
		.rc_interval      = DEFAULT_RC_INTERVAL,
		.rc_interval      = DEFAULT_RC_INTERVAL,
		.rc_key_map       = ir_codes_a800_table,
		.rc_key_map       = ir_codes_a800_table,
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_a800_table),
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_a800_table),
		.rc_query         = a800_rc_query,
		.rc_query         = a800_rc_query,
	},


	.i2c_algo         = &dibusb_i2c_algo,
	.i2c_algo         = &dibusb_i2c_algo,


+9 −7
Original line number Original line Diff line number Diff line
@@ -1025,10 +1025,12 @@ static struct dvb_usb_device_properties af9005_properties = {


	.i2c_algo = &af9005_i2c_algo,
	.i2c_algo = &af9005_i2c_algo,


	.rc.legacy = {
		.rc_interval = 200,
		.rc_interval = 200,
		.rc_key_map = NULL,
		.rc_key_map = NULL,
		.rc_key_map_size = 0,
		.rc_key_map_size = 0,
		.rc_query = af9005_rc_query,
		.rc_query = af9005_rc_query,
	},


	.generic_bulk_ctrl_endpoint          = 2,
	.generic_bulk_ctrl_endpoint          = 2,
	.generic_bulk_ctrl_endpoint_response = 1,
	.generic_bulk_ctrl_endpoint_response = 1,
@@ -1072,10 +1074,10 @@ static int __init af9005_usb_module_init(void)
	rc_keys_size = symbol_request(ir_codes_af9005_table_size);
	rc_keys_size = symbol_request(ir_codes_af9005_table_size);
	if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) {
	if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) {
		err("af9005_rc_decode function not found, disabling remote");
		err("af9005_rc_decode function not found, disabling remote");
		af9005_properties.rc_query = NULL;
		af9005_properties.rc.legacy.rc_query = NULL;
	} else {
	} else {
		af9005_properties.rc_key_map = rc_keys;
		af9005_properties.rc.legacy.rc_key_map = rc_keys;
		af9005_properties.rc_key_map_size = *rc_keys_size;
		af9005_properties.rc.legacy.rc_key_map_size = *rc_keys_size;
	}
	}


	return 0;
	return 0;
+18 −12
Original line number Original line Diff line number Diff line
@@ -847,8 +847,8 @@ static void af9015_set_remote_config(struct usb_device *udev,
	}
	}


	if (table) {
	if (table) {
		props->rc_key_map = table->rc_key_map;
		props->rc.legacy.rc_key_map = table->rc_key_map;
		props->rc_key_map_size = table->rc_key_map_size;
		props->rc.legacy.rc_key_map_size = table->rc_key_map_size;
		af9015_config.ir_table = table->ir_table;
		af9015_config.ir_table = table->ir_table;
		af9015_config.ir_table_size = table->ir_table_size;
		af9015_config.ir_table_size = table->ir_table_size;
	}
	}
@@ -878,8 +878,8 @@ static int af9015_read_config(struct usb_device *udev)
	deb_info("%s: IR mode:%d\n", __func__, val);
	deb_info("%s: IR mode:%d\n", __func__, val);
	for (i = 0; i < af9015_properties_count; i++) {
	for (i = 0; i < af9015_properties_count; i++) {
		if (val == AF9015_IR_MODE_DISABLED) {
		if (val == AF9015_IR_MODE_DISABLED) {
			af9015_properties[i].rc_key_map = NULL;
			af9015_properties[i].rc.legacy.rc_key_map = NULL;
			af9015_properties[i].rc_key_map_size  = 0;
			af9015_properties[i].rc.legacy.rc_key_map_size  = 0;
		} else
		} else
			af9015_set_remote_config(udev, &af9015_properties[i]);
			af9015_set_remote_config(udev, &af9015_properties[i]);
	}
	}
@@ -1063,7 +1063,7 @@ static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
{
	u8 buf[8];
	u8 buf[8];
	struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf};
	struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf};
	struct ir_scancode *keymap = d->props.rc_key_map;
	struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
	int i, ret;
	int i, ret;


	memset(buf, 0, sizeof(buf));
	memset(buf, 0, sizeof(buf));
@@ -1075,7 +1075,7 @@ static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
	*event = 0;
	*event = 0;
	*state = REMOTE_NO_KEY_PRESSED;
	*state = REMOTE_NO_KEY_PRESSED;


	for (i = 0; i < d->props.rc_key_map_size; i++) {
	for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) {
		if (!buf[1] && rc5_custom(&keymap[i]) == buf[0] &&
		if (!buf[1] && rc5_custom(&keymap[i]) == buf[0] &&
		    rc5_data(&keymap[i]) == buf[2]) {
		    rc5_data(&keymap[i]) == buf[2]) {
			*event = keymap[i].keycode;
			*event = keymap[i].keycode;
@@ -1354,8 +1354,10 @@ static struct dvb_usb_device_properties af9015_properties[] = {


		.identify_state = af9015_identify_state,
		.identify_state = af9015_identify_state,


		.rc.legacy = {
			.rc_query         = af9015_rc_query,
			.rc_query         = af9015_rc_query,
			.rc_interval      = 150,
			.rc_interval      = 150,
		},


		.i2c_algo = &af9015_i2c_algo,
		.i2c_algo = &af9015_i2c_algo,


@@ -1461,8 +1463,10 @@ static struct dvb_usb_device_properties af9015_properties[] = {


		.identify_state = af9015_identify_state,
		.identify_state = af9015_identify_state,


		.rc.legacy = {
			.rc_query         = af9015_rc_query,
			.rc_query         = af9015_rc_query,
			.rc_interval      = 150,
			.rc_interval      = 150,
		},


		.i2c_algo = &af9015_i2c_algo,
		.i2c_algo = &af9015_i2c_algo,


@@ -1568,8 +1572,10 @@ static struct dvb_usb_device_properties af9015_properties[] = {


		.identify_state = af9015_identify_state,
		.identify_state = af9015_identify_state,


		.rc.legacy = {
			.rc_query         = af9015_rc_query,
			.rc_query         = af9015_rc_query,
			.rc_interval      = 150,
			.rc_interval      = 150,
		},


		.i2c_algo = &af9015_i2c_algo,
		.i2c_algo = &af9015_i2c_algo,


+8 −6
Original line number Original line Diff line number Diff line
@@ -377,7 +377,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap)
static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
{
{
	u8 buf[] = {CMD_GET_IR_CODE};
	u8 buf[] = {CMD_GET_IR_CODE};
	struct ir_scancode *keymap = d->props.rc_key_map;
	struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
	u8 ircode[2];
	u8 ircode[2];
	int i, ret;
	int i, ret;


@@ -388,7 +388,7 @@ static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
	*event = 0;
	*event = 0;
	*state = REMOTE_NO_KEY_PRESSED;
	*state = REMOTE_NO_KEY_PRESSED;


	for (i = 0; i < d->props.rc_key_map_size; i++) {
	for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) {
		if (rc5_custom(&keymap[i]) == ircode[0] &&
		if (rc5_custom(&keymap[i]) == ircode[0] &&
		    rc5_data(&keymap[i]) == ircode[1]) {
		    rc5_data(&keymap[i]) == ircode[1]) {
			*event = keymap[i].keycode;
			*event = keymap[i].keycode;
@@ -520,10 +520,12 @@ static struct dvb_usb_device_properties anysee_properties = {
		}
		}
	},
	},


	.rc.legacy = {
		.rc_key_map       = ir_codes_anysee_table,
		.rc_key_map       = ir_codes_anysee_table,
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_anysee_table),
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_anysee_table),
		.rc_query         = anysee_rc_query,
		.rc_query         = anysee_rc_query,
		.rc_interval      = 200,  /* windows driver uses 500ms */
		.rc_interval      = 200,  /* windows driver uses 500ms */
	},


	.i2c_algo         = &anysee_i2c_algo,
	.i2c_algo         = &anysee_i2c_algo,


+7 −4
Original line number Original line Diff line number Diff line
@@ -1125,10 +1125,13 @@ static struct dvb_usb_device_properties az6027_properties = {
	.power_ctrl       = az6027_power_ctrl,
	.power_ctrl       = az6027_power_ctrl,
	.read_mac_address = az6027_read_mac_addr,
	.read_mac_address = az6027_read_mac_addr,
 */
 */
	.rc.legacy = {
		.rc_key_map       = ir_codes_az6027_table,
		.rc_key_map       = ir_codes_az6027_table,
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_az6027_table),
		.rc_key_map_size  = ARRAY_SIZE(ir_codes_az6027_table),
		.rc_interval      = 400,
		.rc_interval      = 400,
		.rc_query         = az6027_rc_query,
		.rc_query         = az6027_rc_query,
	},

	.i2c_algo         = &az6027_i2c_algo,
	.i2c_algo         = &az6027_i2c_algo,


	.num_device_descs = 5,
	.num_device_descs = 5,
Loading