magnusja / libaums

Open source library to access USB Mass Storage devices on Android without rooting your device
Apache License 2.0
1.26k stars 270 forks source link

root.listFiles.size() is zero when change the disk filie system to exFat #396

Closed swithun-liu closed 1 year ago

swithun-liu commented 1 year ago

Problem

截屏2023-08-26 19 25 20

rootFile.listFiles() size is zero

it works well before I change the disk file system to exFat for big file

2023-08-26 19:44:49.079 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  found usb device: /dev/bus/usb/001/005=UsbDevice[mName=/dev/bus/usb/001/005,mVendorId=5421,mProductId=42360,mClass=0,mSubclass=0,mProtocol=0,mManufacturerName=JMicron,mProductName=USB to ATA/ATAPI Bridge,mVersion=2.01,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@ff14f99,mConfigurations=[
                                                                                                    UsbConfiguration[mId=1,mName=null,mAttributes=128,mMaxPower=250,mInterfaces=[
                                                                                                    UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=8,mSubclass=6,mProtocol=80,mEndpoints=[
                                                                                                    UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
                                                                                                    UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]
                                                                                                    UsbInterface[mId=0,mAlternateSetting=1,mName=null,mClass=8,mSubclass=6,mProtocol=98,mEndpoints=[
                                                                                                    UsbEndpoint[mAddress=1,mAttributes=2,mMaxPacketSize=512,mInterval=0]
                                                                                                    UsbEndpoint[mAddress=130,mAttributes=2,mMaxPacketSize=512,mInterval=0]
                                                                                                    UsbEndpoint[mAddress=131,mAttributes=2,mMaxPacketSize=512,mInterval=0]
                                                                                                    UsbEndpoint[mAddress=4,mAttributes=2,mMaxPacketSize=512,mInterval=0]]]]
2023-08-26 19:44:49.080 17633-17687 e.myapplicatio          com.example.myapplication            W  Accessing hidden method Lmiui/contentcatcher/sdk/data/PageConfig;->getFeatures()Ljava/util/ArrayList; (greylist, linking, allowed)
2023-08-26 19:44:49.080 17633-17687 e.myapplicatio          com.example.myapplication            W  Accessing hidden method Lmiui/contentcatcher/sdk/data/PageConfig;->getCatchers()Ljava/util/ArrayList; (greylist, linking, allowed)
2023-08-26 19:44:49.081 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  Found usb interface: UsbInterface[mId=0,mAlternateSetting=0,mName=null,mClass=8,mSubclass=6,mProtocol=80,mEndpoints=[
                                                                                                    UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
                                                                                                    UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]]
2023-08-26 19:44:49.081 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  Found usb endpoint: UsbEndpoint[mAddress=129,mAttributes=2,mMaxPacketSize=512,mInterval=0]
2023-08-26 19:44:49.081 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  Found usb endpoint: UsbEndpoint[mAddress=2,mAttributes=2,mMaxPacketSize=512,mInterval=0]
2023-08-26 19:44:49.081 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  found usb device: /dev/bus/usb/001/004=UsbDevice[mName=/dev/bus/usb/001/004,mVendorId=8457,mProductId=34839,mClass=17,mSubclass=0,mProtocol=0,mManufacturerName=VIA Labs, Inc.         ,mProductName=USB Billboard Device   ,mVersion=0.01,mSerialNumberReader=android.hardware.usb.IUsbSerialReader$Stub$Proxy@955b25e,mConfigurations=[
                                                                                                    UsbConfiguration[mId=1,mName=0000000000000001,mAttributes=192,mMaxPower=50,mInterfaces=[
                                                                                                    UsbInterface[mId=0,mAlternateSetting=0,mName=0000000000000001,mClass=17,mSubclass=0,mProtocol=0,mEndpoints=[]]]
2023-08-26 19:44:49.081 17633-17633 swithun-xxxx            com.example.myapplication            D  devices: 1
2023-08-26 19:44:49.114 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.MyUtilKt}#[nullCheck]#(52): #(null check) usb haspermission: true
2023-08-26 19:44:49.114 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.MainActivity}#[onCreate]#(112): usb 1
2023-08-26 19:44:49.116 17633-17633 AndroidUsbCommunication com.example.myapplication            D  setup device
2023-08-26 19:44:49.172 17633-17633 UsbMassStorageDevice    com.example.myapplication            I  MAX LUN 0
2023-08-26 19:44:49.174 17633-17633 ScsiBlockDevice         com.example.myapplication            D  inquiry response: ScsiInquiryResponse [peripheralQualifier=0, peripheralDeviceType=0, removableMedia=false, spcVersion=6, responseDataFormat=2]
2023-08-26 19:44:49.175 17633-17633 ScsiBlockDevice         com.example.myapplication            I  Block size: 512
2023-08-26 19:44:49.175 17633-17633 ScsiBlockDevice         com.example.myapplication            I  Last block address: 312581807
2023-08-26 19:44:49.178 17633-17633 PartitionTableFactory   com.example.myapplication            D  FileSystemPartitionTableCreator returned null
2023-08-26 19:44:49.179 17633-17633 GPT                     com.example.myapplication            D  EFI test string EFI PART
2023-08-26 19:44:49.179 17633-17633 GPT                     com.example.myapplication            D  EFI test string matches!
2023-08-26 19:44:49.180 17633-17633 PartitionTableFactory   com.example.myapplication            D  Found partition table GPTCreator
2023-08-26 19:44:49.183 17633-17633 FAT                     com.example.myapplication            I  fat is mirrored, fat count: 2
2023-08-26 19:44:49.183 17633-17633 ClusterChain            com.example.myapplication            D  Init a cluster chain, reading from FAT
2023-08-26 19:44:49.184 17633-17633 ClusterChain            com.example.myapplication            D  Finished init of a cluster chain
2023-08-26 19:44:49.197 17633-17633 FatDirectory            com.example.myapplication            D  volume label: EFI        
2023-08-26 19:44:49.197 17633-17633 Fat32FileSystem         com.example.myapplication            D  Fat32BootSector{bytesPerSector=512, sectorsPerCluster=1, reservedSectors=32, fatCount=2, totalNumberOfSectors=409600, sectorsPerFat=3151, rootDirStartCluster=2, fsInfoStartSector=1, fatMirrored=true, validFat=0, volumeLabel=''}
2023-08-26 19:44:49.198 17633-17633 Partition               com.example.myapplication            W  Unsupported fs on partition
2023-08-26 19:44:49.198 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.MainActivity}#[onCreate]#(114): usb 2 : init : kotlin.Unit
2023-08-26 19:44:49.198 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.MainActivity}#[onCreate]#(115): usb device.partitions: 1
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(66): usb Capacity: 209715200
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(67): usb Occupied Space: 3243520
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(68): usb 3
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(69): usb Free Space: 206471680
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(70): usb Chunk size: 512
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(71): usb 4
2023-08-26 19:44:49.199 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.filemanager.FileManagerViewModel}#[initUsbDevices]#(74): usb 5
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(245): usb Capacity: 209715200
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(246): usb Occupied Space: 3243520
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(247): usb 3
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(248): usb Free Space: 206471680
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(249): usb Chunk size: 512
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(250): usb 4
2023-08-26 19:44:49.200 17633-17633 swithun-xxxx            com.example.myapplication            D  {com.example.myapplication.viewmodel.NasViewModel}#[initUstDevices]#(253): usb 5
2023-08-26 19:44:49.203 17633-17633 FsInfoStructure         com.example.myapplication            D  writing to device
2023-08-26 19:44:49.203 17633-17633 FAT                     com.example.myapplication            I  allocating clusters finished
2023-08-26 19:44:49.204 17633-17633 FatDirectory            com.example.myapplication            D  adding entry: [FatLfnDirectoryEntry getName()=foo] with short name: FO0000~0.000
2023-08-26 19:44:49.208 17633-17633 ClusterChain            com.example.myapplication            D  Init a cluster chain, reading from FAT
2023-08-26 19:44:49.208 17633-17633 ClusterChain            com.example.myapplication            D  Finished init of a cluster chain
2023-08-26 19:44:49.210 17633-17633 FsInfoStructure         com.example.myapplication            D  writing to device
2023-08-26 19:44:49.210 17633-17633 FAT                     com.example.myapplication            I  allocating clusters finished
2023-08-26 19:44:49.210 17633-17633 FatDirectory            com.example.myapplication            D  adding entry: [FatLfnDirectoryEntry getName()=bar.txt] with short name: BA0000~0.TXT
2023-08-26 19:44:49.219 17633-17633 ClusterChain            com.example.myapplication            D  Init a cluster chain, reading from FAT
2023-08-26 19:44:49.219 17633-17633 ClusterChain            com.example.myapplication            D  Finished init of a cluster chain
2023-08-26 19:44:49.249 17633-17633 Looper                  com.example.myapplication            W  Slow Looper main: Activity com.example.myapplication/.MainActivity is 563ms late (wall=0ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 2 msg, msg 1 took 374ms (seq=2 running=343ms runnable=3ms late=1ms h=android.app.ActivityThread$H w=110), msg 2 took 345ms (seq=3 running=223ms runnable=15ms late=219ms h=android.app.ActivityThread$H w=159)
2023-08-26 19:44:49.282 17633-17633 ForceDarkHelper         com.example.myapplication            D  updateByCheckExcludeList: pkg: com.example.myapplication activity: com.example.myapplication.MainActivity@c3f3712
2023-08-26 19:44:49.405 17633-17667 AdrenoGLES              com.example.myapplication            I  QUALCOMM build                   : f2ab992, I401605978b
                                                                                                    Build Date                       : 09/28/19
                                                                                                    OpenGL ES Shader Compiler Version: EV031.27.05.01
                                                                                                    Local Branch                     : 
                                                                                                    Remote Branch                    : 
                                                                                                    Remote Branch                    : 
                                                                                                    Reconstruct Branch               : 
2023-08-26 19:44:49.405 17633-17667 AdrenoGLES              com.example.myapplication            I  Build Config                     : S L 8.0.11 AArch64
2023-08-26 19:44:49.409 17633-17667 AdrenoGLES              com.example.myapplication            I  PFP: 0x005ff112, ME: 0x005ff066

Expected behavior

Actual behavior

Stacktrace of Excpetion

(if exists)

Code where problem occurs

swithun-liu commented 1 year ago
image

I tried to add java-fs

nothing changed, is there a usage for java-fs, I didn't find it.

https://github.com/magnusja/java-fs, this readme no help for me

what should I do , I am really confused

magnusja commented 1 year ago

See this line here https://github.com/magnusja/libaums/blob/develop/app/src/main/java/me/jahnen/libaums/core/usbfileman/MainActivity.kt#L80

Highly unstable tho!