[Marshmallow] Write to USB
#16
(2017-12-23, 07:31)Tinwarble Wrote:
(2017-12-22, 22:20)ezriderz Wrote: Android MM does grant write permission to "file managers."  I use Astro, but ES and File Manager all are able to write and delete files on external storage. Since Kodi has file management features, it should be possible to modify Android or Kodi so they are installed as "File Managers" like Astro.  If that is possible, we should be able to rename and delete media files on a USB media source.

I'm not technical enough to even root an android media player, so this will require someone with more expertise than I have to do it.  But I cannot see why this is not a viable solution.

Anyone have any suggestions on how to do this? 

MM does grant access to file managers, you can use Xplore and it will give you full access to external drives.  But it does it in a way that is not easily enabled.

Kodi does not implement the access permission, especially on MM since it does not have Scoped Directory Access and would require you to go out of Kodi to get permission. But there is currently no plans on enabling write access to external drives in Kodi. 
What I am seeking is for Kodi to be considered as a file manager by Android.  Then I can use the file management features in Kodi to rename and delete files on my USB media source. 

Without this, I cannot keep my Nvidia Shield because there is no LibreElec build for Nvidia and I require this write access in my Kodi system.  Unfortunately, Nvidia Shield is the best 4K/UHD media player that I can find short of building my own system from scratch. 

I would have to find some other lesser box that has LibreElec available. Most of the affordable Kodi 4K boxes run under Android MM.  To use Kodi MM under Android with it's file management features enabled, it must be marked as a File Manager by Android. 

Some Android wizard should know how to build an app that makes that system change seamlessly if the Kodi Team refuses.
Reply
#17
(2017-12-23, 20:18)ezriderz Wrote: What I am seeking is for Kodi to be considered as a file manager by Android.  Then I can use the file management features in Kodi to rename and delete files on my USB media source. 

Without this, I cannot keep my Nvidia Shield because there is no LibreElec build for Nvidia and I require this write access in my Kodi system.  Unfortunately, Nvidia Shield is the best 4K/UHD media player that I can find short of building my own system from scratch. 

I would have to find some other lesser box that has LibreElec available. Most of the affordable Kodi 4K boxes run under Android MM.  To use Kodi MM under Android with it's file management features enabled, it must be marked as a File Manager by Android. 

Some Android wizard should know how to build an app that makes that system change seamlessly if the Kodi Team refuses. 
  
It has nothing to do with Kodi being considered a file manager on Android. We simply do not implement the framework to write to external drives & there are no plans, at least currently, to implement that.

And this is not specific to the Shield, it's across the whole Android platform. If you want write access via Kodi then you either need to adopted your external storage or get/build a NAS.
Forum Rules (wiki) | Banned add-ons (wiki) | Wiki (wiki) | Quick start guide (wiki)
Reply
#18
There's a way to write to USB, according to https://4pda.ru/forum/index.php?showtopi...ry54536065
First you need to activate debug mode on your android tv, then adb into it into root mode:

adb connect 192.168.x.x
adb root
adb connect 192.168.x.x
adb shell mount -o rw,remount /
adb shell mount -o rw,remount /system
adb pull /data/system/packages.xml ~/Downloads/packages.xml
adb pull /data/system/packages.list ~/Downloads/packages.list

Now you should find your package name in packages.list and then edit packages.xml in your Downloads folder.
Find the apps section you want (e.g. com.ghisler.android.TotalCommander), locate its <perms> section and add the following line:
<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

same goes for Kodi etc..

Then save and upload the packages.xml back on your android tv:
adb push ~/Downloads/packages.xml /data/system/packages.xml

Turn debug off and reboot the system.
You should be able to access your USB drive for read+write from Total Terminal now!
Reply
#19
interesting.......
Reply
#20
(2018-03-30, 10:44)mallexxx Wrote: There's a way to write to USB, according to https://4pda.ru/forum/index.php?showtopi...ry54536065

<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

same goes for Kodi etc..

IT DOES.., finally!

Did it without ADB, just copied packages.xml to PC, edited it and copied it back to the box - rebooted.., and full USB write access granted Big Grin

On my box now it looks like this:

<package name="org.xbmc.kodi" codePath="/data/app/org.xbmc.kodi-2" nativeLibraryPath="/data/app/org.xbmc.kodi-2/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097094" privateFlags="0" ft="1627693f1f0" it="161715762ee" ut="1627694263c" version="1799702" userId="10063" installer="com.android.packageinstaller">
        <sigs count="1">
            <cert index="29"
        </sigs>
        <perms>
            <item name="android.permission.MODIFY_AUDIO_SETTINGS" granted="true" flags="0" />
            <item name="android.permission.RECEIVE_BOOT_COMPLETED" granted="true" flags="0" />
            <item name="android.permission.BLUETOOTH" granted="true" flags="0" />
            <item name="android.permission.GET_TASKS" granted="true" flags="0" />
            <item name="android.permission.INTERNET" granted="true" flags="0" />
            <item name="android.permission.READ_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />            
            <item name="android.permission.ACCESS_NETWORK_STATE" granted="true" flags="0" />
            <item name="android.permission.WRITE_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
        </perms>
