3

I've just updated my LG Optimus 4X HD from the latest stock ROM (4.1) to CM11 (Android 4.4). Access via ADB is only possible when either MTP or PTP are enabled; if I disable both, I only get:

$ adb devices
List of devices attached 
????????????    no permissions

I wouldn't really bother – but with PTP enabled, I always get a popup asking me to mount the "new device"; with MTP, additionally an error message for not being able to access the camera. This is pretty annoying: I never had it with this device before the upgrade, and I never experienced this with any other of my devices.

The "USB Connection" settings page only offers two checkboxes: MTP and PTP, the "Charge only" item is missing (and should obviously be reflected by unticking both MTP and PTP). Computer runs on Linux, in case it's relevant (and has no MTP software installed as I don't need it).

Is there any way to get rid of those annoying popups and still have ADB working? I'm fine with something to be executed via ADB, like adb shell setprop <whatever> and, if proven stable, to integrate with built.prop.

  • This may work out, provided that one has root access: have the device connected into PC both in USB debugging and MTP mode, go to /data/property/persist.sys.usb.config, remove everything inside the file except adb, disconnect USB cable , do a full reboot, connect USB cable and see if you succeeded. – Firelord Nov 12 '15 at 15:08
  • @Firelord Great idea, thanks – but didn't work out. Same result as if I'd disabled MTP and PTP via the UI: insufficient permissions for device on adb shell resp. ???????????? no permissions as stated in my question :( Was worth a try, though – and as advertized, easily reverted via Settings › Storage – Izzy Nov 12 '15 at 18:10
1

Thanks to the pointer provided by Firelord, I was able to solve the issue. The solution might look weird, but works perfectly:

As root, edit /data/property/persist.sys.usb.config. The only line in that file should read:

mass_storage,adb

We all know there is no anymore with Kitkat (except maybe rare exceptions). Well, maybe that's the reason nothing "pops up" anymore, offering to mount some resource :)

To revert from this, either:

  • open the notification area while connected via USB, find the "connected as …" notification, and tap it
  • or: go to Settings › Storage, tap the "overflow menu button" (the "3 stapled dots"), and tap the (only) entry which reads like "USB connection"

Then select either MTP or PTP, and there you are.

References:

  • This is the content of /data/property/persist.sys.usb.config on one of my tablets running Android 4.1 (stock)
  • This setting is mentioned in this answer, saying if you want to eanble ADB, you can setprop persist.sys.usb.config=mass_storage,adb

Postscriptum

Thanks to the context, one could set up some "toggle" using , executing either setprop persist.sys.usb.config=mass_storage,adb (to "get rid of the popups"), setprop persist.sys.usb.config=ptp,adb (to have it back in PTP mode), or setprop persist.sys.usb.config=mtp,adb to re-enable MTP for data transfer. I don't need any of this, as I use adbfs to access my files ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.