Click here to Skip to main content
15,846,976 members
Home / Discussions / Android
   

Android

 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 4:54
Pavlex424-Jan-17 4:54 
GeneralRe: Android USB Detection Pin
Jochen Arndt24-Jan-17 5:05
professionalJochen Arndt24-Jan-17 5:05 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 5:07
Pavlex424-Jan-17 5:07 
GeneralRe: Android USB Detection Pin
Jochen Arndt24-Jan-17 5:23
professionalJochen Arndt24-Jan-17 5:23 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 5:42
Pavlex424-Jan-17 5:42 
GeneralRe: Android USB Detection Pin
Pavlex425-Jan-17 1:22
Pavlex425-Jan-17 1:22 
GeneralRe: Android USB Detection Pin
Jochen Arndt25-Jan-17 1:33
professionalJochen Arndt25-Jan-17 1:33 
GeneralRe: Android USB Detection Pin
Pavlex426-Jan-17 7:20
Pavlex426-Jan-17 7:20 
Can this be helpful.It's from sec-switch.c file!

C++
#ifdef CONFIG_USB_HOST_NOTIFY
	} else if (usb_mode == USB_OTGHOST_DETACHED
		|| usb_mode == USB_OTGHOST_ATTACHED) {

		if (usb_mode == USB_OTGHOST_DETACHED) {
			pr_info("USB Host detached");
			sec_otg_notify(HNOTIFY_ID_PULL);
		} else {
			pr_info("USB Host attached");
			sec_otg_notify(HNOTIFY_ID);
		}

	} else if (usb_mode == USB_POWERED_HOST_DETACHED
		|| usb_mode == USB_POWERED_HOST_ATTACHED) {
		if (usb_mode == USB_POWERED_HOST_DETACHED){
			pr_info("USB Host HNOTIFY_SMARTDOCK_OFF");
			sec_otg_notify(HNOTIFY_SMARTDOCK_OFF);
		}else{
			pr_info("USB Host HNOTIFY_SMARTDOCK_ON");
			sec_otg_notify(HNOTIFY_SMARTDOCK_ON);
		}
#endif
	}
}


or this file sm5502.c :

C++
#if defined(CONFIG_USB_HOST_NOTIFY)
	if (adc == 0x11 || adc == ADC_AUDIO_DOCK) {
		val2 = DEV_AUDIO_DOCK;
		val1 = 0;
	}
