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


Question

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.


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


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes