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

Do I need to integrate the libusbcommunication library to read devices in the ntfs system #386

Closed wangshufu closed 1 year ago

wangshufu commented 1 year ago

devices.forEachIndexed { index, usbMassStorageDevice -> usbMassStorageDevice.init() // Only uses the first partition on the device LogUtils.d("", "index: $index ${usbMassStorageDevice.partitions?.size}") if (usbMassStorageDevice.partitions.isNotEmpty()) { val currentFs = usbMassStorageDevice.partitions[0].fileSystem Log.d("", "Capacity: " + currentFs.capacity) Log.d("", "Occupied Space: " + currentFs.occupiedSpace) Log.d("", "Free Space: " + currentFs.freeSpace) Log.d("***", "Chunk size: " + currentFs.chunkSize) } }

Occasionally, data is returned! Here is my MainActivity code...

class MainActivity : AppCompatActivity(),ConsoleUtils.ConsoleMessageListener {

companion object {
    init {
        registerFileSystem(JavaFsFileSystemCreator())
    }
}

I have a question. I want to read the USB on the NTFS system. Do I need to add this code?

registerCommunication(LibusbCommunicationCreator()) underlyingUsbCommunication = UsbCommunicationFactory.UnderlyingUsbCommunication.OTHER

wangshufu commented 1 year ago

in addition: An exception occurred while executing this line of code... usbMassStorageDevice.init()

java.lang.IllegalArgumentExceptionkotlin.Unit

After multiple calls, throw java.io.IOException: MAX_RECOVERY_ATTEMPTS Exceeded while trying to transfer command to device, please reattach device and try againkotlin.Unit

magnusja commented 1 year ago

No the libusbcommunication module has nothing to do with the file system. You will need to use java-fs. Note that it only has read only support for ntfs though.

wangshufu commented 1 year ago

Thank you, I have a question. Can NTFS achieve read and write functions? If possible, what should be done? If it can only be read-only, then why?

magnusja commented 1 year ago

It can be archived. Someone has to write the code for it.

wangshufu commented 1 year ago

Hello, the system is FAT, but it still cannot be written. Do I have to go to the system file manager to authorize it? If so, how do I authorize it? image

magnusja commented 1 year ago

I dont know what that means (I only speak German and English).

Also I dont recognize that app. Please use the example app. If you coded that app, I guess it is upon you to enable writing and remove that blue banner?!

wangshufu commented 1 year ago

Hello, which systems are supported in the current version with read and write functions; I tried the exfat system and found an exception when calling usbMassStorageDevice. init()

java.io.IOException: MAX_RECOVERY_ATTEMPTS Exceeded while trying to transfer command to device, please reattach device and try again