#endif
	dev_err(&client->dev,
			"dev1: 0x%x,dev2: 0x%x,dev3: 0x%x,Carkit: 0x%x,ADC: 0x%x,Jig: %s\n",
			val1, val2, val3, val4, adc,
			(check_sm5502_jig_state() ? "ON" : "OFF"));

	/* USB */
	if (val1 & DEV_USB || val2 & DEV_T2_USB_MASK ||
			val4 & DEV_CARKIT_CHARGER1_MASK) {
		pr_info("[MUIC] USB Connected\n");
		pdata->callback(CABLE_TYPE_USB, SM5502_ATTACHED);
	/* USB_CDP */
	} else if (val1 & DEV_USB_CHG) {
		pr_info("[MUIC] CDP Connected\n");
		pdata->callback(CABLE_TYPE_CDP, SM5502_ATTACHED);
	/* UART */
	} else if (val1 & DEV_T1_UART_MASK || val2 & DEV_T2_UART_MASK) {
		uart_sm5502_connecting = 1;
		pr_info("[MUIC] UART Connected\n");
		i2c_smbus_write_byte_data(client, REG_MANUAL_SW1, SW_UART);
		if(vbus & DEV_VBUSIN_VALID)
			pdata->callback(CABLE_TYPE_JIG_UART_OFF_VB, SM5502_ATTACHED);
		else
			pdata->callback(CABLE_TYPE_UARTOFF, SM5502_ATTACHED);
#if (!defined(CONFIG_MACH_CT01) && !defined(CONFIG_MACH_CT01_CHN_CU))
		flash_control(true);
#endif
	/* CHARGER */
	} else if ((val1 & DEV_T1_CHARGER_MASK) ||
			(val3 & DEV_T3_CHARGER_MASK)) {
		pr_info("[MUIC] Charger Connected\n");
		pdata->callback(CABLE_TYPE_AC, SM5502_ATTACHED);
#if defined(CONFIG_USB_HOST_NOTIFY)
	/* for SAMSUNG OTG */
	} else if (val1 & DEV_USB_OTG && adc == ADC_OTG) {
		pr_info("[MUIC] OTG Connected\n");

#if defined(CONFIG_MUIC_SM5502_SUPPORT_LANHUB_TA)
		sm5502_enable_rawdataInterrupts(usbsw);
		usbsw->dock_attached = SM5502_ATTACHED;
		usbsw->previous_dock = ADC_OTG;
#endif
		sm5502_set_otg(usbsw, SM5502_ATTACHED);
		pdata->callback(CABLE_TYPE_OTG, SM5502_ATTACHED);
#endif
	/* JIG */
	} else if (val2 & DEV_T2_JIG_MASK) {
		pr_info("[MUIC] JIG Connected\n");
		pdata->callback(CABLE_TYPE_JIG, SM5502_ATTACHED);
#if (!defined(CONFIG_MACH_CT01) && !defined(CONFIG_MACH_CT01_CHN_CU))
		flash_control(true);
#endif
	/* Desk Dock */
	} else if ((val2 & DEV_AV) || (val3 & DEV_AV_VBUS)) {
		pr_info("[MUIC] Deskdock Connected\n");
		local_usbsw->dock_attached = SM5502_ATTACHED;
		if(vbus & DEV_VBUSIN_VALID)
			sm5502_dock_control(usbsw, CABLE_TYPE_DESK_DOCK,
				SM5502_ATTACHED, SW_AUDIO);
		else
			sm5502_dock_control(usbsw, CABLE_TYPE_DESK_DOCK_NO_VB,
				SM5502_ATTACHED, SW_AUDIO);
#if defined(CONFIG_VIDEO_MHL_V2)
	/* MHL */
	} else if (val3 & DEV_MHL) {
		pr_info("[MUIC] MHL Connected\n");
		sm5502_disable_interrupt();
		if (!poweroff_charging)
			/*mhl_ret = mhl_onoff_ex(1); support from sii8240*/
		else
			pr_info("LPM mode, skip MHL sequence\n");
		sm5502_enable_interrupt();
#endif
	/* Car Dock */
	} else if (val2 & DEV_JIG_UART_ON) {
		pr_info("[MUIC] Cardock Connected\n");
#if defined(CONFIG_SEC_FACTORY)
		local_usbsw->dock_attached = SM5502_ATTACHED;
		sm5502_dock_control(usbsw, CABLE_TYPE_CARDOCK,
			SM5502_ATTACHED, SW_AUDIO);
#endif
	/* SmartDock */
	} else if (val2 & DEV_SMARTDOCK) {
		pr_info("[MUIC] Smartdock Connected\n");
		sm5502_dock_control(usbsw, CABLE_TYPE_SMART_DOCK,
			SM5502_ATTACHED, SW_DHOST);
#if defined(CONFIG_VIDEO_MHL_V2)
		/*mhl_onoff_ex(1); support can be added once mhl is up*/
#endif
#if defined(CONFIG_USB_HOST_NOTIFY)
	/* Audio Dock */
	} else if (val2 & DEV_AUDIO_DOCK) {
		pr_info("[MUIC] Audiodock Connected\n");
		sm5502_dock_control(usbsw, CABLE_TYPE_AUDIO_DOCK,
			SM5502_ATTACHED, SW_DHOST);
#endif

#if defined(CONFIG_MUIC_SM5502_SUPPORT_LANHUB_TA)
		/* LANHUB */
	} else if (val2 & DEV_LANHUB) {
		if(usbsw->previous_dock == ADC_LANHUB &&
			usbsw->lanhub_ta_status == 1 )
			/*Skip for the LANHUB+TA Case*/
			pr_info("[MUIC] Lanhub + TA is connected\n");
		else {
		/* Enable RAWDATA Interrupts */
		sm5502_enable_rawdataInterrupts(usbsw);
		sm5502_detect_lanhub(usbsw);
		}
#endif
	/* Incompatible */
    } else if (vbus & DEV_VBUSIN_VALID) {
        pr_info("[MUIC] Incompatible Charger Connected\n");
        pdata->callback(CABLE_TYPE_INCOMPATIBLE,
                SM5502_ATTACHED);
    }
#if defined(CONFIG_TOUCHSCREEN_MMS144)
	else{
		tsp_noti_ignore = 1;
		printk("[TSP] attached, but don't noti \n");
	}
	if(!tsp_noti_ignore)
		tsp_charger_infom(1);

#endif

	usbsw->dev1 = val1;
	usbsw->dev2 = val2;
	usbsw->dev3 = val3;
	usbsw->adc = adc;
	usbsw->vbus = vbus; 
	usbsw->carkit_dev = val4;

	return adc;
}

