Beispiel #1
0
static int get_serial_number(char *serial_number)
{
	unsigned char nv_imei_ptr[MAX_IMEI_LEN];
	int ret = -1;

	ret = msm_nv_imei_get(nv_imei_ptr);
	if (ret < 0) {
		nv_imei_ptr[0] = '\0';
		lgeusb_info("IMEI is NULL\n");
	} else {
		lgeusb_info("IMEI %s\n", nv_imei_ptr);
	}

	if (nv_imei_ptr[0] != '\0') {
		if ((nv_imei_ptr[0] == '8') && (nv_imei_ptr[1] == '0') &&
				(nv_imei_ptr[2] == 'A')) {
			memset(serial_number, 0, MAX_SERIAL_NO_LEN);
			/* We set serialno include header "80A" */
			memcpy(serial_number, nv_imei_ptr, MAX_IMEI_LEN);
			return 0;
		} else {
			serial_number[0] = '\0';
		}
	} else {
		serial_number[0] = '\0';
	}

	return ret;
}
Beispiel #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;
}
Beispiel #3
0
/* LGE_CHANGE
 * Register lge usb information(which include callback functions).
 * 2011-01-14, [email protected]
 */
void lgeusb_register_usbinfo(struct lgeusb_info *info)
{
	if (info) {
		usb_info = info;
		lgeusb_info("Registering infomation for lgeusb is success\n");

		lgeusb_debug("switch_func %p, get_pid %p\n",
				usb_info->switch_func,
				usb_info->get_pid);
	} else {
		lgeusb_info("Registering infomation for lgwusb is failed\n");
	}
}
Beispiel #4
0
static int __init lgeusb_init(void)
{
	lgeusb_info("u_lgeusb init\n");
	mutex_init(&lock);

	return 0;
}
Beispiel #5
0
static void do_switch_mode(int pid, int need_reset)
{
	struct lgeusb_info *info = usb_info;

	lgeusb_info("do_switch_mode : pid %x, need_reset %d\n", pid, need_reset);
	info->switch_func(pid, need_reset);
}
Beispiel #6
0
static int get_factory_cable(void)
{
	int pif_detect = 0;

	pif_detect = lge_get_pif_info();
	
	lgeusb_info("Using PIF ZIG (%d)\n", pif_detect);

	if (pif_detect == LGE_PIF_CABLE)
		return LGE_FACTORY_CABLE_TYPE;
	else
		return 0;
}
Beispiel #7
0
static int get_factory_cable(void)
{
	int pif_detect = 0;

#ifdef CONFIG_LGE_DETECT_PIF_PATCH
	pif_detect = lge_get_pif_info();
#endif
	lgeusb_info("Using PIF ZIG (%d)\n", pif_detect);

	if (pif_detect == LGE_PIF_CABLE)
		return LGE_FACTORY_CABLE_TYPE;
	else
		return 0;
}
Beispiel #8
0
static int get_serial_number(char *serial_number)
{
	serial_number[0] = '\0';
	return -1;

/* Temporary comment out */
/* FIXME: This depends on machine type(e.g Qualcomm or nVidia) */
#if 0
	unsigned char nv_imei_ptr[MAX_IMEI_LEN];
	int ret = -1;

	ret = msm_nv_imei_get(nv_imei_ptr);
	if (ret < 0) {
		nv_imei_ptr[0] = '\0';
		lgeusb_info("IMEI is NULL\n");
	} else {
		lgeusb_info("IMEI %s\n", nv_imei_ptr);
	}

	if (nv_imei_ptr[0] != '\0') {
		if ((nv_imei_ptr[0] == '8') && (nv_imei_ptr[1] == '0') &&
				(nv_imei_ptr[2] == 'A')) {
			memset(serial_number, 0, MAX_SERIAL_NO_LEN);
			/* We set serialno include header "80A" */
			memcpy(serial_number, nv_imei_ptr, MAX_IMEI_LEN);
			return 0;
		} else {
			serial_number[0] = '\0';
		}
	} else {
		serial_number[0] = '\0';
	}

	return ret;
#endif
}
Beispiel #9
0
static int get_factory_cable(void)
{

	return 0;

/* Temporary comment out */
/* FIXME: This depends on machine type(e.g Qualcomm or nVidia) */
#if 0
	int pif_detect = 0;

#ifdef CONFIG_LGE_DETECT_PIF_PATCH
	pif_detect = lge_get_pif_info();
#endif
	lgeusb_info("Using PIF ZIG (%d)\n", pif_detect);

	if (pif_detect == LGE_PIF_CABLE)
		return LGE_FACTORY_CABLE_TYPE;
	else
		return 0;
#endif
}