|
From: Kustaa N. <ea...@ea...> - 2024-05-31 06:58:57
|
On 31.5.2024 9.06, hacka thon wrote: > Thanks for your response, > You are absolutely right, > that Operating systems will automatically mount USB devices, However, > I tried this in my mobile application where I received an events for > USB attach and detach, but USB Mass storage not displayed in Mobile's > default File Manager, Then I found that most of the smart phones are > only supporting FAT32 systems, but I have FAT16 USB mass storage > device which is not supported by some latest phones like Redmi, some > series of Samsung phones,etc. > So, how can I use your library to communicate with USB > FAT16/32 devices as you mentioned on your libusb Info page. I'm no expert in this but I think you are heading for a lot of trouble/work. libUSB just provides the low level access to the USB end points. I do not know if even the next level above that is universal i.e. if there is a universal way to read/right sectors/blocks in mass storage. If not then you will have to cope with emulating what the operating system driver does for every different type of mass storage you want to support. Then above that you need to be able to do what the file system in the OS does. Some almost 40 years ago I wrote a FAT16/32 file system component from scratch with minimal info (just reverse engineering). Today you can probably find some code that does this, for example from the Linux sources, but that and the drivers are C-code. You can access C-code from Java with JNI and more easily IMO using JNA (if supported on Android) but it will not be as trivial as just calling some Linux driver or file system calls. So it is doable. But I think it will not be a trivial few hours to apply that knowledge in Java. In any case libUSB AFAIK just provides you with access to the end point descriptors and access to the end points, the rest is up to you. wbr Kusti |