Example #1
0
static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
{
    struct af9015_state *state = d_to_priv(d);
    u16 vid = le16_to_cpu(d->udev->descriptor.idVendor);

    if (state->ir_mode == AF9015_IR_MODE_DISABLED)
        return 0;

    /* try to load remote based module param */
    if (!rc->map_name)
        rc->map_name = af9015_rc_setup_match(dvb_usb_af9015_remote,
                                             af9015_rc_setup_modparam);

    /* try to load remote based eeprom hash */
    if (!rc->map_name)
        rc->map_name = af9015_rc_setup_match(state->eeprom_sum,
                                             af9015_rc_setup_hashes);

    /* try to load remote based USB iManufacturer string */
    if (!rc->map_name && vid == USB_VID_AFATECH) {
        /* Check USB manufacturer and product strings and try
           to determine correct remote in case of chip vendor
           reference IDs are used.
           DO NOT ADD ANYTHING NEW HERE. Use hashes instead. */
        char manufacturer[10];
        memset(manufacturer, 0, sizeof(manufacturer));
        usb_string(d->udev, d->udev->descriptor.iManufacturer,
                   manufacturer, sizeof(manufacturer));
        if (!strcmp("MSI", manufacturer)) {
            /* iManufacturer 1 MSI
               iProduct      2 MSI K-VOX */
            rc->map_name = af9015_rc_setup_match(
                               AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
                               af9015_rc_setup_modparam);
        }
    }

    /* load empty to enable rc */
    if (!rc->map_name)
        rc->map_name = RC_MAP_EMPTY;

    rc->allowed_protos = RC_BIT_NEC;
    rc->query = af9015_rc_query;
    rc->interval = 500;

    return 0;
}
Example #2
0
static void af9015_set_remote_config(struct usb_device *udev,
		struct dvb_usb_device_properties *props)
{
	u16 vid = le16_to_cpu(udev->descriptor.idVendor);
	u16 pid = le16_to_cpu(udev->descriptor.idProduct);

	/* try to load remote based module param */
	props->rc.core.rc_codes = af9015_rc_setup_match(
		dvb_usb_af9015_remote, af9015_rc_setup_modparam);

	/* try to load remote based eeprom hash */
	if (!props->rc.core.rc_codes)
		props->rc.core.rc_codes = af9015_rc_setup_match(
			af9015_config.eeprom_sum, af9015_rc_setup_hashes);

	/* try to load remote based USB ID */
	if (!props->rc.core.rc_codes)
		props->rc.core.rc_codes = af9015_rc_setup_match(
			(vid << 16) + pid, af9015_rc_setup_usbids);

	/* try to load remote based USB iManufacturer string */
	if (!props->rc.core.rc_codes && vid == USB_VID_AFATECH) {
		/* Check USB manufacturer and product strings and try
		   to determine correct remote in case of chip vendor
		   reference IDs are used.
		   DO NOT ADD ANYTHING NEW HERE. Use hashes instead. */
		char manufacturer[10];
		memset(manufacturer, 0, sizeof(manufacturer));
		usb_string(udev, udev->descriptor.iManufacturer,
			manufacturer, sizeof(manufacturer));
		if (!strcmp("MSI", manufacturer)) {
			/* iManufacturer 1 MSI
			   iProduct      2 MSI K-VOX */
			props->rc.core.rc_codes = af9015_rc_setup_match(
				AF9015_REMOTE_MSI_DIGIVOX_MINI_II_V3,
				af9015_rc_setup_modparam);
		}
	}

	/* finally load "empty" just for leaving IR receiver enabled */
	if (!props->rc.core.rc_codes)
		props->rc.core.rc_codes = RC_MAP_EMPTY;

	return;
}