I just noticed my SGS2 doing the exactly same thing today! I'm fairly sure it is related to dirt or dust in the microUSB port, since my friend dropped my phone at the beach (not gonna borrow it to him again!) and it got covered in sand. Few hours later, sporadic car and PC modes, sometimes the phone even thinks it's charging. I tried blowing into the USB jack but to no avail... I hope I won't have to return it!!
Did you find my post helpful in any way? Feel free to click the 'Thanks' button below!
Samsung GT-I9100 + 2000 mAh extended battery
SlimICS 2.9 (Android 4.0.3)
SiyahKernel 3b6 (for BLN)
100-1000 mHz / ondemand / noop