More on the charging USB OTG Nexus 7
So i can reliably charge now with the USB OTG cable.
I found I had a problem wit the cable I had bought: it should have 100K between pin 4 & pin 5, but pin 4 was No-Connect. E.g. see here.
I cut the shield off the cable i was using with an xacto knife (this is pretty easy, there’s a seam).
From here I could see it not only didn’t have the resistor on pin 4-5, but it didn’t even bring pin-4 out to the little ‘circuit board’ for soldering to. Crap.
Fortunately USB cables are the cockroaches of our generation, and i had a few to sacrifice to the cause just laying around. So i slit the next one open, spliced two cables (red-red, black-black, 100K from pin 4-5, and white/green one-off to one connector). [Note: later i learned this needs to be 124K. the online site i found was wrong, i looked it up in the USB Battery Charging standard]
Now the system detects that its a OTG charging cable, and starts/stops the charging when I plug in power.
With my patch in msm_otg.c, I call the smb345 charger instead of the pm8921 charger. But i run into some other troubles. The smb345 driver does not implement the ‘power properties’ (e.g. see the smb349 driver which does, e.g. see POWER_SUPPLY_PROP_CURRENT_MAX). So msm_otg_notify_power_supply() fails (since power_supply_set_current goes nowhere).
I’m also not sure what to stub in for pm8921_charger_vbus_draw.
So without this, it seems to leave the actual device in b_idle state, which is pointless. I can charge but no accessories!