/* wrapper for sending pid and serial# info to bootloader */
int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
{
	int ret;

	ret = msm_hsusb_send_productID(pid);
	if (ret)
		return ret;
#ifdef CONFIG_LGE_USB_GADGET_F_DIAG_RPC
    if (!snum) {
		(void)msm_hsusb_is_serial_num_null(1);
    }
	else
	{
	    (void)msm_hsusb_is_serial_num_null(0);
		(void)msm_hsusb_send_serial_number(snum);
	}
#else
	if (!snum) {
		ret = msm_hsusb_is_serial_num_null(1);
		if (ret)
			return ret;
	}

	ret = msm_hsusb_is_serial_num_null(0);
	if (ret)
		return ret;
	ret = msm_hsusb_send_serial_number(snum);
	if (ret)
		return ret;
#endif
	return 0;
}
Exemple #2
0
int lgeusb_set_current_mode(int need_reset)
{
	struct lgeusb_info *info = usb_info;
	int ret;

	if (!info->serialno || !info->defaultno) {
		lgeusb_info("serial numbers are invalid, skip configuration.\n");
		return -EINVAL;
	}

	if (get_factory_cable()) {
		/* We already are in factory mode, skip it. */
		if (info->current_mode == LGEUSB_FACTORY_MODE)
			return LGE_FACTORY_PID;

		/* When manufacturing, do not use serial number */
		lgeusb_info("We detect LGE factory cable......\n");
		lgeusb_switch_factory_mode(need_reset);
/* FIXME: It is QCT solution, must not used. */
#if 0
		msm_hsusb_send_productID(LGE_FACTORY_PID);
		msm_hsusb_is_serial_num_null(1);
#endif
		info->serialno[0] = '\0';
		return LGE_FACTORY_PID;
	}

	/* We already are in android mode, skip it. */
	if (info->current_mode == LGEUSB_ANDROID_MODE)
		return info->current_pid;

	lgeusb_info("We detect Normal USB cable......\n");
	lgeusb_switch_android_mode(need_reset);

	ret = get_serial_number(info->serialno);

/* FIXME: It is QCT solution, must not used. */
#if 0
	msm_hsusb_send_productID(info->current_pid);
	msm_hsusb_is_serial_num_null(0);

	if (!ret && (info->serialno[0] != '\0'))
		msm_hsusb_send_serial_number(info->serialno);
	else
		msm_hsusb_send_serial_number(info->defaultno);
#endif

	if (ret < 0)
		lgeusb_info("fail to get serial number, set to default.\n");

	return info->current_pid;
}
/* wrapper for sending pid and serial# info to bootloader */
int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
{
	int ret;

	ret = msm_hsusb_send_productID(pid);
	if (ret)
		return ret;

	if (!snum) {
		ret = msm_hsusb_is_serial_num_null(1);
		if (ret)
			return ret;
		/* fixup qcom bug by yanzhijun 20110420 */
		return 0;
	}

	ret = msm_hsusb_is_serial_num_null(0);
	if (ret)
		return ret;
	ret = msm_hsusb_send_serial_number(snum);
	if (ret)
		return ret;

	return 0;
}
/* wrapper for sending pid and serial# info to bootloader */
int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
{
	int ret;

#ifdef CONFIG_LGE_USB_GADGET_DRIVER
	if (pid == 0 || snum == NULL || snum[0] == '\0') {
		pr_info(" *** skip update_pid_and_serial_num()\n");
		return 0;
	}
#endif

	ret = msm_hsusb_send_productID(pid);
	if (ret)
		return ret;

	if (!snum) {
		ret = msm_hsusb_is_serial_num_null(1);
		if (ret)
			return ret;
	}

	ret = msm_hsusb_is_serial_num_null(0);
	if (ret)
		return ret;
	ret = msm_hsusb_send_serial_number(snum);
	if (ret)
		return ret;

	return 0;
}
/* wrapper for sending pid and serial# info to bootloader */
int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
{
	int ret;

	ret = msm_hsusb_send_productID(pid);
	if (ret)
		return ret;

/* LGE_CHANGE_S [START] 2012.2.26 [email protected] support factory usb of the chipset below MSM8X60 */
#ifdef CONFIG_LGE_USB_FACTORY_BELOW_MSM8X60
	if (!snum) {
		(void)msm_hsusb_is_serial_num_null(1);
	}
	else
	{
		(void)msm_hsusb_is_serial_num_null(0);
		(void)msm_hsusb_send_serial_number(snum);
	}
#else
	if (!snum) {
		ret = msm_hsusb_is_serial_num_null(1);
		if (ret)
			return ret;
	}

	ret = msm_hsusb_is_serial_num_null(0);
	if (ret)
		return ret;
	ret = msm_hsusb_send_serial_number(snum);
	if (ret)
		return ret;
#endif
/* LGE_CHANGE_S [END] 2012.2.26 [email protected] support factory usb of the chipset below MSM8X60 */

	return 0;
}
/* wrapper for sending pid and serial# info to bootloader */
int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
{
	int ret;

	ret = msm_hsusb_send_productID(pid);
	if (ret)
		return ret;

	if (!snum) {
		ret = msm_hsusb_is_serial_num_null(1);
		if (ret)
			return ret;
	}

	ret = msm_hsusb_is_serial_num_null(0);
	if (ret)
		return ret;
	ret = msm_hsusb_send_serial_number(snum);
	if (ret)
		return ret;

	return 0;
}