[Nexus 7 (2013) Original Android Development] donbowman:
So i find its not very reliable. It does work sometimes (so there is hope!). But its not consistent that plugging in the cable will cause it to go into OTG mode (it does consistently charge).

Note that i did recompile your kernel, and i had CONFIG_USB_MSM_ACA set, which i see you don't... hmm

So i think the state machine is not quite right. I'll keep looking @ it tho.

Here is the result of plugging in the cable (power and usb flash are already plugged into it). This is with an ACA cable (124K between ping 4 and 5) (and after is the result of a 'dead-short pin 4/5' cable).

ACA cable:

<5>[ 1341.526855] smb345_charger: [smb345_inok_isr] VBUS_DET = L

<6>[ 1341.532165] anx7808_cbl_det_isr : gpio_get_value(anx7808->pdata->gpio_cbl_det) = 1

<6>[ 1341.532318] anx7808_cbl_det_isr : detect cable removal

<6>[ 1341.532409] msm_otg_id_pin_irq_enabled : id_pin_irq_enable = 1

<6>[ 1341.532562] anx7808_cbl_det_isr : gpio_get_value(anx7808->pdata->gpio_cbl_det) = 0

<6>[ 1341.532714] anx7808_cbl_det_isr : detect cable removal

<6>[ 1341.532806] msm_otg_id_pin_irq_enabled : id_pin_irq_enable = 1

<6>[ 1342.121337] notifying plugin

<6>[ 1342.123687] msm_otg msm_otg: USB exited from low power mode

<6>[ 1342.161285] id_pin_irq_work_function: APQ_OTG_ID_PIN is low : Host mode

<4>[ 1342.173583] [usbhost_charge_mode]: Do not supply power in host mode

<4>[ 1342.273742] [usbhost_charge_mode]: Do not supply power in host mode

<3>[ 1342.773925] msm_otg msm_otg: Failed notifying 0 charger type to PMIC

<6>[ 1343.001403] msm_otg msm_otg: chg_type = USB_ACA_A_CHARGER

<5>[ 1343.001495] smb345_charger: [usb_cable_type_detect] INOK=L

<5>[ 1343.001617] smb345_charger: [usb_cable_type_detect] Cable: ACA

<5>[ 1343.002319] smb345_charger: [smb345_set_InputCurrentlimit] Disable AICL, retval=93 setting=83

<5>[ 1343.002685] smb345_charger: [smb345_set_InputCurrentlimit] Set ICL=1200 retval =21 setting=24

<5>[ 1343.003051] smb345_charger: [smb345_set_InputCurrentlimit] Re-enable AICL, setting=93

<5>[ 1343.032318] smb345_charger: [smb345_vflt_setting] Set Float Volt, retval=ea setting=e8

<4>[ 1343.032806] ========================================================

<4>[ 1343.032928] bq27541_battery_callback usb_cable_state = 3

<4>[ 1343.032989] ========================================================

<6>[ 1343.033111] battery_callback cable_wake_lock 5 sec...

<6>[ 1343.033111]

<6>[ 1343.033233] elan-ktf3k 3-0010: Update power source to 1

<5>[ 1343.033660] smb345_charger: [usb_cable_type_detect] AC cable detect, disable wpc_pok, disable DCIN

<5>[ 1343.034576] bq27541_get_capacity = 80% ret= 80

<5>[ 1343.035430] bq27541_get_psp voltage_now= 4022000 uV

<5>[ 1343.036132] bq27541_get_psp temperature= 259 (0.1¢XC)

<5>[ 1343.036895] bq27541_get_psp status: Charging ret= 0x0101

<6>[ 1343.234100] The USB cable status = CHARGER_ACA

<5>[ 1345.032318] bq27541_get_psp status: Charging ret= 0x0101

<5>[ 1345.032501] smb345_charger: [smb345_config_thermal_limit] Set HRD SFT limit, retval=41 setting=73

<5>[ 1345.033294] bq27541_get_psp status: Charging ret= 0x0101

<5>[ 1345.033782] smb345_charger: [smb345_config_thermal_charging] temp=25, volt=4022000

<5>[ 1345.034179] bq27541_get_psp voltage_now= 4037000 uV

<5>[ 1345.035095] bq27541_get_capacity = 80% ret= 80

<5>[ 1345.035247] smb345_charger: [smb345_config_thermal_charging] Bypass set Float Volt=e8

<5>[ 1345.035858] smb345_charger: [smb345_config_thermal_charging] Bypass charger enable

<5>[ 1345.036254] bq27541_get_psp temperature= 260 (0.1¢XC)

<5>[ 1345.037139] bq27541_get_psp current_now = -77 mA

<5>[ 1345.037811] bq27541_get_psp charge_now (compensated) = 3179000 uAh

<5>[ 1345.038574] bq27541_get_psp charge_avg (uncompensated) = 3223000 uAh

<5>[ 1345.039245] bq27541_get_psp charge_full = 4001000 uAh

<5>[ 1345.039978] bq27541_get_psp charge_design = 4090000 uAh

<5>[ 1345.040649] bq27541_get_psp energy_now = 11889000 uWh

