static void cable_detect_handler(unsigned long data)
{
	int usb_cable;
	static int reenum_cnt = REENUM_CNT;
	usb_cable = cable_is_usb();

	/* in factory mode, we know the cable must be usb, so we enumerate
	 * again
	 */
	if (in_factory_mode() && !usb_cable && reenum_cnt){
		pr_info("try usb enumertation again\n");
		reenum_cnt--;
		mutex_lock(&udc_lock);
		__udc_shutdown();
		mod_timer(&gadget_wrapper->cable_timer, jiffies +
				CABLE_TIMEOUT);
		__udc_startup();
		mutex_unlock(&udc_lock);
		return;
	}

	mutex_lock(&udc_lock);
	if (!usb_cable) {
		pr_info("cable is ac adapter\n");
		__udc_shutdown();
	}
	mutex_unlock(&udc_lock);
	return;
}
static void cable2pc_detect_works(struct work_struct *work)
{
	int usb_cable;
	static int reenum_cnt = REENUM_CNT;
	struct gadget_wrapper *d;
	d = gadget_wrapper;
	usb_cable = cable_is_usb();

	/* in factory mode, we know the cable must be usb, so we enumerate
	 * again
	 */
	if (in_factory_mode() && !usb_cable && reenum_cnt){
		pr_info("try usb enumertation again\n");
		reenum_cnt--;
		mutex_lock(&udc_lock);
		__udc_shutdown();
		queue_delayed_work(d->cable2pc_wq, &d->cable2pc,CABLE_TIMEOUT);
		__udc_startup();
		mutex_unlock(&udc_lock);
		return;
	}

	mutex_lock(&udc_lock);
	if (!usb_cable) {
		pr_info("cable is ac adapter\n");
		__udc_shutdown();
	}
	mutex_unlock(&udc_lock);
	return;
}