Sunday, February 10, 2019

cyanogenmod - "adb devices" gives "no permission" when on charge-only


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 and, if proven stable, to integrate with built.prop.



Answer




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 ;)


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...