<5>[ 1345.041381] bq27541_get_psp charge_counter = 808000 uWh

<5>[ 1345.042114] bq27541_get_psp power_now = -311000 uW

<5>[ 1345.042785] bq27541_get_psp cycle count = 19

<5>[ 1345.046295] bq27541_get_capacity = 80% ret= 80

<5>[ 1345.047119] bq27541_get_psp voltage_now= 4037000 uV

<5>[ 1345.049133] bq27541_get_psp temperature= 260 (0.1¢XC)

<5>[ 1345.049926] bq27541_get_psp status: Charging ret= 0x0101

Non ACA (simple Y cable with short ping 4/5):

<5>[ 1442.462707] smb345_charger: [smb345_inok_isr] VBUS_DET = L

<6>[ 1443.061309] notifying plugin

<6>[ 1443.065002] msm_otg msm_otg: USB exited from low power mode

<6>[ 1443.091278] id_pin_irq_work_function: APQ_OTG_ID_PIN is low : Host mode

<4>[ 1443.103485] [usbhost_charge_mode]: Do not supply power in host mode

<4>[ 1443.203613] [usbhost_charge_mode]: Do not supply power in host mode

<3>[ 1443.703887] msm_otg msm_otg: Failed notifying 0 charger type to PMIC

<6>[ 1443.941467] msm_otg msm_otg: chg_type = USB_ACA_A_CHARGER

<5>[ 1443.941650] smb345_charger: [usb_cable_type_detect] INOK=L

<5>[ 1443.941741] smb345_charger: [usb_cable_type_detect] Cable: ACA

<5>[ 1443.942596] smb345_charger: [smb345_set_InputCurrentlimit] Disable AICL, retval=93 setting=83

<5>[ 1443.942932] smb345_charger: [smb345_set_InputCurrentlimit] Set ICL=1200 retval =21 setting=24

<5>[ 1443.943359] smb345_charger: [smb345_set_InputCurrentlimit] Re-enable AICL, setting=93

<5>[ 1443.972320] smb345_charger: [smb345_vflt_setting] Set Float Volt, retval=ea setting=e8

<4>[ 1443.972869] ========================================================

<4>[ 1443.972961] bq27541_battery_callback usb_cable_state = 3

<4>[ 1443.973114] ========================================================

<6>[ 1443.973205] battery_callback cable_wake_lock 5 sec...

<6>[ 1443.973205]

<6>[ 1443.973419] elan-ktf3k 3-0010: Update power source to 1

<5>[ 1443.973907] smb345_charger: [usb_cable_type_detect] AC cable detect, disable wpc_pok, disable DCIN

<5>[ 1443.974792] bq27541_get_capacity = 80% ret= 80

<5>[ 1443.975494] bq27541_get_psp voltage_now= 4016000 uV

<5>[ 1443.976226] bq27541_get_psp temperature= 261 (0.1¢XC)

<5>[ 1443.976928] bq27541_get_psp status: Charging ret= 0x0101

<6>[ 1444.174407] The USB cable status = CHARGER_ACA

<5>[ 1445.971740] smb345_charger: [smb345_config_thermal_limit] Set HRD SFT limit, retval=41 setting=73

<5>[ 1445.972595] bq27541_get_psp status: Charging ret= 0x0101

<5>[ 1445.973052] smb345_charger: [smb345_config_thermal_charging] temp=26, volt=4016000

<5>[ 1445.973571] bq27541_get_psp status: Charging ret= 0x0101

<5>[ 1445.974426] bq27541_get_psp voltage_now= 4054000 uV

<5>[ 1445.974578] smb345_charger: [smb345_config_thermal_charging] Bypass set Float Volt=e8

<5>[ 1445.975402] bq27541_get_capacity = 80% ret= 80

<5>[ 1445.975585] smb345_charger: [smb345_config_thermal_charging] Bypass charger enable

<5>[ 1445.976409] bq27541_get_psp temperature= 261 (0.1¢XC)

<5>[ 1445.977111] bq27541_get_psp current_now = 40 mA

<5>[ 1445.977783] bq27541_get_psp charge_now (compensated) = 3177000 uAh

<5>[ 1445.978424] bq27541_get_psp charge_avg (uncompensated) = 3221000 uAh

<5>[ 1445.979125] bq27541_get_psp charge_full = 4001000 uAh

<5>[ 1445.979766] bq27541_get_psp charge_design = 4090000 uAh

<5>[ 1445.980468] bq27541_get_psp energy_now = 11881000 uWh

<5>[ 1445.981109] bq27541_get_psp charge_counter = 810000 uWh

<5>[ 1445.982147] bq27541_get_psp power_now = 162000 uW

<5>[ 1445.982788] bq27541_get_psp cycle count = 19

<5>[ 1445.983978] bq27541_get_capacity = 80% ret= 80

<5>[ 1445.984741] bq27541_get_psp voltage_now= 4054000 uV

<5>[ 1445.985443] bq27541_get_psp temperature= 261 (0.1¢XC)

<5>[ 1445.986297] bq27541_get_psp status: Charging ret= 0x0101