Reply
#21
Hi.
This method requires root acces. Is there any option for users without ROOT acces? 
I've tried to decompile, add the line in kodi manifest.xml and then compile again, but no luck.

Kinds regards.
Reply
#22
You have to add that line to packages.xml, not to manifest.xml.

Did you try "360 Root Tool" or "MagiskManager" to gain root access?
Reply
#23
(2018-03-30, 13:44)Sholander Wrote:
(2018-03-30, 10:44)mallexxx Wrote: There's a way to write to USB, according to https://4pda.ru/forum/index.php?showtopi...ry54536065

<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

same goes for Kodi etc..

IT DOES.., finally!

Did it without ADB, just copied packages.xml to PC, edited it and copied it back to the box - rebooted.., and full USB write access granted Big Grin

On my box now it looks like this:

<package name="org.xbmc.kodi" codePath="/data/app/org.xbmc.kodi-2" nativeLibraryPath="/data/app/org.xbmc.kodi-2/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097094" privateFlags="0" ft="1627693f1f0" it="161715762ee" ut="1627694263c" version="1799702" userId="10063" installer="com.android.packageinstaller">
        <sigs count="1">
            <cert index="29"
        </sigs>
        <perms>
            <item name="android.permission.MODIFY_AUDIO_SETTINGS" granted="true" flags="0" />
            <item name="android.permission.RECEIVE_BOOT_COMPLETED" granted="true" flags="0" />
            <item name="android.permission.BLUETOOTH" granted="true" flags="0" />
            <item name="android.permission.GET_TASKS" granted="true" flags="0" />
            <item name="android.permission.INTERNET" granted="true" flags="0" />
            <item name="android.permission.READ_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />            
            <item name="android.permission.ACCESS_NETWORK_STATE" granted="true" flags="0" />
            <item name="android.permission.WRITE_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
        </perms> 

I use Kodi to watch videos and play music which is stored on my network shared drives and folders as well as USB drives plugged into the player. After watching a tv episode, I delete it from within Kodi (I enable "file rename and delete" in Kodi settings).  As we all know, when using an Android based media player like Shield, MX Pro 4K, or any of the other TV boxes out there, Android fails to allow this due to lack of write privilege.  There are thousands or millions of Android TV boxes out there which would be fine Kodi boxes if they had permission from Android to rename and delete files on non-adopted attached storage.

Does this fix work for network drives as well as USB attached drives which contain playable media?
Reply
#24
(2018-03-30, 13:44)Sholander Wrote:
(2018-03-30, 10:44)mallexxx Wrote: There's a way to write to USB, according to https://4pda.ru/forum/index.php?showtopi...ry54536065

<item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />

same goes for Kodi etc..
IT DOES.., finally!

Did it without ADB, just copied packages.xml to PC, edited it and copied it back to the box - rebooted.., and full USB write access granted Big Grin

On my box now it looks like this:

<package name="org.xbmc.kodi" codePath="/data/app/org.xbmc.kodi-2" nativeLibraryPath="/data/app/org.xbmc.kodi-2/lib" primaryCpuAbi="armeabi-v7a" publicFlags="940097094" privateFlags="0" ft="1627693f1f0" it="161715762ee" ut="1627694263c" version="1799702" userId="10063" installer="com.android.packageinstaller">
        <sigs count="1">
            <cert index="29"
        </sigs>
        <perms>
            <item name="android.permission.MODIFY_AUDIO_SETTINGS" granted="true" flags="0" />
            <item name="android.permission.RECEIVE_BOOT_COMPLETED" granted="true" flags="0" />
            <item name="android.permission.BLUETOOTH" granted="true" flags="0" />
            <item name="android.permission.GET_TASKS" granted="true" flags="0" />
            <item name="android.permission.INTERNET" granted="true" flags="0" />
            <item name="android.permission.READ_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WRITE_MEDIA_STORAGE" granted="true" flags="0" />            
            <item name="android.permission.ACCESS_NETWORK_STATE" granted="true" flags="0" />
            <item name="android.permission.WRITE_EXTERNAL_STORAGE" granted="true" flags="0" />
            <item name="android.permission.WAKE_LOCK" granted="true" flags="0" />
        </perms> 
 
I tried doing that.  Copied the Packages.xml file to my PC, edited the line as written above, then tried to restore it to the same folder in my Android Data folder only to run into permissions problem.  The file does not have R/W permission itself, so could not be overwritten.  I'm not strong enough in linux coding to figure out how to get enough permission to grant R/W permission to that file.

What can a non-linux programmer do to overwrite the file from my filezilla FTP client?  Is there a way to access it in Windows where I'm a little more comfortable?
Reply
#25
(2019-10-21, 00:04)ezriderz Wrote:
(2018-03-30, 13:44)Sholander Wrote: I tried doing that.  Copied the Packages.xml file to my PC, edited the line as written above, then tried to restore it to the same folder in my Android Data folder only to run into permissions problem.  The file does not have R/W permission itself, so could not be overwritten.  I'm not strong enough in linux coding to figure out how to get enough permission to grant R/W permission to that file.

