Homebrew WIP libusbhsfs - USB Mass Storage Class Host + Filesystem Mounter static library.

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,288
Trophies
0
Age
26
Location
Madrid, Spain
Website
github.com
XP
2,469
Country
Spain
Link: https://github.com/DarkMatterCore/libusbhsfs. Co-developed with XorTroll and Rhys Koedijk.

This is a static library for homebrew applications which is aimed at developers that wish to integrate USB Mass Storage (UMS) support into their projects.
  • Provides a very easy to use interface, which lets the application retrieve:
    • A user-mode status event to wait for UMS changes.
    • Total count of mounted devices.
    • List mounted devices.
  • Spans a background thread that's capable of:
    • Listening for UMS status changes (new device, device removed).
    • Starting logical units from each detected UMS device.
    • Automatically mounting any detected filesystems from the logical units in each detected UMS device.
      • Supports MBR/EBR/GPT/SFD partitioning schemes.
      • Supports FAT12, FAT16, FAT32, exFAT, NTFS*, EXT2*, EXT3* and EXT4* volumes.
    • Signaling the user-mode event to let the application know it detected some changes and processed them.
  • Support for variable-sized logical blocks and long (64-bit) logical block addresses.
  • Automatic devoptab device (un)registration, so you can use standard libc I/O calls on mounted filesystems.
  • Relative path support.
  • Dedicated 8 MiB buffer per each UMS device, which helps speed up data transfers.
  • Unlike fsp-usb, the library doesn't depend on using a custom "ams_mitm.kip" with Atmosphère - just link your homebrew application against it and it will work.
  • Licensed under the ISC License, so anyone can freely use it - even as part of private/closed-source projects. We really want developers to adopt this library.
* Only in GPL builds of the library. ISC licensed builds only offer FAT support.

I'll just say this once before someone throws the usual question: this doesn't open any possibility whatsoever to launch Switch games from a UMS device, and never will. Something like that demands system-wide UMS support, which this library clearly doesn't provide.

Please let me know what you think. :)
 
Last edited by DarkMatterCore,

iriez

Well-Known Member
Member
Joined
Oct 27, 2016
Messages
548
Trophies
0
Age
47
Website
www.xbins.org
XP
1,802
Country
United States
Finally! The other implementation was very quirky. Glad to see some alternative options and hope this is stable :)

Are there any file transfer limitations? I see it supports EXfat! This is great.
 
Last edited by iriez,

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,288
Trophies
0
Age
26
Location
Madrid, Spain
Website
github.com
XP
2,469
Country
Spain
Thank you all for your kind comments and support!

Please feel free to test it and report any bugs or feature requests. If they can be implemented, I'll gladly add them to our to-do list.

Aree there any file transfer limitations? I see it supports EXfat! This is great.

Only limitations inherent to the underlying filesystem used by the UMS device you're working with. That's why the listed UsbHsFsDevice elements include a fs_type field, to let developers workaround filesystem-specific limitations.

Other than that, the whole interface is pretty much filesystem-agnostic to the end-user.
 

DarkMatterCore

I like turtles.
OP
Developer
Joined
May 30, 2009
Messages
1,288
Trophies
0
Age
26
Location
Madrid, Spain
Website
github.com
XP
2,469
Country
Spain
How high is the transfer speed of a common HDD? (seagate)

We performed benchmarks reading the first raw 128 MiB (concurrent reads) from each connected drive with logging enabled back when the Bulk-Only Transport driver was still being developed, and we got speeds between 4 and 6 seconds. We used portable Seagate HDDs and WD HDDs with custom enclosures. So we could be talking anywhere between ~21 and 32 MiB/s - which yes, is better than fsp-usb's performance.

Disabling debug logging makes transfers go even faster, but we can't properly do benchmarks without it. Even if you're using the example test application, there's a noticeable difference if you link it against the debug build of the library vs the release one.
 

nWo

The Game Master
Member
Joined
Oct 20, 2016
Messages
728
Trophies
0
Website
www.facebook.com
XP
1,942
Country
Mexico
Thank you, this is awesome. I just want this implemented so I can play music and movies from a USB on the TV, that would be ill. Then, run some classic games on retroarch, all of that without using up space on the SD card. As a matter of fact I still use from time to time my Wii to do these things, so it will be a great, great addition to be able to do it at last on the Switch.
 
General chit-chat
Help Users
    Dark_Phoras @ Dark_Phoras: I'm an ancient knight of a powerful other-dimensional realm