static int sm5502_detach_dev(struct sm5502_usbsw *usbsw)
{
	struct sm5502_platform_data *pdata = usbsw->pdata;
#if defined(CONFIG_TOUCHSCREEN_MMS144)
	int tsp_noti_ignore = 0;

#endif

	/* USB */
	if (usbsw->dev1 & DEV_USB ||
			usbsw->dev2 & DEV_T2_USB_MASK ||
				usbsw->carkit_dev & DEV_CARKIT_CHARGER1_MASK) {
		pr_info("[MUIC] USB Disonnected\n");
		pdata->callback(CABLE_TYPE_USB, SM5502_DETACHED);
	} else if (usbsw->dev1 & DEV_USB_CHG) {
		pdata->callback(CABLE_TYPE_CDP, SM5502_DETACHED);

	/* UART */
	} else if (usbsw->dev1 & DEV_T1_UART_MASK ||
			usbsw->dev2 & DEV_T2_UART_MASK) {
		pr_info("[MUIC] UART Disonnected\n");
		if(usbsw->vbus & DEV_VBUSIN_VALID)
		pdata->callback(CABLE_TYPE_JIG_UART_OFF_VB, SM5502_DETACHED);
		else
		pdata->callback(CABLE_TYPE_UARTOFF, SM5502_DETACHED);
		uart_sm5502_connecting = 0;
#if (defined(CONFIG_MACH_MS01_EUR_3G) || defined(CONFIG_MACH_MS01_CHN_CMCC_3G) || defined(CONFIG_MACH_MS01_CHN_CU_3G))
		flash_control(false);
#endif
	/* CHARGER */
	} else if ((usbsw->dev1 & DEV_T1_CHARGER_MASK) ||
			(usbsw->dev3 & DEV_T3_CHARGER_MASK)) {
		pr_info("[MUIC] Charger Disonnected\n");
		pdata->callback(CABLE_TYPE_AC, SM5502_DETACHED);
#if defined(CONFIG_USB_HOST_NOTIFY)
	/* for SAMSUNG OTG */
	} else if (usbsw->dev1 & DEV_USB_OTG) {
		pr_info("[MUIC] OTG Disonnected\n");
#if defined(CONFIG_MUIC_SM5502_SUPPORT_LANHUB_TA)
		sm5502_disable_rawdataInterrupts(usbsw);
		pr_info("%s:lanhub_ta_status(%d)\n",
					__func__, usbsw->lanhub_ta_status);
		lanhub_ta_case = false;
		if (usbsw->lanhub_ta_status == 0) {
			pdata->callback(CABLE_TYPE_OTG,SM5502_DETACHED);
			sm5502_set_otg(usbsw, SM5502_DETACHED);
			}
		else if (pdata->lanhub_cb && usbsw->lanhub_ta_status == 1)
			pdata->lanhub_cb(CABLE_TYPE_LANHUB,SM5502_DETACHED, LANHUB);
		usbsw->dock_attached = SM5502_DETACHED;
		usbsw->lanhub_ta_status=0;
#else
		sm5502_set_otg(usbsw, SM5502_DETACHED);
		pdata->callback(CABLE_TYPE_OTG, SM5502_DETACHED);
#endif
#endif
	/* JIG */
	} else if (usbsw->dev2 & DEV_T2_JIG_MASK) {
		pr_info("[MUIC] JIG Disonnected\n");
		pdata->callback(CABLE_TYPE_JIG, SM5502_DETACHED);
#if (defined(CONFIG_MACH_MS01_EUR_3G) || defined(CONFIG_MACH_MS01_CHN_CMCC_3G) || defined(CONFIG_MACH_MS01_CHN_CU_3G))
		flash_control(false);
#endif
	/* Desk Dock */
	} else if ((usbsw->dev2 & DEV_AV) ||
			(usbsw->dev3 & DEV_AV_VBUS)) {
		pr_info("[MUIC] Deskdock Disonnected\n");
		local_usbsw->dock_attached = SM5502_DETACHED;
		if(usbsw->vbus & DEV_VBUSIN_VALID)
			sm5502_dock_control(usbsw, CABLE_TYPE_DESK_DOCK,
				SM5502_DETACHED, SW_ALL_OPEN);
		else
			sm5502_dock_control(usbsw, CABLE_TYPE_DESK_DOCK_NO_VB,
				SM5502_DETACHED, SW_ALL_OPEN);
#if defined(CONFIG_MHL_D3_SUPPORT)
	/* MHL */
	} else if (usbsw->dev3 & DEV_MHL) {
		pr_info("[MUIC] MHL Disonnected\n");
		//mhl_onoff_ex(false);
		detached_sm5502_status = 1;
#endif
	/* Car Dock */
	} else if (usbsw->dev2 & DEV_JIG_UART_ON) {
		pr_info("[MUIC] Cardock Disonnected\n");
#if defined(CONFIG_SEC_FACTORY)
		local_usbsw->dock_attached = SM5502_DETACHED;
		sm5502_dock_control(usbsw, CABLE_TYPE_CARDOCK,
			SM5502_DETACHED, SW_ALL_OPEN);
#endif
	/* Smart Dock */
	} else if (usbsw->dev2 == DEV_SMARTDOCK) {
		pr_info("[MUIC] Smartdock Disonnected\n");
		sm5502_dock_control(usbsw, CABLE_TYPE_SMART_DOCK,
			SM5502_DETACHED, SW_ALL_OPEN);
#if defined(CONFIG_VIDEO_MHL_V2)
		//mhl_onoff_ex(false);
#endif
#if defined(CONFIG_USB_HOST_NOTIFY)
	/* Audio Dock */
	} else if (usbsw->dev2 == DEV_AUDIO_DOCK) {
		pr_info("[MUIC] Audiodock Disonnected\n");
		sm5502_dock_control(usbsw, CABLE_TYPE_AUDIO_DOCK,
			SM5502_DETACHED, SW_ALL_OPEN);
#endif
#if defined(CONFIG_MUIC_SM5502_SUPPORT_LANHUB_TA)
	/* LANHUB */
	} else if (usbsw->adc == ADC_LANHUB) {
		pr_info("[MUIC] Lanhub disconnected\n");
		/* Disable RAWDATA Interrupts */
		sm5502_disable_rawdataInterrupts(usbsw);
		lanhub_ta_case = false;
		usbsw->dock_attached = SM5502_DETACHED;
		sm5502_set_lanhub(usbsw,SM5502_DETACHED);
		sm5502_mask_vbus_detect(usbsw, SM5502_DETACHED);
		pr_info("%s:lanhub_ta_status(%d)\n",__func__, usbsw->lanhub_ta_status);
		if (pdata->lanhub_cb && usbsw->lanhub_ta_status==1)
			pdata->lanhub_cb(CABLE_TYPE_LANHUB, SM5502_DETACHED, LANHUB);
		else if (usbsw->lanhub_ta_status == 0) {
			pdata->callback(CABLE_TYPE_OTG, SM5502_DETACHED);
			sm5502_set_otg(usbsw, SM5502_DETACHED);
			}
		usbsw->lanhub_ta_status=0;
		usbsw->dock_attached = SM5502_DETACHED;

#endif
	/* Incompatible */
    } else if (usbsw->vbus & DEV_VBUSIN_VALID) {
        pr_info("[MUIC] Incompatible Charger Disonnected\n");
        pdata->callback(CABLE_TYPE_INCOMPATIBLE,
                SM5502_DETACHED);
    }

GeneralRe: Android USB Detection Pin
Pavlex427-Jan-17 23:22
Pavlex427-Jan-17 23:22 
QuestionRe: Android USB Detection Pin
David Crow24-Jan-17 5:23
David Crow24-Jan-17 5:23 
AnswerRe: Android USB Detection Pin
Pavlex424-Jan-17 5:33
Pavlex424-Jan-17 5:33 
AnswerRe: Android USB Detection Pin
Pavlex424-Jan-17 5:42
Pavlex424-Jan-17 5:42 
GeneralRe: Android USB Detection Pin
Jochen Arndt24-Jan-17 6:09
professionalJochen Arndt24-Jan-17 6:09 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 7:21
Pavlex424-Jan-17 7:21 
GeneralRe: Android USB Detection Pin
Richard MacCutchan24-Jan-17 7:28
mveRichard MacCutchan24-Jan-17 7:28 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 8:49
Pavlex424-Jan-17 8:49 
GeneralRe: Android USB Detection Pin
Pavlex424-Jan-17 11:49
Pavlex424-Jan-17 11:49 
AnswerRe: Android USB Detection Pin
Pavlex424-Jan-17 11:48
Pavlex424-Jan-17 11:48 
AnswerRe: Android USB Detection Pin
Pavlex427-Jan-17 23:23
Pavlex427-Jan-17 23:23 
Questionremote android app's source code Pin
AkhilVarghese21-Jan-17 7:34
AkhilVarghese21-Jan-17 7:34 
AnswerRe: remote android app's source code Pin
Afzaal Ahmad Zeeshan21-Jan-17 8:52
professionalAfzaal Ahmad Zeeshan21-Jan-17 8:52 
QuestionAndroid USB OTG Support Enable Pin
Pavlex420-Jan-17 7:55
Pavlex420-Jan-17 7:55 
AnswerRe: Android USB OTG Support Enable Pin
Richard MacCutchan20-Jan-17 8:10
mveRichard MacCutchan20-Jan-17 8:10 
QuestionYour Best Recommended Android Apps & Android Game Apps Tutorials For Complete Beginners Pin
Member 1295678918-Jan-17 11:06
Member 1295678918-Jan-17 11:06 
AnswerRe: Your Best Recommended Android Apps & Android Game Apps Tutorials For Complete Beginners Pin
Richard MacCutchan18-Jan-17 23:14
mveRichard MacCutchan18-Jan-17 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.