What can a non-linux programmer do to overwrite the file from my filezilla FTP client?  Is there a way to access it in Windows where I'm a
littlemore comfortable?
This method that you tried works only on rooted Android, so no Windows or Linux fix for your problem...
Reply
#26
(2019-10-21, 00:10)Sholander Wrote:
(2019-10-21, 00:04)ezriderz Wrote:
(2018-03-30, 13:44)Sholander Wrote: I tried doing that.  Copied the Packages.xml file to my PC, edited the line as written above, then tried to restore it to the same folder in my Android Data folder only to run into permissions problem.  The file does not have R/W permission itself, so could not be overwritten.  I'm not strong enough in linux coding to figure out how to get enough permission to grant R/W permission to that file.

What can a non-linux programmer do to overwrite the file from my filezilla FTP client?  Is there a way to access it in Windows where I'm a
littlemore comfortable?
This method that you tried works only on rooted Android, so no Windows or Linux fix for your problem... 
Thanks for that.  Now I have to figure out how to root my android TV box.  I have not even rooted my android phone.  What is the easiest way to root an Android TV box?  This looks like an app waiting to be developed and used by a million Android TV box users with USB attached media storage.
Reply
#27
(2019-10-21, 00:17)ezriderz Wrote:
(2019-10-21, 00:10)Sholander Wrote:
(2019-10-21, 00:04)ezriderz Wrote:  
This method that you tried works only on rooted Android, so no Windows or Linux fix for your problem...  
Thanks for that.  Now I have to figure out how to root my android TV box.  I have not even rooted my android phone.  What is the easiest way to root an Android TV box? 
To begin, look at this post
Reply
#28
(2017-12-23, 21:00)Tinwarble Wrote:
(2017-12-23, 20:18)ezriderz Wrote: What I am seeking is for Kodi to be considered as a file manager by Android.  Then I can use the file management features in Kodi to rename and delete files on my USB media source. 

Without this, I cannot keep my Nvidia Shield because there is no LibreElec build for Nvidia and I require this write access in my Kodi system.  Unfortunately, Nvidia Shield is the best 4K/UHD media player that I can find short of building my own system from scratch. 

I would have to find some other lesser box that has LibreElec available. Most of the affordable Kodi 4K boxes run under Android MM.  To use Kodi MM under Android with it's file management features enabled, it must be marked as a File Manager by Android. 

Some Android wizard should know how to build an app that makes that system change seamlessly if the Kodi Team refuses. 
  
It has nothing to do with Kodi being considered a file manager on Android. We simply do not implement the framework to write to external drives & there are no plans, at least currently, to implement that.

And this is not specific to the Shield, it's across the whole Android platform. If you want write access via Kodi then you either need to adopted your external storage or get/build a NAS. 
Thank you, Tinwarbie.  I now understand that Kodi does not know how to ask for for permission from the user needed to grant R/W access to non-adopted storage.  Too bad developers have not seen the need for that since most users are using Android TV boxes. 

I have a neighbors cheap Android TV box with Kodi and I was able to connect it to my network and it did delete files off my network.  But not off a local USB drive.  I'm not sure I understand the difference from an Android point of view.
Reply
#29
(2017-12-23, 21:00)Tinwarble Wrote:
(2017-12-23, 20:18)ezriderz Wrote: What I am seeking is for Kodi to be considered as a file manager by Android.  Then I can use the file management features in Kodi to rename and delete files on my USB media source. 

Without this, I cannot keep my Nvidia Shield because there is no LibreElec build for Nvidia and I require this write access in my Kodi system.  Unfortunately, Nvidia Shield is the best 4K/UHD media player that I can find short of building my own system from scratch. 

I would have to find some other lesser box that has LibreElec available. Most of the affordable Kodi 4K boxes run under Android MM.  To use Kodi MM under Android with it's file management features enabled, it must be marked as a File Manager by Android. 

Some Android wizard should know how to build an app that makes that system change seamlessly if the Kodi Team refuses. 
  
It has nothing to do with Kodi being considered a file manager on Android. We simply do not implement the framework to write to external drives & there are no plans, at least currently, to implement that.

And this is not specific to the Shield, it's across the whole Android platform. If you want write access via Kodi then you either need to adopted your external storage or get/build a NAS.  


Thank you, Tinwarbie.  I now understand that Kodi does not know how to ask for for permission from the user needed to grant R/W access to non-adopted storage.  Too bad developers have not seen the need for that since most users are using Android TV boxes. 

I have a neighbors cheap Android TV box right now, with Kodi installed, and I was able to connect it to my network and it did delete files off my network.  But not off a local USB drive.  I'm not sure I understand the difference from an Android point of view.
Reply

Logout Mark Read Team Forum Stats Members Help
[Marshmallow] Write to USB0